//<![CDATA[
<!--
/*
pop up a confirmation box to make sure a user wants to submit a form	
*/       
function confirmPrompt(link, text) {
    var del = confirm(text);
    if (del == true) {
      link.onclick();
    }
}

function browserIsIe() {
      return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent);
}


/*
THIS FUNCTION SIDESTEPS IE 7 FLASH ISSUE

function createControl(parentDivID, WIDTH, HEIGHT, WMODE, BGCOLOR, URL){

	var object = document.createElement('object');
	object.setAttribute('classid', "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000");
	object.setAttribute('codebase', "https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0");
	object.setAttribute('width', WIDTH);
	object.setAttribute('height', HEIGHT);
	object.setAttribute('wmode', WMODE);
	
	var param1 = document.createElement('param');
	param1.setAttribute('name', "bgcolor");
	param1.setAttribute('value', "#" + BGCOLOR);
	
	var param2 = document.createElement('param');
	param2.setAttribute('name', "allowScriptAccess");
	param2.setAttribute('value', "sameDomain");
	
	var param3 = document.createElement('param');
	param3.setAttribute('name', "movie");
	param3.setAttribute('value', URL);
	
	var param4 = document.createElement('param');
	param4.setAttribute('name', "quality");
	param4.setAttribute('value', "high");
	
	var param5 = document.createElement('param');
	param5.setAttribute('name', "salign");
	param5.setAttribute('value', "lt");

	var embed = document.createElement('embed');
	embed.setAttribute('src', URL);
	embed.setAttribute('quality', "high");
	embed.setAttribute('pluginspage', "https://www.macromedia.com/go/getflashplayer");
	embed.setAttribute('type', "application/x-shockwave-flash");
	embed.setAttribute('bgcolor', "#" + BGCOLOR);
	embed.setAttribute('width', WIDTH);
	embed.setAttribute('height', HEIGHT);
	embed.setAttribute('wmode', WMODE);
	
	object.appendChild(param1);
	object.appendChild(param2);
	object.appendChild(param3);
	object.appendChild(param4);
	object.appendChild(param5);
	object.appendChild(embed);
	
	var parent = document.getElementById(parentDivID);
	parent.appendChild(object);
	
}
*/

function createIeControl(DivID, WIDTH, HEIGHT, WMODE, BGCOLOR, URL)
{
  var g = document.getElementById(DivID);
  g.innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + WIDTH + '" height="' + HEIGHT + '" wmode="' + WMODE + '"><param name="bgcolor" value="#' + BGCOLOR + '" /><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="' + URL + '"><param name="quality" value="high"><param name="salign" value="lt" /><embed src="' + URL + '" quality="high" pluginspage="https://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" bgcolor="#' + BGCOLOR + '" width="' + WIDTH + '" height="' + HEIGHT + '" wmode="' + WMODE + '"></embed></object>';
}


function createImage(parentDivID, src, width, height, alt, border){

	var img = document.createElement('img');
	img.setAttribute('src', src);
	img.setAttribute('alt', alt);
	img.setAttribute('border', border);
	img.setAttribute('width', width);
	img.setAttribute('height', height);

	var parent = document.getElementById(parentDivID);
	parent.appendChild(img);
}

/*
THIS IS GENERIC FUNCTION CALLS THE FLASH IF IT DETECTS CORRECT 
VERSION, OTHERWISE DOES ELSE AREA
*/
function flashImplement(DivID, WIDTH, HEIGHT, WMODE, BGCOLOR, URL) {
	var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	if(hasRightVersion) {
		//if (browserIsIe()){
			createIeControl( DivID, WIDTH, HEIGHT, WMODE, BGCOLOR, URL );
		//}
		//else {
		//	createControl( DivID, WIDTH, HEIGHT, WMODE, BGCOLOR, URL );
		//}
	} else {
		//STUFF GOES HERE
	}
}

/*
THIS FUNCTION CALLS THE FLASH TICKER IF IT DETECTS CORRECT 
VERSION, OTHERWISE SERVES UP STATIC IMAGE
*/
function tickerImplement(DivID, WIDTH, HEIGHT, WMODE, BGCOLOR, URL) {
	var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	if(hasRightVersion) {
		//if (browserIsIe()){ //(browserIsIe()){
			createIeControl( DivID, WIDTH, HEIGHT, WMODE, BGCOLOR, URL );
		//}
		//else {
		//	createControl( DivID, WIDTH, HEIGHT, WMODE, BGCOLOR, URL );
		//}
	} else {
  		createImage(DivID, "/images/static-ticker.jpg", 762, 29, "", 0);
	} 
}

