/* #######################	  SET CSS ####################### */
	var headID = document.getElementsByTagName("head")[0];
	var cssNode = document.createElement('link');
	cssNode.type = 'text/css';
	cssNode.rel = 'stylesheet';
	cssNode.href = 'http://www.cisco.com/assets/pilot/c39/c39.css';
	cssNode.media = 'screen';
	headID.appendChild(cssNode);

/* #######################	  SET CAROUSEL VARIABLES ####################### */

	var varReady = "false";
	var tttext = ["","","","",""];
	var deeplink="false";
	var currentframe = 0;
	var firsttime = "";

   var carVars = document.createElement('script');
   carVars.type = "text/javascript";
   carVars.src = carouselOptions;
   headID.appendChild(carVars);


chkReady();

function chkReady()
	{
	if(varReady == "true"){buildCarousel();}
	else {setTimeout("chkReady()",300);}
	}


/*	CODE TO FIX IE VIDEO BUG */
var ob2 = null;
function playerReady(obj) { ob2 = document.getElementById(obj.id); }
function stopVideo(ob1) { if(jQuery.browser.msie) {ob1.sendEvent('STOP');}}
/*	END CODE TO FIX IE VIDEO BUG */


/* ###########################   BUILD CAROUSEL  ########################### */

function buildCarousel()
{


/* #######################	  CAROUSEL FRAME FUNCTION ####################### */

jQuery.fn.pager = function(clas, options) {
var settings = {
navId: 'nav',
navClass: 'nav',
navAttach: 'append',
highlightClass: 'highlight',
prevText: '&laquo;',
nextText: '&raquo;',
linkText: null,
linkWrap: null,
height: null
}
if(options) jQuery.extend(settings, options);
var timer = "";
var timercheck = "";
var spinnums = 0;

	return this.each( function ()
	{
		var me = jQuery(this);
		var size;
		var i = 0;

		var url= window.location.href;
		if(url.indexOf('?1')>0) {i=0;currentframe=0;deeplink="true";}
		if(url.indexOf('?2')>0) {i=1;currentframe=1;deeplink="true";}
		if(url.indexOf('?3')>0) {i=2;currentframe=2;deeplink="true";}
		if(url.indexOf('?4')>0) {i=3;currentframe=3;deeplink="true";}
		if(url.indexOf('?5')>0) {i=4;currentframe=4;deeplink="true";}

		var navid = '#'+settings.navId;
		  fnums = framenums;
		  iTime = 5000;

		function init () {
			size = jQuery(clas, me).not(navid).size();
			if(settings.height == null) {
				settings.height = getHighest();
			}
			if(size > 1) {
				makeNav();
				show();
			}
			sizePanel();
			if(settings.linkWrap != null) {
				linkWrap();
			}
		}
		function makeNav () {
			var str = '<div id="'+settings.navId+'" class="'+settings.navClass+'">';
			for(var i = 0; i < size; i++) {
				var j = i+1;
				str += '<a href="javascript void(0);" rel="'+j+'" id="thmb' + i + '">';
				str += (settings.linkText == null) ? j : settings.linkText[j-1];
				str += '</a>';
			}
			str += '</div>';
			switch (settings.navAttach) {
				case 'before':
					jQuery(me).before(str);
					break;
				case 'after':
					jQuery(me).after(str);
					break;
				case 'prepend':
					jQuery(me).prepend(str);
					break;
				default:
					jQuery(me).append(str);
					break;
			}
		}
		function show ()
			{
				jQuery(me).find(clas).not(navid).hide();
				var showme = jQuery(me).find(clas).not(navid).get(i);
				jQuery(showme).fadeIn(800);
				highlight();
				if ( i >= fnums-1 ){i = 0;}
				else {i++;}

				/*	======== CODE TO FIX IE VIDEO BUG	======== */
                  obj="videoplayer" + currentframe;
      				obj=document.getElementById(obj);

      				if(obj!=null) {
         				if(firsttime=="")	{ firsttime="true"; }
         				else { stopVideo(obj); }
      				}

                  if(i==0) {currentframe=(framenums-1);}
                  else {currentframe=(i-1);}
            /*	======== END CODE TO FIX IE VIDEO BUG	======== */

					if(rotate=="true" && timercheck=="")
					{
						timer=setTimeout(function() { show() }, iTime);
						$("#dcarhold").click(function () { clearTimeout(timer);});
						if(deeplink=="true") {clearTimeout(timer);}
						$("#videoplayer0").mousedown(function () {clearTimeout(timer);	 });
						$("#videoplayer1").mousedown(function () {clearTimeout(timer);	 });
						$("#videoplayer2").mousedown(function () {clearTimeout(timer);	 });
						$("#videoplayer3").mousedown(function () {clearTimeout(timer);	 });
						$("#videoplayer4").mousedown(function () {clearTimeout(timer);	 });
						spinstops=fnums*2;
						if(spinnums>=spinstops){clearTimeout(timer);}
						spinnums++;
					}
					else
					{
						clearTimeout(timer);
					}

			}


		function highlight () {
			jQuery(me).find(navid).find('a').removeClass(settings.highlightClass);
			var shownav = jQuery(me).find(navid).find('a').get(i);
			jQuery(shownav).addClass(settings.highlightClass);
		}
		function sizePanel () {
			if(jQuery.browser.msie) {
				jQuery(me).find(clas).not(navid).css( {
					height: settings.height
				});
			} else {
				jQuery(me).find(clas).not(navid).css( {
					minHeight: settings.height
				});
			}
		}
		function getHighest () {
			var highest = 0;
			jQuery(me).find(clas).not(navid).each(function () {
				if(this.offsetHeight > highest) {
					highest = this.offsetHeight;
				}
			});
			highest = highest + "px";
			return highest;
		}
		function getNavHeight () {
			var nav = jQuery(navid).get(0);
			return nav.offsetHeight;
		}
		function linkWrap () {
			jQuery(me).find(navid).find("a").wrap(settings.linkWrap);
		}
		init();
		jQuery(this).find(navid).find("a").click(function () {

			if(jQuery(this).attr('rel') == 'next') {
				if(i + 1 < size) {
					i = i+1;
				}
			} else if(jQuery(this).attr('rel') == 'prev') {
				if(i > 0) {
					i = i-1;
				}
			} else {
				var j = jQuery(this).attr('rel');
				i = j-1;
			}

			timercheck="cancel";
			clearTimeout(timer);
			show();
			return false;
		});
	});
}




/* ####################################	  SWFOBJECT #################################### */

/*** SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/** SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:* http://www.opensource.org/licenses/mit-license.php**/

if(typeof deconcept=="undefined"){var deconcept=new Object();}
var globalembed ="";if (typeof deconcept == "undefined") {var deconcept = new Object();}if (typeof deconcept.util == "undefined") {deconcept.util = new Object();}if (typeof deconcept.SWFObjectUtil == "undefined") {deconcept.SWFObjectUtil = new Object();}deconcept.SWFObject = function (_1, id, w, h, _5, c, _7, _8, _9, _a) {if (!document.getElementById) {return;}this.DETECT_KEY = _a ? _a : "detectflash";this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);this.params = new Object();this.variables = new Object();this.attributes = new Array();if (_1) {this.setAttribute("swf", _1);}if (id) {this.setAttribute("id", id);}if (w) {this.setAttribute("width", w);}if (h) {this.setAttribute("height", h);}if (_5) {this.setAttribute("version", new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();if (!window.opera && document.all && this.installedVer.major > 7) {deconcept.SWFObject.doPrepUnload = true;}if (c) {this.addParam("bgcolor", c);}var q = _7 ? _7 : "high";this.addParam("quality", q);this.setAttribute("useExpressInstall", false);this.setAttribute("doExpressInstall", false);var _c = (_8) ? _8 : window.location;this.setAttribute("xiRedirectUrl", _c);this.setAttribute("redirectUrl", "");if (_9) {this.setAttribute("redirectUrl", _9);}};deconcept.SWFObject.prototype = {useExpressInstall: function (_d) {this.xiSWFPath = !_d ? "expressinstall.swf" : _d;this.setAttribute("useExpressInstall", true);},setAttribute: function (_e, _f) {this.attributes[_e] = _f;},getAttribute: function (_10) {return this.attributes[_10];},addParam: function (_11, _12) {this.params[_11] = _12;},getParams: function () {return this.params;},addVariable: function (_13, _14) {this.variables[_13] = _14;},getVariable: function (_15) {return this.variables[_15];},getVariables: function () {return this.variables;},getVariablePairs: function () {var _16 = new Array();var key;var _18 = this.getVariables();for (key in _18) {_16[_16.length] = key + "=" + _18[key];}return _16;},getSWFHTML: function () {var _19 = "";if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) {if (this.getAttribute("doExpressInstall")) {this.addVariable("MMplayerType", "PlugIn");this.setAttribute("swf", this.xiSWFPath);}_19 = "<embed type=\"application/x-shockwave-flash\" src=\"" + this.getAttribute("swf") + "\" width=\"" + this.getAttribute("width") + "\" height=\"" + this.getAttribute("height") + "\" style=\"" + this.getAttribute("style") + "\"";_19 += " id=\"" + this.getAttribute("id") + "\" name=\"" + this.getAttribute("id") + "\" ";var _1a = this.getParams();for (var key in _1a) {_19 += [key] + "=\"" + _1a[key] + "\" ";}var _1c = this.getVariablePairs().join("&");if (_1c.length > 0) {_19 += "flashvars=\"" + _1c + "\"";}_19 += "/>";}else{if (this.getAttribute("doExpressInstall")) {this.addVariable("MMplayerType", "ActiveX");this.setAttribute("swf", this.xiSWFPath);}_19 = "<object id=\"" + this.getAttribute("id") + "\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"" + this.getAttribute("width") + "\" height=\"" + this.getAttribute("height") + "\" style=\"" + this.getAttribute("style") + "\">";_19 += "<param name=\"movie\" value=\"" + this.getAttribute("swf") + "\" />";var _1d = this.getParams();for (var key in _1d) {_19 += "<param name=\"" + key + "\" value=\"" + _1d[key] + "\" />";}var _1f = this.getVariablePairs().join("&");if (_1f.length > 0) {_19 += "<param name=\"flashvars\" value=\"" + _1f + "\" />";}_19 += "</object>";}return _19;},write: function (_20) {if (this.getAttribute("useExpressInstall")) {var _21 = new deconcept.PlayerVersion([6, 0, 65]);if (this.installedVer.versionIsValid(_21) && !this.installedVer.versionIsValid(this.getAttribute("version"))) {this.setAttribute("doExpressInstall", true);this.addVariable("MMredirectURL", escape(this.getAttribute("xiRedirectUrl")));document.title = document.title.slice(0, 47) + " - Flash Player Installation";this.addVariable("MMdoctitle", document.title);}}
 if (this.skipDetect || this.getAttribute("doExpressInstall") || this.installedVer.versionIsValid(this.getAttribute("version"))) {var n = (typeof _20 == "string") ? document.getElementById(_20) : _20;

  globalembed=this.getSWFHTML();
	return globalembed;
 }
else {if (this.getAttribute("redirectUrl") != "") {document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion = function () {var _23 = new deconcept.PlayerVersion([0, 0, 0]);if (navigator.plugins && navigator.mimeTypes.length) {var x = navigator.plugins["Shockwave Flash"];if (x && x.description) {_23 = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));}} else {if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0) {var axo = 1;var _26 = 3;while (axo) {try {_26++;axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + _26);_23 = new deconcept.PlayerVersion([_26, 0, 0]);} catch(e) {axo = null;}}} else {try {var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");} catch(e) {try {var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23 = new deconcept.PlayerVersion([6, 0, 21]);axo.AllowScriptAccess = "always";} catch(e) {if (_23.major == 6) {return _23;}}try {axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");} catch(e) {}}if (axo != null) {_23 = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion = function (_29) {this.major = _29[0] != null ? parseInt(_29[0]) : 0;this.minor = _29[1] != null ? parseInt(_29[1]) : 0;this.rev = _29[2] != null ? parseInt(_29[2]) : 0;};deconcept.PlayerVersion.prototype.versionIsValid = function (fv) {if (this.major < fv.major) {return false;}if (this.major > fv.major) {return true;}if (this.minor < fv.minor) {return false;}if (this.minor > fv.minor) {return true;}if (this.rev < fv.rev) {return false;}return true;};deconcept.util = {getRequestParameter: function (_2b) {var q = document.location.search || document.location.hash;if (_2b == null) {return q;}if (q) {var _2d = q.substring(1).split("&");for (var i = 0; i < _2d.length; i++) {if (_2d[i].substring(0, _2d[i].indexOf("=")) == _2b) {return _2d[i].substring((_2d[i].indexOf("=") + 1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs = function () {var _2f = document.getElementsByTagName("OBJECT");for (var i = _2f.length - 1; i >= 0; i--) {_2f[i].style.display = "none";for (var x in _2f[i]) {if (typeof _2f[i][x] == "function") {_2f[i][x] = function () {};}}}};if (deconcept.SWFObject.doPrepUnload) {if (!deconcept.unloadSet) {deconcept.SWFObjectUtil.prepUnload = function () {__flash_unloadHandler = function () {};__flash_savedUnloadHandler = function () {};window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet = true;}}if (!document.getElementById && document.all) {document.getElementById = function (id) {return document.all[id];};}
var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;




jQuery(document).ready(function() {

$("#dcar-js").hide();


/* #######################	  CREATE CAROUSEL HOLDER ####################### */

	var carcontent ="";
	var rotnum=0;
	var prvnum=1;
	var cw = carwidth;
	var ctype = "";
	if(jQuery.browser.msie) {
	 if (jQuery.browser.msie && (parseInt(jQuery.browser.version) < 8 )) { ctype="className" }
	 else { ctype="class"; }
	}
	else {ctype="class"}

	var carouseldiv = document.createElement("div");
	if (cw=="narrow") { carouseldiv.setAttribute(ctype,"clb c39-pilot c39v1x1 c39v1x2 c39v5x1 divtest");}
	else {carouseldiv.setAttribute(ctype,"clb c39-pilot c39v1x1 c39v1x2 c39v5x1 c39v6x1 divtest");}
	jQuery("#dcarhold").append(carouseldiv);


	/* ========== Create Close Caption Divs  ========== */
      var closecaptiondiv = document.createElement("div");
      closecaptiondiv.setAttribute("id","cc-caption");
      jQuery(".c39-pilot").append(closecaptiondiv);
      var closecaptionbackdiv = document.createElement("div");
      closecaptionbackdiv.setAttribute("id","cc-caption-back");
      jQuery(".c39-pilot").append(closecaptionbackdiv);


	var carouseldivin = document.createElement("div");
	carouseldivin.setAttribute("id","dcar");
	jQuery(carouseldiv).append(carouseldivin);

	if(rtlenable=="true") {
	jQuery("#dcar").addClass("ltrenable");
	jQuery("#cc-caption").addClass("ltrenable");
	}

/* #######################	  CREATE INDIVIDUAL CAROUSEL FRAMES ####################### */

for (i=0;i<=framenums-1; i++)
{
	var framecontent='';
	var framediv = document.createElement("div");
	framediv.setAttribute(ctype,"frame");
	framediv.setAttribute("id","frame" + i);
	jQuery("#dcar").append(framediv);

/*	 #######################  CREATE LEFT HAND CONTENT FOR FRAME  #######################	*/

	var framecontleft = document.createElement("div");
	framecontleft.setAttribute(ctype,"leftcontent");
	jQuery(framediv).append(framecontleft);
	var framehead = document.createElement("h2");
	jQuery(framecontleft).append(framehead);
	jQuery(framehead).append(carouselOptions[i][1]);
	var frametext = document.createElement("p");
	jQuery(framecontleft).append(frametext);
	jQuery(frametext).append(carouselOptions[i][2]);

	if(carouselOptions[i][3] != "")
	{
		var framelink = document.createElement("p");
		framelink.setAttribute(ctype,"cta-link");
		jQuery(framecontleft).append(framelink);

		/* alt link style? */

		if(carouselOptions[i][5]=="true")
		{
		var framelinkcont = '<a href="' + carouselOptions[i][4] + '" class="cta2" id="poplink' + i + '"><b><b>' + carouselOptions[i][3] + '</b></b></a>';
		}
		else
		{
		var framelinkcont = '<a href="' + carouselOptions[i][4] + '" class="cta" id="poplink' + i + '"><b><b>' + carouselOptions[i][3] + '</b></b></a>';
		}

	jQuery(framelink).append(framelinkcont);
	}





/*	 #######################  CREATE RIGHT HAND CONTENT FOR FRAME	#######################	 */

	var framecontright = document.createElement("div");
	framecontright.setAttribute(ctype,"rightcontent");
	jQuery(framediv).append(framecontright);





/*	 #######################  BEGIN CREATE LIGHTBOX VIDEO	 #######################  */

if(carouselOptions[i][0]=="Lightbox")
{
   tttext[i]=carouselOptions[i][15];
   metricstitle=carouselOptions[i][16];
   metricstitle = metricstitle.replace( /\<br\>/gi, " " );
   metricstitle = metricstitle.replace( /\<br\/\>/gi, " " );
	var framelbwrap = document.createElement("div");
	framelbwrap.setAttribute(ctype,"lbtrig");
	jQuery(framecontright).append(framelbwrap);
   var lblink = '<a href="javascript:void(0)" rel="lightbox' + i + '">';
	lblink += '<span class="playimg"></span><img src="' + carouselOptions[i][9] + '"></a>';
	jQuery(framelbwrap).append(lblink);
	var lbvidhold = document.createElement("div");
	lbvidhold.setAttribute(ctype,"clb c26v1 carlb");
	lbvidhold.setAttribute("id","lightbox" + i);
	jQuery(framecontright).append(lbvidhold);
	var lbvidhead = document.createElement("h2");
	jQuery(lbvidhold).append(jQuery(lbvidhead).append(carouselOptions[i][1]));
	var lbclose = document.createElement("div");
	lbclose.setAttribute(ctype,"lb-close");
	var lbbutton = '<a href="javascript:void()" class="jqmClose">Close <img src="/web/fw/i/close-button.gif" alt="" align="bottom"></a>';
	jQuery(lbvidhold).append(jQuery(lbclose).append(lbbutton));
	var lbvid = document.createElement("div");
	lbvid.setAttribute(ctype,"clb c16v3");
	lbvid.setAttribute("id","c16v3-lightbox" + i)
	jQuery(lbvidhold).append(lbvid);
   
   heightadjust = parseInt(carouselOptions[i][12]) + 20;
   
	curvid = "c16v3-lightbox" + i;
	document.getElementById(curvid).c16v3_config =
	{
	"movie":"/assets/swa/flash/mediaplayer/jw3.swf",
	"version":"9.0.115.0",
	"width":carouselOptions[i][11],
	"height":heightadjust,
	"autostart":"true",
	"file":carouselOptions[i][13],
	"image":carouselOptions[i][14],
	"pagename":metricstitle, // use video title
	"captions":carouselOptions[i][17],
	"videoname":metricstitle,
	"countrysite":"US"  // used to be countrycode
	};
}
/*	 #######################  END CREATE LIGHTBOX VIDEO  #######################	*/





























/*	 #######################  BEGIN CREATE EMBEDDED VIDEO	 #######################  */
	if(carouselOptions[i][0] == "Embedded")
	{
		player = null;
		tttext[i] = carouselOptions[i][13];
		var frameemwrap = document.createElement("div");
		frameemwrap.setAttribute(ctype,"lbtrig");
		jQuery(framecontright).append(frameemwrap);
		var flashvidwrap = document.createElement("div");
		flashvidwrap.setAttribute("id", "flashvideo" + i);
		jQuery(frameemwrap).append(flashvidwrap);
		var flashvidwrap2 = document.createElement("div");
		flashvidwrap2.setAttribute(ctype,"flash-alt");
		jQuery(flashvidwrap).append(flashvidwrap2);
		var emvidhead = document.createElement("h3");
		emvidhead.setAttribute(ctype, "nd");
		jQuery(flashvidwrap2).append(jQuery(emvidhead).append(carouselOptions[i][1]));
		var viddesc = document.createElement("p");
		viddesc.setAttribute(ctype, "nd")
		var jsvidname = "videoplayer" + i;
		jQuery(flashvidwrap2).append(jQuery(viddesc).append(carouselOptions[i][2]));
		var captions = "captions.file";

		// swfobject 2.2 embedding code
		var flashvars = {
			file: carouselOptions[i][11],
			image: carouselOptions[i][9],
			'metrics.name': carouselOptions[i][14]
		};
		var params = {
			wmode: "transparent",
			allowscriptaccess: "always",
			allowfullscreen: "true"
		};
		var attributes = {
			id: "videoplayer" + i,
			name: "videoplayer" + i
		};

		if(carouselOptions[i][12] != "")
		{
			if(rtlenable == "true")
			{
				flashvars.captions = carouselOptions[i][12];
				flashvars.config = '/assets/swa/flash/mediaplayer/config/config-cp-div.xml';
			}
			else
			{
				flashvars.captions = carouselOptions[i][12];
				flashvars.config = '/assets/swa/flash/mediaplayer/config/config-cp.xml';
			}
		}
		else
		{
			flashvars.config = '/assets/swa/flash/mediaplayer/config/basic.xml';
		}

		swfobject.embedSWF('/assets/swa/flash/mediaplayer/jw4.swf', 'flashvideo' + i, '240', '200', '9.0.115', '', flashvars, params, attributes);

	}
/*	 #######################  END CREATE EMBEDDED VIDEO  #######################	*/


/*	 #######################  BEGIN CREATE LINKED IMAGE  ####################### */

	if(carouselOptions[i][0]=="LinkedImage")
	{
   	tttext[i]=carouselOptions[i][11];
		var frameliwrap = document.createElement("div");
		frameliwrap.setAttribute(ctype,"lbtrig");
		jQuery(framecontright).append(frameliwrap);
		var imgLink = document.createElement("a");
		imgLink.setAttribute("href",carouselOptions[i][4]);
		imgLink.setAttribute("id",'imgpop' + i);
		var imgLinkSrc = document.createElement("img");
		imgLinkSrc.setAttribute("src",carouselOptions[i][9]);
		jQuery(frameliwrap).append(jQuery(imgLink).append(imgLinkSrc));
	}

/*	 #######################  END CREATE LINKED IMAGE	#######################	 */


	/* =========== pop up window? =========== */

	 if(carouselOptions[i][6]=="true")
	 {
		$('#poplink' + i).click(function(){
		winnum = this.id;
		winnum = winnum.charAt(7);
		$winops = 'menubar=1,resizable=1,width=' + carouselOptions[winnum][7] + ',height=' + carouselOptions[winnum][8];
		window.open(carouselOptions[winnum][4],'popwin',$winops);
		return false;
		});
	 }

	 if(carouselOptions[i][6]=="true")
	 {
		$('#imgpop' + i).click(function(){
		winnum = this.id;
		winnum = winnum.charAt(6);
		$winops = 'menubar=1,resizable=1,width=' + carouselOptions[winnum][7] + ',height=' + carouselOptions[winnum][8];
		window.open(carouselOptions[winnum][4],'popwin',$winops);
		return false;
		});
	 }


} /* END FRAME FOR LOOP */


/* #######################	  CREATE THUMBNAIL NAV ####################### */

	 var thumbnails=new Array();
	 var thecls="";
		for (i=0;i<=framenums-1;i++)
		{
		if(i==0) {thecls=" class='first'";}
		if(i==framenums-1) {thecls=" class='last'";}
		if(i!=0 && i!=framenums-1) {thecls="";}
		thumbnails[i]='<img src="' + carouselOptions[i][10] + '"' + thecls + ' title="' + tttext[i] + '">';
		}

 jQuery('#dcar').pager('.frame',
	 {
		 navId: 'thumbs',
		 prevText: '',
		 nextText: '',
		 navAttach: 'append',
		 linkText: thumbnails,
		 linkWrap: '<div></div>'
	 })


if(tttext[0] != "")
{
if (cw=="narrow") {
  jQuery('#dcarhold #thumbs img').cluetip({
	splitTitle: '|',
	showTitle: false,
	cursor: 'pointer',
	width: '120px',
	cluetipClass: 'dcartip',
	dropShadow: false,
	hoverIntent: false,
	positionBy: 'fixed',
	topOffset: '-25px',
	leftOffset: '-79px'
  });
}
else {
  jQuery('#dcarhold #thumbs img').cluetip({
	splitTitle: '|',
	showTitle: false,
	cursor: 'pointer',
	width: '120px',
	cluetipClass: 'dcartip',
	dropShadow: false,
	hoverIntent: false,
	positionBy: 'fixed',
	topOffset: '11px',
	leftOffset: '-165px'
  });
}
}

cdc.util.addCorners('.c39-pilot');
 });


 /* UPDATE CAPTIONS ON FRAME CHANGE */
    jQuery('#thumbs a').click(function()
     {
    	updatecc("");
    	hidecc();
    	});
     }


function displaycc(){
	jQuery("#cc-caption").show();
	jQuery("#cc-caption-back").show();
}

function hidecc(){
	jQuery("#cc-caption").hide();
	jQuery("#cc-caption-back").hide();
}

function updatecc(cctext){
	document.getElementById('cc-caption').innerHTML = cctext;
}




