google_ad_client = "pub-0214842990443005";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_channel ="4541773990";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_url = "008000";
google_color_text = "000000";
function getResearch(){
	research.value='Searching';
	document.getElementById("divResearch").style.visibility="visible";
	research.disabled = true;
	viewDetailQuote();
	loadContent("News");
	loadContent("Candlestick");
	loadContent("StockScouter");
	loadContent("CAPS");
	loadContent("Analyst");
	loadContent("Holdings");
	//loadContent("Growth");
	//loadContent("Profitability");
	//loadContent("FinHealth");
	loadContent("Insiders");
	loadContent("InsidersChange");
	loadContent("ShortInterest");
	loadContent("ShortInterestChange");
	loadContent("Stockscore");
	loadContent("SignalStockscore");
	loadContent("Events");
	loadContent("Messages");
	loadContent("GuruPicks");
	loadContent("Blogs");
	research.value='Research';
	research.disabled = false;
}
function getCountry(){
	var country = "";
	if (document.getElementById("chkCountry").checked) country = "CA" ;
	return country;
}
function getExtra(){
	var extra="";
	if (getCountry().length > 0) extra="&country=" + getCountry();
	return extra;
}
function viewFundamentals(){
	var infoFrame = document.getElementById("ifAnalysis");
	infoFrame.height="865";
	infoFrame.src="http://apps.cnbc.com/view.asp?uid=stocks/stockvsPeers&view=keyMeasures&symbol=" + ticker.value + getExtra();
}
function viewDetailQuote(){
	var infoFrame = document.getElementById("ifAnalysis");
	infoFrame.height="440";
	infoFrame.src="http://apps.cnbc.com/view.asp?uid=stocks/DelailQuotes&symbol=" + ticker.value + getExtra();
}
function viewOverview(){
	var infoFrame = document.getElementById("ifAnalysis");
	infoFrame.height="1330";
	infoFrame.src="http://apps.cnbc.com/view.asp?uid=stocks/summary&symbol=" + ticker.value + getExtra();
}
function viewEarnings(){
	var infoFrame = document.getElementById("ifAnalysis");
	infoFrame.height="470";
	infoFrame.src="http://apps.cnbc.com/view.asp?uid=stocks/earnings&symbol=" + ticker.value + getExtra();
}
function viewFinancials(){
	var infoFrame = document.getElementById("ifAnalysis");
	infoFrame.height="1260";
	infoFrame.src="http://apps.cnbc.com/view.asp?uid=stocks/financials&symbol=" + ticker.value + getExtra();
}
function viewShareholders(){
	var infoFrame = document.getElementById("ifAnalysis");
	infoFrame.height="1140";
	infoFrame.src="http://apps.cnbc.com/view.asp?uid=stocks/ownership&symbol=" + ticker.value + getExtra();
}
function viewInsiders(){
	var infoFrame = document.getElementById("ifAnalysis");
	infoFrame.height="1204";
	infoFrame.src="http://apps.cnbc.com/view.asp?uid=stocks/insiders&symbol=" + ticker.value + getExtra();
}
function viewSEC(){
	var infoFrame = document.getElementById("ifAnalysis");
	infoFrame.height="590";
	infoFrame.src="http://apps.cnbc.com/view.asp?uid=stocks/sec&symbol=" + ticker.value + getExtra();
}

function getResearch2(){
	research.value='Searching';
	research.disabled = true;
	loadContent("PE");
	loadContent("PEH5");
	loadContent("PEL5");
	loadContent("Beta");
	loadContent("PS");
	loadContent("PB");
	loadContent("PTB");
	loadContent("PCF");
	loadContent("PFCF");
	loadContent("Inst");
	loadContent("GSQ");
	loadContent("GSM");
	loadContent("GS5");
	loadContent("GEQ");
	loadContent("GEM");
	loadContent("GE5");
	loadContent("CS5");
	loadContent("DY");
	loadContent("DY5");
	loadContent("PR");
	loadContent("GM");
	loadContent("GM5");
	loadContent("EBITD");
	loadContent("EBITD5");
	loadContent("OM");
	loadContent("OM5");
	loadContent("PTM");
	loadContent("PTM5");
	loadContent("NPM");
	loadContent("NPM5");
	loadContent("ETR");
	loadContent("ETR5");
	research.value='Research';
	research.disabled = false;
}
function loadContent(func){
	var exchange = "";
	if (document.getElementById("chkCountry").checked) exchange = "TO" ;
	var page = '/rss/getContent.php?content='+ func +'&exchange='+exchange+'&ticker=' + ticker.value;
	getContent(page,'div'+func);
}

function getContent(page,divId){
		document.getElementById(divId).innerHTML = "Loading...";
		var xmlhttp=false; //Clear our fetching variable
        try {
                xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object…
        } catch (e) {
                try {
                        xmlhttp = new
                        ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
            } catch (E) {
                xmlhttp = false;
                        }
        }
        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                xmlhttp = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
        }
		//myRand=ipaddress;
		//cache buster
		//var myurl='http://www.mydomain.com/data.php';
		//myRand=parseInt(Math.random()*99999999); 
		// end cache buster search.php?rand=' + myRand + '&page='
        var file = ''; 
    try{ 
		xmlhttp.open('GET', file + page, true);
	}
	catch (e) {
		document.getElementById(divId).innerHTML = 'N/A';
	}
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4) { //Check if it is ready to recieve data
		 if (xmlhttp.status == 200) { // OK response
                var content = xmlhttp.responseText; //The content data which has been retrieved ***
                if( content ){ //Make sure there is something in the content variable
                      document.getElementById(divId).innerHTML = content; //Change the inner content of your div to the newly retrieved content ****
                }
				else document.getElementById(divId).innerHTML ='';
        	}
		}
     }
        xmlhttp.send(null) //Nullify the XMLHttpRequest
return;
}

function getQueryVariable(variable) {  
	var query = window.location.search.substring(1);  
	var vars = query.split("&");  
	for (var i=0;i<vars.length;i++) {    
		var pair = vars[i].split("=");    
		if (pair[0] == variable) {   return pair[1];    }  
	} 
}