/*
THIS FUNCTION CALLS THE FLASH HEADLINE AREA IF IT DETECTS CORRECT 
VERSION, OTHERWISE SERVES UP STATIC IMAGE
*/
function headlineImplement(DivID, WIDTH, HEIGHT, WMODE, BGCOLOR, URL) {
	var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	if(hasRightVersion) {
		//if (browserIsIe()){
			createIeControl( DivID, WIDTH, HEIGHT, WMODE, BGCOLOR, URL );
		//}
		//else {
		//	createControl( DivID, WIDTH, HEIGHT, WMODE, BGCOLOR, URL );
		//}
	} else {
  		createImage(DivID, "/images/static-headlines.jpg", 563, 101, "", 0);
	} 
}

/*
THIS FUNCTION CALLS THE FLASH NAV IF IT DETECTS CORRECT 
VERSION, OTHERWISE CALLS STATIC NAV
*/
function navImplement() {
	var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	if(hasRightVersion) {
		document.getElementById('navigation').style.display='block';	
	} else {
		document.getElementById('htmlNavigation').style.display='block';
 	}
}

function flashNavWrite(parentDivID, URL) {
	
	//if (browserIsIe()){
		ieFlashNavWrite(parentDivID, URL);
	//}
	//else {
	//	ffFlashNavWrite(parentDivID, URL);
	//}
	
}
/*
function ffFlashNavWrite(parentDivID, URL){

	var object = document.createElement('object');
	object.setAttribute('classid', "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000");
	object.setAttribute('codebase', "https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0");
	object.setAttribute('width', "100%");
	object.setAttribute('height', "100%");
	object.setAttribute('wmode', "transparent");
	
	var param1 = document.createElement('param');
	param1.setAttribute('name', "bgcolor");
	param1.setAttribute('value', "#DDDDDD");
	
	var param2 = document.createElement('param');
	param2.setAttribute('name', "allowScriptAccess");
	param2.setAttribute('value', "sameDomain");
	
	var param3 = document.createElement('param');
	param3.setAttribute('name', "movie");
	param3.setAttribute('value', URL);
	
	var param4 = document.createElement('param');
	param4.setAttribute('name', "quality");
	param4.setAttribute('value', "high");
	
	var param5 = document.createElement('param');
	param5.setAttribute('name', "salign");
	param5.setAttribute('value', "lt");

	var embed = document.createElement('embed');
	embed.setAttribute('src', URL);
	embed.setAttribute('quality', "high");
	embed.setAttribute('pluginspage', "https://www.macromedia.com/go/getflashplayer");
	embed.setAttribute('type', "application/x-shockwave-flash");
	embed.setAttribute('bgcolor', "#DDDDDD");
	embed.setAttribute('width', "100%");
	embed.setAttribute('height',"100%");
	embed.setAttribute('wmode', "transparent");
	
	object.appendChild(param1);
	object.appendChild(param2);
	object.appendChild(param3);
	object.appendChild(param4);
	object.appendChild(param5);
	object.appendChild(embed);
	
	var parent = document.getElementById(parentDivID);
	parent.appendChild(object);
}
*/
function ieFlashNavWrite(parentDivID, URL){

	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ');
	document.write('codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ');
	document.write('width="100%" height="100%" wmode="transparent">');
	document.write('<param name="bgcolor" value="#DDDDDD" />');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="movie" value="' + URL + '">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="salign" value="lt" />');
	document.write('<embed src="' + URL + '" quality="high" pluginspage="https://www.macromedia.com/go/getflashplayer" ');
	document.write('type="application/x-shockwave-flash" bgcolor="#DDDDDD" width="100%" height="100%" wmode="transparent">');
	document.write('</embed></object>');
}
/*
THIS FUNCTION IS USED FOR RESIZING FLASH NAV WHEN EXPANDED/CONTRACTED
*/
function newHeight(nh) {
	if(document.all && !document.getElementById) {
		document.all['navigation'].style.height = nh + 3 + 'px';
	}else{
		document.getElementById('navigation').style.height = nh + 3 + 'px';
	}
}


