// <!--
var isIE;
if (navigator.appName == "Microsoft Internet Explorer") {
			if (parseInt(navigator.appVersion) >= 4) {
				isIE = true;
				//document.write("<link type=\"text/css\" rel=\"stylesheet\" href=\"groups/corp_comm/documents/web_asset/nasdw_000462.css\">");
			}
} else {
			isIE = false;
				//document.write("<link type=\"text/css\" rel=\"stylesheet\" href=\"groups/corp_comm/documents/web_asset/nasdw_001337.css\">");
}

function onloadtasks(print) { // CALLS ALL THE NECESSARY FUNCTIONS THAT EXECUTE UPON LOADING THE PAGE
	
	if (print != 1) 
	{
	    SetContentHeight();
		TopNavFunctions();
//		fnInit();
	}
}
			
//SETS THE REQUIRED BOTTOM PADDING BASED ON THE SCREEN RESOLUTION. THIS IS REQUIRED TO ELIMINATE GREEN SPACE BELOW THE CONTENT AREA.
function SetContentHeight(){
	// browser sniffer
	var NN, IE, dynNN, dynIE
	var agent = navigator.appName + navigator.appVersion;

	NN = ( (agent.indexOf("Netscape") > -1 ) ? 1 : 0);
	IE = ( (agent.indexOf("Explorer" )> -1 || agent.indexOf("MSIE") > -1 ) ? 1 : 0);

	if (parseInt(navigator.appVersion) >= 4){
		if (navigator.appName == "Netscape"){
			dynNN = true;
			}
		else{
			dynIE = true;
			}
		}

	var ScreenHeight;
	var NavHeight;
	var ContentTopHeight;

	// If browsing with IE, set the height of the nav area to the available height in the browser window.
  if (dynIE){
//		ScreenHeight = document.body.clientHeight;
        ScreenHeight =(document.compatMode=="CSS1Compat")?document.documentElement.clientHeight : document.body.clientHeight;

		NavHeight = parseInt(TopNav1.height) + parseInt(TopNav2.height) + parseInt(TopNav3.height) + parseInt(TopNav4.height);
		ContentTopHeight = parseInt(ContentTop.height);
		LeftNav.height = ScreenHeight - (NavHeight + ContentTopHeight + 2);
		}
}

//CALLS ALL THE NECESSARY TOP NAVIGATION FUNCTIONALITY
function TopNavFunctions(){
	SetActiveArea();
}


function outsideLink(theurl)
{ window.open("http://apps." + DomainCoName + "/exitpage/default.aspx?url="+theurl);}
function outsidelink(theurl)
{ window.open("http://apps." + DomainCoName + "/exitpage/default.aspx?url="+theurl);}
function newWindow(theurl)
{ window.open(theurl);}

function nativelink(contentId){ 
	var newUrl = "";
	if (isIE){
		var oBase = document.all.tags('BASE');
		strHref = oBase[0].href;
		newUrl += strHref;
	}
	newUrl += "idcplg?IdcService=GET_FILE";
	newUrl += "&dDocName=" + contentId;
	newUrl += "&RevisionSelectionMethod=LatestReleased";
	newUrl += "&Rendition=primary";
	//newUrl += "&noSaveAs=1";
	newUrl += "&allowInterrupt=1";
	
	// Navigate to the new url
	window.location = newUrl;
}

function pdflink(contentId){ 
	var newUrl = "";
	newUrl += g_httpCgiUrl;
	newUrl += "ssDocName=" + contentId;
	// Navigate to the new url	
	window.open(newUrl);
}

function email(mailID, displayName){ 
	var newUrl = "";
	newUrl += "http://apps." + DomainCoName + "/EmailMask/EmailMask.aspx?";
	newUrl += "&id=" + mailID;
	newUrl += "&displayName=" + displayName;
	window.open(newUrl,'mail','menubar=0,location=0,titlebar=0,status=0,toolbar=0,resizable=1,width=600,height=500');
}


function searchWithin(frm,adv){
	if(frm.UserText.value != "" && frm.UserText.value != null)
	{
		if(adv)
		{
			var sortString = frm.SelectSort.options[frm.SelectSort.selectedIndex].value;
			//Clean up form fields
			frm.SortSpec.value = sortString;			
			frm.SelectedGroups.value = "";

			//parse checked security groups into search params
			var securityGroupQueryText = "";
			var b = 0;
			var secGrps = new Array();
			for(i=0; i<frm.Coll.length; i++){
				if (frm.Coll[i].checked){
					secGrps[b] = frm.Coll[i].value;
					b++;							
				}
			}
			if (secGrps.length > 0 ){
				for (i=0; i<secGrps.length; i++){
					securityGroupQueryText += "dSecurityGroup<matches>`" + secGrps[i] + "`";
					frm.SelectedGroups.value += secGrps[i] + ",";
					if (i<secGrps.length-1){
						securityGroupQueryText += "<or>";	
					}
				}
			}
			if (securityGroupQueryText.length > 0){
				if (frm.QueryText.value.length > 0){
					frm.QueryText.value = "(" + frm.QueryText.value + ")"	+ "<and>" + securityGroupQueryText;
				} else {
					frm.QueryText.value = securityGroupQueryText;
				}	

			}
		}
		frm.submit();
	}
	else
	{
		alert("Please enter search term.");
	}
}

