//some common utility functions and variables used by various pages
var dartPtileRan = parseInt(Math.random() * 1000000000);
var is_searchType = 'nasdaq';
var searchOptionsDisplayed = false;
var currSearchSel = "nasdaqImg";
if(typeof myPage != 'undefined')
{
	document.domain = 'nasdaq.com';
}
function openWin(winName,winURL,winWidth,winHeight)
{
		 newWindow = window.open(winURL,winName,'toolbar=no,menubar=no,width='+winWidth+',height='+winHeight+',scrollbars=no,resizable=no');
}
//search functions
function is_checkSearchType(searchType) 
{
	if (searchType == 0)
	{
		is_searchType = 'nasdaq';
	} 
	else if(searchType == 1)
	{
		is_searchType = 'web';
	}
	else if(searchType == 2)
	{
		is_searchType = 'local';
	}
	return is_searchType;
}
function Cis_clearTB() 
{
	document.getElementById("input-search-text").value ='';
}
function Cis_submitSearch() 
{
	searchTerm = document.getElementById("input-search-text").value;
	if(searchTerm!="" && searchTerm!= "Site Search") 
	{
		if (is_searchType == 'nasdaq' && searchTerm!="Site Search") 
		{
			top.document.cookie='search=1';
			document.location.href = "http://search.nasdaq.com/search?q=\""+searchTerm+"\"&site=dotcom_collection&client=default_frontend&proxystylesheet=default_frontend&output=xml_no_dtd&proxyreload=1";
		} 
		else if(is_searchType == 'web') 
		{
			document.location.href = "http://nasdaq.infospace.com/nasdaq/ws/results/Web/"+searchTerm+"/1/0/0/Relevance/iq=true/zoom=off/_iceUrlFlag=7?_IceUrl=true";
		}
		else
			document.location.href = "http://nasdaq.yellowbook.com/yellow-pages/?what="+searchTerm;
		return false;
	}
	return true;
}
	
function handleSearchDropClick()
{
	if(!searchOptionsDisplayed)
	{
		document.getElementById("dropdown-look").style.display = "block";
		searchOptionsDisplayed = true;
	}
	else
	{
		document.getElementById("dropdown-look").style.display = "none";
		searchOptionsDisplayed = false;
	}
}
function handleSearchKeyPress(event)
{
	if(event.keyCode == 13)
	{
		Cis_submitSearch();
		return false;
	}
	return true;
}
function selectSearchType(type, imgID)
{
	is_checkSearchType(type);
	if(imgID!=currSearchSel)
	{
		document.getElementById(currSearchSel).src = "http://www.nasdaq.com/images/blank-box.jpg";
		document.getElementById(imgID).src = "http://www.nasdaq.com/images/check-box.jpg";
		currSearchSel = imgID;
	}
		
	Cis_submitSearch();
}
function setST(selEle, unSelEle1, unSelEle2)
{
	document.getElementById(selEle).className = "see-highlight";
	document.getElementById(unSelEle1).className = "see-option";
	document.getElementById(unSelEle2).className = "see-option";
}
function handleFooterSearchKeyPress(event)
{
	if(event.keyCode == 13)
	{
		footersubmitSearch();
		return false;
	}
	return true;
}
function footersubmitSearch() 
{
	searchTerm = document.getElementById("footer_search_keywords").value;
	if(searchTerm!="" && searchTerm!="enter keywords") 
	{
		is_searchType = document.getElementById("nasdaq_footer_search").options[document.getElementById("nasdaq_footer_search").selectedIndex].value;
		if (is_searchType == 'nasdaq') 
		{
			top.document.cookie='search=1';
			document.location.href = "http://search.nasdaq.com/search?q=\""+searchTerm+"\"&site=dotcom_collection&client=default_frontend&proxystylesheet=default_frontend&output=xml_no_dtd&proxyreload=1";
		} 
		else if(is_searchType == 'web') 
		{
			document.location.href = "http://nasdaq.infospace.com/nasdaq/ws/results/Web/"+searchTerm+"/1/0/0/Relevance/iq=true/zoom=off/_iceUrlFlag=7?_IceUrl=true";
		}
		else
		{
			document.location.href = "http://nasdaq.yellowbook.com/yellow-pages/?what="+searchTerm;
		}
		return false;
	}
	return true;
}
//dynamic market status quote links
function setQuickFindQuoteLink()
{
	//n_market_status could be either P O A C
	if(typeof n_market_status != 'undefined')
	{
		switch(n_market_status)
		{
			case "P":   //only show premarket link
						document.write("");
						document.write("");
						break;
			case "O":   //only show real-time link
						document.write("");
						document.write("");
						break;
			case "A":   //only show after hours link
						document.write("");
						document.write("");
						break;
			case "C":   //only show after hours link
						document.write("");
						document.write("");
						break;
		}		
	}
	else
	{   //only show real-time link
		document.write("");
		document.write("");
	}						
		
}
function setMenuQuoteLink()
{
	//n_market_status could be either P O A C
	if(typeof n_market_status != 'undefined')
	{
		switch(n_market_status)
		{
			case "P":   //only show premarket link
						document.write("");
						document.write("");
						break;
			case "O":   //only show real-time link
						document.write("");
						document.write("");
						break;
			case "A":   //only show after hours link
						document.write("");
						document.write("");
						break;
			case "C":   //only show after hours link
						document.write("");
						document.write("");
						break;
		}		
	}
	else
	{   //only show real-time link
		document.write("");
		document.write("");
	}
}
//user community profile functions
function showLoginStatus()
{
	var passurl = document.location.href;
	urlFilt = /[;)(]|%27|%22|%3C|%3E|%uFF1C|%uFF1E|%u003C|%u003E|%u0028|%u0029|%u0027|%u0022|%u003B/g;
	if(!urlFilt.test(passurl))
	{
		var ltsp = new Date();
		document.write("