var webDomain = "http://www.thestreet.com";
var secureDomain = "https://secure2.thestreet.com";
var imagesDomain = "http://images.thestreet.com";
var appsDomain = "http://apps.thestreet.com";
var searchDomain = "http://find.thestreet.com";
var toolsDomain = "http://tools.thestreet.com";
var ratingsDomain = "http://ratings.thestreet.com"
var currentHost = location.host;

if (currentHost == "dfind01.thestreet.com" || currentHost == "appsdev.thestreet.com" || currentHost == "dpub01.thestreet.com" || currentHost == "stools.thestreet.com" || currentHost == "cms01.thestreet.com" || currentHost == "sratings.thestreet.com") {
	webDomain = "http://cms01.thestreet.com";
	secureDomain = "https://commercestage.thestreet.com";
	imagesDomain = "http://cms01.thestreet.com";
	appsDomain = "http://appsstage.thestreet.com";
	searchDomain = "http://dfind01.thestreet.com";
	toolsDomain = "http://stools.thestreet.com";
	ratingsDomain = "http://sratings.thestreet.com"
}

if (currentHost == "devweb.thestreet.com" || currentHost == "dratings.thestreet.com") {
	webDomain = "http://devweb.thestreet.com";
	ratingsDomain = "http://dratings.thestreet.com"
}

function BC() {
var b = navigator.appName
if (b=="Netscape") this.b = "ns"
else if (b=="Microsoft Internet Explorer") this.b = "ie"
else this.b = b}
is = new BC()
if((is.b == "ns") && (navigator.userAgent.indexOf("Mac") != -1)) {document.write ("<LINK REL=\"stylesheet\" HREF=\"" + webDomain + "/tsc/stylesheets/rm_global_ns_mac_new.css\" TYPE=\"text/css\">")}
else if (is.b == "ns")	{document.write ("<LINK REL=\"stylesheet\" HREF=\"" + webDomain + "/tsc/stylesheets/rm_global_ns_td_new.css\" TYPE=\"text/css\">")}
else	{document.write ("<LINK REL=\"stylesheet\" HREF=\"" + webDomain + "/tsc/stylesheets/rm_global_ie_new.css\" TYPE=\"text/css\">")}

// extract _puc for partner pages and ad tags
var path = document.location.pathname;
var partner = null;
var adpuc = null;
var puc = null;
var index = path.indexOf("/_");
if(index > -1) {
	start = path.substring(index+2);
	partner = start.substring(start,start.indexOf("/"));  // used on partner story page
	puc = partner; // used in ad tags
	if(puc != null) adpuc = ("adpuc=" + puc + ";");
}

<!-- ord number for generic ads -->
var ord = Math.random() + "" ;
ord = ord.substring(2,ord.length);


<!-- common cookie parsing code (My StockWatch, User Status -->
function GetCookie (splitby,name) {
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while (i < clen) {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg)
            return getCookieVal(splitby,j);
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) break;
    }

    return null;
}

function getCookieVal (splitby,offset) {
    var endstr = document.cookie.indexOf (splitby,offset);
    if (endstr == -1)
    endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
}

<!-- called by surveys -->
function showLiveSurvey(expiration, workFlowState, liveMode) {
	var now = Date.parse(new Date());
	var endDate = Date.parse(expiration);
 
	if (endDate > now && workFlowState == liveMode) {
		document.getElementById("divTable").style.display="inline";
	}
}

	//called by radio pages
function audioPlayer(clip){
	var cookieSelectedFormat = null;
	var editPreference = false;
	var cookieName = "selectedAudioFormat"; // cookie name

	// read the cookie
	if(document.cookie.indexOf(cookieName) > -1) {
		cookieSelectedFormat = GetCookie(";",cookieName);
	
		// if wma, pop up the player
		if( (cookieSelectedFormat != null) && (cookieSelectedFormat == "formatSelectedWMA") ) {
			url = webDomain +"/radio/wma_player.html?clip=" + clip;
			window.open(url,"clip","WIDTH=400,HEIGHT=490,top=50,left=50,status=yes,toolbar=no,menubar=no,location=no,resizable=yes");
		} else {
			var	url = webDomain +"/radio/audio_player.html?clip=" + clip;
			window.open(url,"clip","WIDTH=400,HEIGHT=490,top=50,left=50,status=yes,toolbar=no,menubar=no,location=no,resizable=yes");		
		}
	
	} else {
		var	url = webDomain +"/radio/audio_player.html?clip=" + clip;
		window.open(url,"clip","WIDTH=400,HEIGHT=490,top=50,left=50,status=yes,toolbar=no,menubar=no,location=no,resizable=yes");
	}
}