function cellSwitch(cellName, newColor, textColor) {
//	if (isIE) {
		cellName.bgColor = newColor;
//	}
	if (textColor != null) {
		cellName.style.color = textColor;
	}
}

function rowSwitch(thisCell, newColor, textColor) {
	i = 0;
	thisCell.bgColor = newColor;
	if (textColor != null) {
		thisCell.style.color = textColor;
	}
	rowsize = thisCell.parentNode.cells.length;
	while (i < rowsize) {
		thisCell.parentNode.cells[i].bgColor = newColor;
		if (textColor != null) {
			thisCell.parentNode.cells[i].color = textColor;
		}
		i ++;
	} 
}

function overIt(thisCell, newColor, textColor, linkText) {
	cellSwitch(cellName, newColor, textColor);
	window.status = linkText;
}

// PRELOAD ROLLOVER IMAGES
var preimages = new Array();
function preloading(){
	for (x=0; x>preloading.arguments.length; x++){
		preimages[x] = new Image();
		preimages[x].src = preloading.arguments[x];
	}
}

preloading("home_on.gif","rules_on.gif","enforcement_on.gif","education_on.gif","regulatory_on.gif","arbitration_on.gif","investor_on.gif","home_hover.gif","rules_hover.gif","enforcement_hover.gif","education_hover.gif","regulatory_hover.gif","arbitration_hover.gif","investor_hover.gif");


// Create array to tie together nodes and image names
var topNavImageArray = new Array();
topNavImageArray[0] = new Array(5,"home","_off","_hover");
topNavImageArray[1] = new Array(6,"rules","_off","_hover");
topNavImageArray[2] = new Array(9,"enforcement","_off","_hover");
topNavImageArray[3] = new Array(10,"education","_off","_hover");
topNavImageArray[4] = new Array(11,"regulatory","_off","_hover");
topNavImageArray[5] = new Array(12,"arbitration","_off","_hover");
topNavImageArray[6] = new Array(13,"investor","_off","_hover");


//DETERMINES THE CONTENT AREA FROM THE g_NavNode_Path VARIABLE AND SETS THE CORRESPONDING MARKER IN THE TOP NAVIGATION
function SetActiveArea(){
	imgName = topNavImageArray[0][1];
	imgSuffix = "_on";
	if (g_navNode_Path.length > 1){ // if we are below the home page
		sectionFound = false;
		for (var i=1;i<topNavImageArray.length;i++){
			if (topNavImageArray[i][0] == g_navNode_Path[1]) {
				imgName=topNavImageArray[i][1];
				topNavImageArray[i][2] = "_on"; // we are in a top section
				topNavImageArray[i][3] = "_on"; 
				sectionFound=true;
				break;
			}
		}
		(sectionFound)?0:topNavImageArray[0][2] = "_on"; // we are in a sub section of the home page
		(sectionFound)?0:topNavImageArray[0][3] = "_on"; 
	} else { // if we are on the home page
		topNavImageArray[0][2] = "_on";
		topNavImageArray[0][3] = "_on";
	}
	SetImgSuffix(imgName,imgSuffix);
}

function m_over(imgName){
	for (var i=0;i<topNavImageArray.length;i++){
		(topNavImageArray[i][1].toString()==imgName?imgSuffix = topNavImageArray[i][3]:0);
	}
	SetImgSuffix(imgName,imgSuffix);
}

function m_out(imgName){
	for (var i=0;i<topNavImageArray.length;i++){
		(topNavImageArray[i][1].toString()==imgName?imgSuffix = topNavImageArray[i][2]:0);
  }
	SetImgSuffix(imgName,imgSuffix);
}

function SetImgSuffix(imgName,imgSuffix){
	imgHandle = eval("document." + imgName);
	if (imgHandle != null){
			imgHandle.src = imgHandle.src.replace(imgHandle.src.slice(imgHandle.src.lastIndexOf("_"),imgHandle.src.lastIndexOf(".")),imgSuffix);
	}
}


// -->
