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\">");
}

//***************************************************************************************************************
//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;

	// 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(document.getElementById("mainHeader").height);
//		leftNav.height = ScreenHeight - (NavHeight + 2);
		document.getElementById("leftNav").height = ScreenHeight - (NavHeight + 2);
//		}
}

//////////////////////////////////////////////////////////////////////

function getURL(){

	return(location.href)

}

////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////
// Function : linkToPrimary
// Comments : this function is the same as the Site Studio function "link" except 
// 						that it takes a dDocName param as well.  This forces Site Studio to return
//						the primary page. 
/////////////////////////////////////////////////////////////////////////////
function linkToPrimary(dDocName,nodeId)
{
	var newUrl = "";
	newUrl += g_httpCgiUrl;
	newUrl += "ssDocName=" + dDocName;
	newUrl += "&nodeId=" + nodeId;

	var currentUrl = "" + window.location;

	// Continue propagation of the "SSContributor" parameter
	if( SSContributor )
	{
		var paramName = "SSContributor=";
		var pos = currentUrl.indexOf( paramName );
		if( pos != -1 )
		{
			var subStr = currentUrl.substring( pos+paramName.length, pos+paramName.length+1 );
			if( isTrue( subStr ) )
			{
				newUrl += "&" + paramName + "true";
			}
		}
	}

	// Continue propagation of the "previewId" parameter
	var previewId = "previewId=";
	var posStart = currentUrl.indexOf( previewId );
	if( posStart != -1 )
	{
		var posEnd = currentUrl.indexOf("&", posStart);
		var value = "";
		if (posEnd == -1)
		{
			value = currentUrl.substring(posStart+previewId.length, currentUrl.length);
		}
		else
		{
			value = currentUrl.substring(posStart+previewId.length, posEnd);
		}
		newUrl += "&" + previewId + value;
	}

	// We now always add the node that the link is on as part of the URl also.
	if( g_ssSourceNodeId != _U && g_ssSourceNodeId != null )
		newUrl += "&ssSourceNodeId=" + g_ssSourceNodeId;

	// Navigate to the new url
	window.location = newUrl;
}


function outsideLink(theurl)
{ window.open("http://apps.finra.org/exitpage/saiexitpage.aspx?url="+theurl);}
function outsidelink(theurl)
{ window.open("http://apps.finra.org/exitpage/saiexitpage.aspx?url="+theurl);}

function nativelink(contentId){ 
	var newUrl = "";
	
	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 += "http://www.saveandinvest.org/web/idcplg?IdcService=SS_GET_PAGE&";
	newUrl += "ssDocName=" + contentId;
	// Navigate to the new url	
	window.open(newUrl);
}

function email(mailID, displayName){ 
	var newUrl = "";
	newUrl += "http://apps.finra.org/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');
//location.href="mailto:webmaster@finra.org";
}

function nodelink(node)
{
    window.open("http://www.finra.org/web/idcplg?IdcService=SS_GET_PAGE&nodeId=" + node);
}

function link(docname)
{
    window.open("http://www.finra.org/web/idcplg?IdcService=SS_GET_PAGE&ssDocName=" + docname);
}

function fnTrapKD(btn, event)
{
    //alert("this will never be seen");
    if (document.all)
    {
    	if (event.keyCode == 13)
    	{
    		event.returnValue=false;
            event.cancel = true;
            btn.click();
        }
    }
    else if (document.getElementById)
    {
        if (event.which == 13)
        {
            event.returnValue=false;
            event.cancel = true;
            btn.click();
        }
    }
    else if(document.layers)
    {
        if(event.which == 13)
        {
            event.returnValue=false;
            event.cancel = true;
    	    btn.click();
    	}
    }
}

function newWindow(theurl)
{ window.open(theurl);}

function framedLink(target, wrapper)
{ var n
n = window.open('','myWindow','menubar=0,location=0,titlebar=0,status=0,toolbar=0,resizable=1,width=600,height=600'); n.document.write('<frameset rows=80,*>'); n.document.write('<frame src="'+wrapper+'" name="f1" frameborder="0">'); n.document.write('<frame src="'+target+'" name="f2" frameborder="0">'); n.document.write('</frameset>'); n.document.write('<noframes><a href="'+target+'">View Link</a></noframes>'); n.document.close();}
function windowLink(url, windowname, w, h)
{ window.open(url,windowname,'location=no,menubar=no,resizable=no,status=no,toolbar=no,width='+w+',height='+h+',scrollbars=no');}
function exitLink(theurl)
{ window.open("http://apps.finra.org/exitpage/default.aspx?url="+theurl);}

//Text Size 
//Specify affected tags.
//var ugs = new Array( 'div','td','tr', 'p');
//var ugs = new Array( 'div','ul','tr', 'p', 'a', 'font');
//var ugs = new Array( 'h1', 'H2', 'font', 'li', 'a');
var ugs = new Array('li', 'ul', 'a', 'p', 'td');
//var ugs = new Array('BODY', 'P', 'TABLE', 'TR', 'TD');

//Specify range of different font sizes:
var szs = new Array('10px','12px','14px','16px');
var startSz = 1;



function ts( trgt,inc ) {
	if (!document.getElementById) return
	var d = document,cEl = null,sz = startSz,i,j,cTags;
	
	sz += inc;
	if ( sz < 0 ) sz = 0;
	if ( sz > 3 ) sz = 3;
	startSz = sz;
		
	if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

	cEl.style.fontSize = szs[ sz ];

	for ( i = 0 ; i < ugs.length ; i++ ) {
		cTags = cEl.getElementsByTagName( ugs[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
	}
}