/*
THIS FUNCTION IS USED FOR SWAPPING DIVS IN THE MARKET OVERVIEW SECTION	
*/
function swapDiv(whichOne) {
	for (var i=0; ; i++) {
    var layerNelem = document.getElementById('tab-content' + i);
       	if (layerNelem == null) {
			break;
		} else {
           		layerNelem.style.display='none';
				document.getElementById('left-tab' + i).src='/images/tab-left.gif';
				document.getElementById('tab' + i).style.backgroundImage='url(/images/tab-bg.gif)';
				document.getElementById('right-tab' + i).src='/images/tab-right.gif';
        }
    }
	document.getElementById('tab-content' + whichOne).style.display='block';
	document.getElementById('left-tab' + whichOne).src='/images/tab-left-active.gif';
	document.getElementById('tab' + whichOne).style.backgroundImage='url(/images/tab-bg-active.gif)';
	document.getElementById('right-tab' + whichOne).src='/images/tab-right-active.gif';
	
	
}

function selectFromDropdown(selectDivID){
	
	var index;
	var hasToolbar = 1;
	var hasScrollbars = 1;
	var hasLocation = 1;
	var hasStatusBar = 1;
	var hasMenuBar = 1;
	var isResizable = 1;
	var width = 800;
	var height = 600;
	var left = 0;
	var top = 0;
	
	if (document.all && !document.getElementById) {
	
		index = document.all[selectDivID].selectedIndex;
		
		if (index == 0){
			return;
		}
		/*
		else if (index == 1){
			openLoadingWindow(document.all[selectDivID].options[index].value);
		}
		*/
		else {
			popUp(document.all[selectDivID].options[index].value, hasToolbar, hasScrollbars, hasLocation, hasStatusBar, hasMenuBar, isResizable, width, height, left, top);
		}
		
		document.all[selectDivID].selectedIndex = 0;
	}
	else{
	
		index = document.getElementById(selectDivID).selectedIndex;
		
		if (index == 0){
			return;
		}

		else if (index == 1){
			location.replace(document.getElementById(selectDivID).options[index].value);
		}

		else {
			popUp(document.getElementById(selectDivID).options[index].value, hasToolbar, hasScrollbars, hasLocation, hasStatusBar, hasMenuBar, isResizable, width, height, left, top);
		}
		document.getElementById(selectDivID).selectedIndex = 0;
	}
	
}

function popUp(URL, hasToolbar, hasScrollbars, hasLocation, hasStatusBar, hasMenuBar, isResizable, width, height, left, top) {

	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=" + hasToolbar + ",scrollbars=" + hasScrollbars + ",location=" + hasLocation + ",statusbar=" + hasStatusBar + ",menubar=" + hasMenuBar + ",resizable=" + isResizable + ",width=" + width + ",height=" + height + ",left = " + left + ",top = " + top + "');");
}

function formSubmit(event, asButtonId) {

	if (event.which){
    	if(event.which == 13){
     		if(document.all && !document.getElementById) {
				document.all[asButtonId].click();
			}else{
				document.getElementById(asButtonId).click();
			}
  		}
  	} 
  	else if(window.event.keyCode==13) {
    	
    	if(document.all && !document.getElementById) {
			document.all[asButtonId].click();
		}else{
			document.getElementById(asButtonId).click();
		}
  	}
}

function selectAll(formObj, isInverse) 
{
   for (var i=0;i < formObj.length;i++) 
   {
      fldObj = formObj.elements[i];
      if (fldObj.type == 'checkbox')
      { 
         if(isInverse)
            fldObj.checked = (fldObj.checked) ? false : true;
         else fldObj.checked = true; 
       }
   }
}


function openLoadingWindow(url) {
      
      var launchFile = url;
      
      if (((navigator.userAgent.toLowerCase().indexOf("msie") != -1) &&
                       (navigator.userAgent.toLowerCase().indexOf("opera") == -1)))
      {
         window.open(launchFile, "", "top=5000,width=1,height=1");
      }
      else
      {
         window.open(launchFile, "");
      }
}
// -->
//]]>

