var ord = Math.random() * 10000000000000000

sHREF="http://www.thefinancials.com/Advertising.html";
sSRC="http://www.thefinancials.com/banners/BannerOurAdvert_Home.gif";
sALT="This Space Available. Click here to learn about advertising on thefinancials.com.";
sTARGET="_self";
sTEXT="";
sTEXTONLY="";
bAddRandomArg_IMG=true;
bAddRandomArg_LINK=true;
sCounter_FileName="";
sIESite="";
sGroupGlobal="";
sHEIGHT="0";
sWIDTH="0";
sKVAL="";

//for PIR
function show( id, state ){
	var what = document.getElementById( id );
	what.style.visibility = (state)?'visible':'hidden';
	what.style.display = (state)?'block':'none';
	if( state == true ) { what.style.zIndex = (max_z++); }
}

function GetRandomArg() {

	sGetRandomArg="";
	for (i = 0; i<25; i++) {
   		sGetRandomArg=sGetRandomArg+(Math.round(Math.random()*10));
   	}
 	return sGetRandomArg;	
}

function GetBanner(sSize,sGroup,bOption,sPID,sSiteID,sLoc) {
	sRandomArg=GetRandomArg();

	if (typeof(sSize)=='undefined') {
		sSize="";
	}
	if (typeof(sGroup)=='undefined') {
		sGroup="";
	}
	sGroupGlobal=sGroup;

	if (typeof(bOption)=='undefined') {
		bOption="";
	}
	if (typeof(sPID)=='undefined') {
		sPID="";
	} else {
		sPID=sPID.toUpperCase();
	}
	if (typeof(sSiteID)=='undefined') {
		sSiteID="";
	}
	sSiteID = String(sSiteID);
	if (sSiteID=="") {
		sSiteID="HOME";
	}
	if (sSiteID=="VORTEX") {
		sSiteID="CUR";
	}
	sGroup = String(sGroup);
	if (sGroup=="VORTEX") {
		sGroup="CUR";
	}
	if (typeof(sLoc)=='undefined') {
		sLoc="";
	}
	sSize=sSize.toUpperCase();
	sGroup=sGroup.toUpperCase();
	sSiteID=sSiteID.toUpperCase();
	sLoc=sLoc.toUpperCase();

	switch (sSiteID) {
	case "CUR" : 
		sKVAL="currencies";
		break;
	case "COM" : 
		sKVAL="commodities";
		break;
	case "IDX" : 
		sKVAL="indices";
		break;
	default :
		sKVAL="homepage";
		break;
	}

	switch (sSize) {
	case "L" : 
            if (sGroupGlobal=="COBRAND") {
			sHEIGHT="60";
			sWIDTH="468";
			sTARGET="_top";
			sALT="Visit eToro.com";
			sSRC="http://www.etoro.com/B487_A10250_TGet.aspx";	
			sHREF="http://www.etoro.com/B487_A10250_TClick.aspx";		
            } else {
			//InvestingChnnel
			sTEXTONLY="<script language=" +"'" + "JavaScript" +"'" + " src=" + "'" + "http://ad.doubleclick.net/adj/invc.thefinancials/" + sKVAL + ";kw=;kval=" + sKVAL + ";tile=1;sz=728x90;ord=" +"'" + " + ord + " +"'" + "?" +"'" + " type=" +"'" + "text/javascript" +"'" + "><\/script>"
		}
		break;

	case "TALL" : 
		//InvestingChnnel
		//sHEIGHT="600";
		//sWIDTH="120";
		//sTARGET="_top";
		//sALT="Visit eToro.com";
		//sSRC="http://www.etoro.com/B499_A10250_TGet.aspx";	
		//sHREF="http://www.etoro.com/B499_A10250_TClick.aspx";		
		sTEXTONLY="<script language=" +"'" + "JavaScript" +"'" + " src=" +"'" + "http://ad.doubleclick.net/adj/invc.thefinancials/" + sKVAL + ";kw=;kval=" + sKVAL + ";3;sz=160x600;ord=" +"'" + " + ord + " +"'" + "?" +"'" + " type=" +"'" + "text/javascript" +"'" + "><\/script>"
		break;

	case "TILE_270" : 
		//INTERTRADE
		sTEXTONLY="<object id='slideshow' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='125' height='60' id='test' align='middle'>"
		sTEXTONLY = sTEXTONLY+"<param name='movie' value='http://www.thefinancials.com/banners/Turtle%20Forex.swf'>"
		sTEXTONLY = sTEXTONLY+"<param name='quality' value='high'>"
		sTEXTONLY = sTEXTONLY+"<param name='allowScriptAccess' value='sameDomain'>"
		sTEXTONLY = sTEXTONLY+"<param name='bgcolor' value='#000000'>"
		sTEXTONLY = sTEXTONLY+"<embed name='slideshow' src='http://www.thefinancials.com/banners/Turtle%20Forex.swf' quality='high' bgcolor='#FFFFFF' width='125' height='60' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed>"
		sTEXTONLY = sTEXTONLY+"</object>"
		sCounter_FileName="http://www.thefinancials.com/banners/intertrade_count_125x60.gif";
		sTEXTONLY =""
		break;

	case "RECT" : 
		if (sGroup=="HOME") {
			//InvestingChnnel
			//sHEIGHT="250";
			//sWIDTH="300";
			//sTARGET="_top";
			//sALT="Visit eToro.com";
			//sSRC="http://www.etoro.com/B467_A10250_TGet.aspx";	
			//sHREF="http://www.etoro.com/B467_A10250_TClick.aspx";		
			sTEXTONLY="<script language=" +"'" + "JavaScript" +"'" + " src=" +"'" + "http://ad.doubleclick.net/adj/invc.thefinancials/" + sKVAL + ";kw=;kval=" + sKVAL + ";tile=2;sz=300x250;ord=" +"'" + " + ord + " +"'" + "?" +"'" + " type=" +"'" + "text/javascript" +"'" + "><\/script>"
		}
		break;

	case "M", "TILE" : 
		//INTERTRADE
		sTEXTONLY="<object id='slideshow' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='125' height='60' id='test' align='middle'>"
		sTEXTONLY = sTEXTONLY+"<param name='movie' value='http://www.thefinancials.com/banners/Turtle%20Forex.swf'>"
		sTEXTONLY = sTEXTONLY+"<param name='quality' value='high'>"
		sTEXTONLY = sTEXTONLY+"<param name='allowScriptAccess' value='sameDomain'>"
		sTEXTONLY = sTEXTONLY+"<param name='bgcolor' value='#000000'>"
		sTEXTONLY = sTEXTONLY+"<embed name='slideshow' src='http://www.thefinancials.com/banners/Turtle%20Forex.swf' quality='high' bgcolor='#FFFFFF' width='125' height='60' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed>"
		sTEXTONLY = sTEXTONLY+"</object>"
		sCounter_FileName="http://www.thefinancials.com/banners/intertrade_count_125x60.gif";
		sTEXTONLY =""
		break;

	case "S" : 
		//INTERTRADE
		sTEXTONLY="<object id='slideshow' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='125' height='60' id='test' align='middle'>"
		sTEXTONLY = sTEXTONLY+"<param name='movie' value='http://www.thefinancials.com/banners/Turtle%20Forex%20small.swf'>"
		sTEXTONLY = sTEXTONLY+"<param name='quality' value='high'>"
		sTEXTONLY = sTEXTONLY+"<param name='allowScriptAccess' value='sameDomain'>"
		sTEXTONLY = sTEXTONLY+"<param name='bgcolor' value='#000000'>"
		sTEXTONLY = sTEXTONLY+"<embed name='slideshow' src='http://www.thefinancials.com/banners/Turtle%20Forex%20small.swf' quality='high' bgcolor='#FFFFFF' width='88' height='31' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed>"
		sTEXTONLY = sTEXTONLY+"</object>"
		sCounter_FileName="http://www.thefinancials.com/banners/intertrade_count_88x31.gif";
		sTEXTONLY =""
		break;

	case "T" : 
 
		//INTERTRADE
		sTEXTONLY="<object id='slideshow' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='125' height='60' id='test' align='middle'>"
		sTEXTONLY = sTEXTONLY+"<param name='movie' value='http://www.thefinancials.com/banners/Turtle%20Forex.swf'>"
		sTEXTONLY = sTEXTONLY+"<param name='quality' value='high'>"
		sTEXTONLY = sTEXTONLY+"<param name='allowScriptAccess' value='sameDomain'>"
		sTEXTONLY = sTEXTONLY+"<param name='bgcolor' value='#000000'>"
		sTEXTONLY = sTEXTONLY+"<embed name='slideshow' src='http://www.thefinancials.com/banners/Turtle%20Forex.swf' quality='high' bgcolor='#FFFFFF' width='125' height='60' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed>"
		sTEXTONLY = sTEXTONLY+"</object>"
		sCounter_FileName="http://www.thefinancials.com/banners/intertrade_count_125x60.gif";
		sTEXTONLY =""
		break;

	}

	if (sTEXTONLY) {
		sGetBanner=sTEXTONLY;
		if (sCounter_FileName!="") {
			sGetBanner=sGetBanner + "<img border='0' src='" + sCounter_FileName + "?ord=" + sRandomArg + "' width='1' height='1'>";
		}
	} else {
		if (sTEXT) {
			sGetBanner=sTEXT;
		} else {
			sGetBanner="";
		}
		sGetBanner=sGetBanner+"<a target='" + sTARGET + "' href='" + sHREF
		if (bAddRandomArg_LINK) {
			sRandomArg=sRandomArg + "?";
			sGetBanner=sGetBanner+ "?ord=" + sRandomArg 
		}
		sGetBanner=sGetBanner+ "'><img border='0' src='" + sSRC 
		if (bAddRandomArg_IMG) {
			sGetBanner=sGetBanner+"?ord=" + sRandomArg;
		} 
		sGetBanner=sGetBanner + "' alt='" + sALT + "' width='" + sWIDTH + "' height='" + sHEIGHT +"' name='Banner'></a>";
		if (sCounter_FileName!="") {
			sGetBanner=sGetBanner + "<img border='0' src='" + sCounter_FileName + "?ord=" + sRandomArg + "' width='1' height='1'>";
		}
	}
	return sGetBanner;
}