<!-- called by the glossary tag -->
function popUp(href) {
   popupWin = window.open(href, 'remote', 'width=380,height=480,left=40,top=30,scrollbars=yes');
}

<!-- called by media tag -->
function popping(href,mediaUrl, width, height) {
   poppingWin = window.open(href, mediaUrl, 'width=' + width + ',height=' + height + ',left=40,top=30');
}

<!-- called by bigchart ads -->
function switchimg(newImg, whichImg) {
var imgRoot ;
var randNum ;
randNum = Math.random() ;
imgRoot = "http://a1128.g.akamaitech.net/v/1128/402/3m/akachart.bigcharts.com/custom/thestreet-com/";
document.images[whichImg].src = imgRoot + newImg + ".img?" + randNum ;
}

<!-- called by old bigchart ads -->
function sw(nImg, wImg) {
var iRoot ;
var randNum ;
randNum = Math.random() ;
iRoot = "http://chart.bigcharts.com/custom/thestreet-com/";
document.images[wImg].src = iRoot + nImg + ".gifquote?" + randNum ;
}

<!-- used for Netscape 4.x --> 
function NetF() {
if (document.WM.NetF.initWindowWidth != window.innerWidth || document.WM.NetF.initWindowHeight != window.innerHeight) { document.location = document.location;}}
if (is.b == "ns") {
if (typeof document.WM == 'undefined'){document.WM = new Object;}
if (typeof document.WM.WM_scaleFont == 'undefined') {
document.WM.NetF = new Object;
document.WM.NetF.initWindowWidth = window.innerWidth;
document.WM.NetF.initWindowHeight = window.innerHeight;}
window.onresize = NetF;}

<!-- Status cookie js --> 

	document.write("<SCR" + "IPT LANGUAGE='JavaScript1.2' SRC='" + webDomain + "/tsc/userStatus.js' TYPE='text/javascript'><\/SCR" + "IPT>");

<!-- called by My StockWatch index, gets userid, user lists -->
var userid = GetCookie("|","RGIS");

function StockWatchCookie(){
    //Cookie format example: {list1`~`AMAT AOL/}{list2`~`MSFT DELL/}
    this.watchList = new Array();
    var cookieVal = GetCookie(";","StockWatchList");

    if(cookieVal != null && cookieVal.length > 2){
        cookieVal = cookieVal.substring(1, cookieVal.length - 2);

        var list = cookieVal.split("/}||{");

        for( var i = 0; i < list.length; i++){
            var data = list[i].split("`~`");
            this.watchList[i] = data;
        }
    }
}

// Browser detection for unsupported browser message
    document.write("<SCR" + "IPT LANGUAGE='JavaScript1.2' SRC='" + webDomain + "/tsc/common/javascript/unsupportedBrowserDetect.js' TYPE='text/javascript'><\/SCR" + "IPT>");

// flash detection script
	document.write("<SCR" + "IPT LANGUAGE='JavaScript1.2' SRC='" + webDomain + "/tsc/common/javascript/flash_sniff.js' TYPE='text/javascript'><\/SCR" + "IPT>");

//revenue science
	if (rsistring == null) var rsistring = "";
	if (segQS == null) var segQS = "";
	document.write("<SCR" + "IPT LANGUAGE='JavaScript1.2' SRC='" + webDomain + "/tsc/common/javascript/rsi.js' TYPE='text/javascript'><\/SCR" + "IPT>");

// tscm js - ratings utils, yahoo utils
	if(typeof document.createElement!="undefined"){
		var h=document.getElementsByTagName('head').item(0);
		var s=document.createElement('script');
		s.setAttribute("type","text/javascript");
		s.setAttribute("src",webDomain+"/tsc/tscm.js");
		s.setAttribute("defer", true);
		h.appendChild(s);
	}else{
		document.write("<scr" + "ipt type='text/javascript' src='" + mod + "'><" + "/" + "scr" + "ipt>");
		this.loaded.push(name);
	}

   mod = "/tsc/yui.js";
	if(typeof document.createElement!="undefined"){
		var h=document.getElementsByTagName('head').item(0);
		var s=document.createElement('script');
		s.setAttribute("type","text/javascript");
		s.setAttribute("src",webDomain+mod);
		s.setAttribute("defer", true);
		h.appendChild(s);
	}else{
		document.write("<scr" + "ipt type='text/javascript' src='" + mod + "'><" + "/" + "scr" + "ipt>");
	}


