if (location.href.indexOf("/action")==-1) //i.e. If the page is Not A JSP
	{
		if(location.href.indexOf("/en/")>0)
		{
			ctryCd=location.href.split("/en/");
			lgCd="/en/";
			temp_lang="en";
		}
		if(location.href.indexOf("/ar/")>0)
		{
			ctryCd=location.href.split("/ar/");
			lgCd="/ar/";
			temp_lang="ar"
		}
		ctryCd=ctryCd[0].substring(ctryCd[0].length-2);
	}
	else
	{
		var loc = location.href;
		ctryCd=loc.substr(loc.indexOf("cntry_cd")+9,2);
		//alert("Country Code within else"+ctryCd);
		if(location.href.indexOf("en")>0)
		{
		lgCd="/en/";
		temp_lang="en"
		}
		else 
		if(location.href.indexOf("ar")>0)
		{
			lgCd="/ar/";
			temp_lang="ar"
		}
		if(ctryCd=="BV")
		{
			if(window.opener)
			{
				try
				{
					if(window.opener.location.href.indexOf("cntry_cd")>0)
					{
						loc = window.opener.location.href;
						loc = loc.substr(loc.indexOf("cntry_cd")+9,2);
						ctryCd=loc;	
					}
					if(window.opener.location.href.indexOf("LAAM")>0)
					{
						loc = window.opener.location.href;
						loc = loc.substr(loc.indexOf("LAAM")+5,2);
						ctryCd=loc;
					}
				}
				catch(e){}
			}
		}
	}
/************  Corporate Homepage Flash Banner related Code Starts Here  ***************/

var rndNumber; //Random number will be stored in this Global variable
var flashName=""; //Global variable to hold the flash banner file name

//All Pop-up is closed by Mathan by 30th July 2004 7.35PM
/* Cookie Details
Life: 2 Hours
Domain: Current location.host
Path: / - All files/folders/subfolders under root
Secure: false
*/
/*
function SetTimerCookie(name, value) { //Sets a Timer Cookie of life to 2 Hours
var today = new Date();
var expires = new Date();
expires.setTime(today.getTime()+1000*60*60*2); //Setting cookie life to 2 Hours
var argv = SetTimerCookie.arguments;  
var argc = SetTimerCookie.arguments.length;  
//var path = (argc > 3) ? argv[3] : null;  
//var domain = (argc > 4) ? argv[4] : null;  
var path = "/"; 
var domain = location.host;  
var secure = (argc > 5) ? argv[5] : false;  
document.cookie = name + "=" + escape (value) + 
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
((path == null) ? "" : ("; path=" + path)) +  
((domain == null) ? "" : ("; domain=" + domain)) +    
((secure == true) ? "; secure" : "");
}
*/
function checkClosed() //Checks if user closes current browser window and deletes the cookie if he closes it.
{
}

function callGMChoice()
{
	/*if (location.href.indexOf("/en/")>0)
	{	
		if(ctryCd=="BH")
		{
			window.open("http://www.gmchoice.com/default_post.aspx?creativeid=2329&countrycode=bah&style=se&idiomaid=1");
			return;
		}
		if(ctryCd=="KW")
		{
			window.open("http://www.gmchoice.com/default_post.aspx?creativeid=2393&countrycode=kwt&style=se&idiomaid=1");
			return;
		}
		if(ctryCd=="SA")
		{
			window.open("http://www.gmchoice.com/default_post.aspx?creativeid=2462&countrycode=ksa&style=se&idiomaid=1");
			return;
		}
	}
	if (location.href.indexOf("/ar/")>0)
	{	
		if(ctryCd=="BH")
		{
			window.open("http://www.gmchoice.com/default_post.aspx?creativeid=2350&countrycode=bah&style=se&idiomaid=2");
			return;
		}
		if(ctryCd=="KW")
		{
			window.open("http://www.gmchoice.com/default_post.aspx?creativeid=2423&countrycode=kwt&style=se&idiomaid=2");
			return;
		}
		if(ctryCd=="SA")
		{
			window.open("http://www.gmchoice.com/default_post.aspx?creativeid=2495&countrycode=ksa&style=se&idiomaid=2");
			return;
		}
	}*/
}

function populateCorpFlashBanner()
{
	/*if(ctryCd=="BH" || ctryCd=="KW" || ctryCd=="SA")
	{
		if (location.href.indexOf("/ar/")>0)
		{	
			flashName="/content_data/LAAM/BV/en/GBPBV/corp/flash/gmarabia_gmchoice_ar.swf"; 
		}
		if (location.href.indexOf("/en/")>0)
		{	
			flashName="/content_data/LAAM/BV/en/GBPBV/corp/flash/gmarabia_gmchoice_en.swf"; 
		}
		document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='780' height='115'>"+
		"<param name='movie' value='"+flashName+"'>"+
		"<param name='quality' value='high'>"+
		"<param name='menu' value='false'>"+
		"<embed src='"+flashName+"' width='780' height='115' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' menu='false'></embed></object>");
	}
	else
	{*/
		/*rndNumber=Math.floor(Math.random()*2);
		if(rndNumber==0) //If current random number is 0, SRX flash banner is shown
			flashName="feature_srx.swf";
		if(rndNumber==1) //If current random number is 1, Lumina flash banner is shown
			flashName="feature_lumina.swf";
		*/
		if (location.href.indexOf("/ar/")>0)
		{	
			flashName="/content_data/LAAM/BV/en/GBPBV/corp/flash/lumina_feature_ar.swf"; 
			//if(location.href.indexOf("/GBPAE/")>0 || location.href.indexOf("/GBPBH/")>0 || location.href.indexOf("/GBPOM/")>0 || location.href.indexOf("/GBPSA/")>0 || location.href.indexOf("/GBPQA/")>0)
			document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='780' height='115'>"+
			"<param name='movie' value='"+flashName+"'>"+
			"<param name='quality' value='high'>"+
			"<param name='menu' value='false'>"+
			"<embed src='"+flashName+"' width='780' height='115' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' menu='false'></embed></object>");
		}
		if (location.href.indexOf("/en/")>0)
		{	
			flashName="/content_data/LAAM/BV/en/GBPBV/corp/flash/lumina_feature_en.swf"; 
			//if(location.href.indexOf("/GBPAE/")>0 || location.href.indexOf("/GBPBH/")>0 || location.href.indexOf("/GBPOM/")>0 || location.href.indexOf("/GBPSA/")>0 || location.href.indexOf("/GBPQA/")>0)
			document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='780' height='115'>"+
			"<param name='movie' value='"+flashName+"'>"+
			"<param name='quality' value='high'>"+
			"<param name='menu' value='false'>"+
			"<embed src='"+flashName+"' width='780' height='115' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' menu='false'></embed></object>");
		}
	//}
}

/************  Corporate Homepage Flash Banner related Code Ends Here  ***************/

function MovieModel()
{
	location.href="/GBPServiceMgr2.dyn?CntryCd="+ctryCd+"&LangCd="+temp_lang+"&WebSiteID=GBP"+ctryCd+"&ReqsType=Pull&ServiceName=RequestBrochure&NampltCd=999&SellingSrc=72&cnInput=006/6R/srx_pho_exteriorphotos.html";
}

function populateCorpBanner()
{
/*
	if (location.href.indexOf("/ar/") > 0)
	{	
		flashName="/content_data/LAAM/BV/en/GBPBV/corp/flash/gmstars_banner_ara.swf"; 
		document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='777' height='80'>"+
		"<param name='movie' value='"+flashName+"'>"+
		"<param name='quality' value='high'>"+
		"<param name='menu' value='false'>"+
		"<embed src='"+flashName+"' width='777' height='80' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' menu='false'></embed></object>");
	}
	if (location.href.indexOf("/en/") > 0)
	{	
		flashName="/content_data/LAAM/BV/en/GBPBV/corp/flash/gmstars_banner_en.swf"; 
		document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='777' height='80'>"+
		"<param name='movie' value='"+flashName+"'>"+
		"<param name='quality' value='high'>"+
		"<param name='menu' value='false'>"+
		"<embed src='"+flashName+"' width='777' height='80' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' menu='false'></embed></object>");
	}
	*/
}


function populateBottomPromoBanner()
{
//Width = 735;
//Height = 600;
 LeftPosition = (screen.width) ? (screen.width- 735)/2 : 0;
 TopPosition = (screen.height) ? (screen.height- 600)/2 : 0;   
//alert(LeftPosition+"TOP:"+TopPosition);

	if (location.href.indexOf("/ar/")>0)
	{
		document.write("<a href='javascript:void(0)' onClick=window.open('http://web.refleks.com/index.php?surveyid=18546&newlang=ar','Releks','width=735,height=600,scrollbars=yes,resizable=disabled,top="+TopPosition+",left="+LeftPosition+"');><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/questionnaire_banner_ara.gif' width='760' height='69' border='0'>");
	}


	if (location.href.indexOf("/en/")>0)
	{
		document.write("<a href='javascript:void(0)'  onClick=window.open('http://web.refleks.com/index.php?surveyid=18546&newlang=en','Releks','width=735,height=600,scrollbars=yes,resizable=disabled,top="+TopPosition+",left="+LeftPosition+"');><img  src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/questionnaire_banner_eng.gif' width='760' height='69' border='0'>");
	}	

}

function populateChevyBanner()
{
	if (location.href.indexOf("/ar/")>0)
	{
		if(location.href.indexOf("/GBPAE/")>0)
		{
	
			//http://www.chevroletmylife.com/lumina/jump.aspx?id=taf&lang=1
			document.write("<a href='http://www.chevroletmylife.com/lumina/jump.aspx?id=GTO&lang=1' target='_blank'><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/uae_ar.gif' border=0></a>");
			return;
		}
		if(location.href.indexOf("/GBPBH/")>0)
		{
			//document.write("<a href='http://www.gmchoice.com/default_post.aspx?creativeid=2351&countrycode=bah&style=se&idiomaid=2' target='_blank'><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/bah_ar.gif' border=0></a>");
			document.write("<a href='http://www.chevroletmylife.com/lumina/jump.aspx?id=GTO&lang=1' target='_blank'><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/bah_ar.gif' border=0></a>");
			return;
		}
		if(location.href.indexOf("/GBPJO/")>0)
		{
			document.write("<a href='http://www.chevroletmylife.com/lumina/jump.aspx?id=GTO&lang=1' target='_blank'><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/jor_ar.gif' border=0></a>");
			return;
		}
		if(location.href.indexOf("/GBPKW/")>0)
		{
			//document.write("<a href='http://www.gmchoice.com/default_post.aspx?creativeid=2419&countrycode=kwt&style=se&idiomaid=2' target='_blank'><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/kwt_ar.gif' border=0></a>");
			document.write("<a href='http://www.chevroletmylife.com/lumina/jump.aspx?id=GTO&lang=1' target='_blank'><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/kwt_ar.gif' border=0></a>");
			return;
		}
		if(location.href.indexOf("/GBPLB/")>0)
		{
			document.write("<a href='http://www.chevroletmylife.com/lumina/jump.aspx?id=GTO&lang=1' target='_blank'><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/leb_ar.gif' border=0></a>");
			return;
		}
		if(location.href.indexOf("/GBPOM/")>0)
		{
			document.write("<a href='http://www.chevroletmylife.com/lumina/jump.aspx?id=GTO&lang=1' target='_blank'><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/oma_ar.gif' border=0></a>");
			return;
		}
		if(location.href.indexOf("/GBPQA/")>0)
		{
			document.write("<a href='http://www.chevroletmylife.com/lumina/jump.aspx?id=GTO&lang=1' target='_blank'><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/qat_ar.gif' border=0></a>");
			return;
		}
		if(location.href.indexOf("/GBPSA/")>0)
		{
			//document.write("<a href='http://www.gmchoice.com/default_post.aspx?creativeid=2513&countrycode=ksa&style=se&idiomaid=2' target='_blank'><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/ksa_ar.gif' border=0></a>");
			document.write("<a href='http://www.chevroletmylife.com/lumina/jump.aspx?id=GTO&lang=1' target='_blank'><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/ksa_ar.gif' border=0></a>");
			return;
		}
		if(location.href.indexOf("/GBPSY/")>0)
		{
			document.write("<a href='http://www.chevroletmylife.com/lumina/jump.aspx?id=GTO&lang=1' target='_blank'><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/syr_ar.gif' border=0></a>");
			return;
		}	
	}
	if (location.href.indexOf("/en/") > 0)
	{
		if(location.href.indexOf("/GBPAE/")>0)
		{
			//http://www.chevroletmylife.com/lumina/jump.aspx?id=taf&lang=0
			document.write("<a href='http://www.chevroletmylife.com/lumina/jump.aspx?id=GTO&lang=0' target='_blank'><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/uae_en.gif' border=0></a>");
			return;
		}
		if(location.href.indexOf("/GBPBH/")>0)
		{
			//document.write("<a href='http://www.gmchoice.com/default_post.aspx?creativeid=2315&countrycode=bah&style=se&idiomaid=1' target='_blank'><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/bah_en.gif' border=0></a>");
			document.write("<a href='http://www.chevroletmylife.com/lumina/jump.aspx?id=GTO&lang=0' target='_blank'><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/bah_en.gif' border=0></a>");
			return;
		}
		if(location.href.indexOf("/GBPJO/")>0)
		{
			document.write("<a href='http://www.chevroletmylife.com/lumina/jump.aspx?id=GTO&lang=0' target='_blank'><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/jor_en.gif' border=0></a>");
			return;
		}
		if(location.href.indexOf("/GBPKW/")>0)
		{
			//document.write("<a href='http://www.gmchoice.com/default_post.aspx?creativeid=2376&countrycode=kwt&style=se&idiomaid=1' target='_blank'><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/kwt_en.gif' border=0></a>");
			document.write("<a href='http://www.chevroletmylife.com/lumina/jump.aspx?id=GTO&lang=0' target='_blank'><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/kwt_en.gif' border=0></a>");
			return;
		}
		if(location.href.indexOf("/GBPLB/")>0)
		{
			document.write("<a href='http://www.chevroletmylife.com/lumina/jump.aspx?id=GTO&lang=0' target='_blank'><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/leb_en.gif' border=0></a>");
			return;
		}
		if(location.href.indexOf("/GBPOM/")>0)
		{
			document.write("<a href='http://www.chevroletmylife.com/lumina/jump.aspx?id=GTO&lang=0' target='_blank'><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/oma_en.gif' border=0></a>");
			return;
		}
		if(location.href.indexOf("/GBPQA/")>0)
		{
			document.write("<a href='http://www.chevroletmylife.com/lumina/jump.aspx?id=GTO&lang=0' target='_blank'><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/qat_en.gif' border=0></a>");
			return;
		}
		if(location.href.indexOf("/GBPSA/")>0)
		{
			//document.write("<a href='http://www.gmchoice.com/default_post.aspx?creativeid=2451&countrycode=ksa&style=se&idiomaid=1' target='_blank'><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/ksa_en.gif' border=0></a>");
			document.write("<a href='http://www.chevroletmylife.com/lumina/jump.aspx?id=GTO&lang=0' target='_blank'><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/ksa_en.gif' border=0></a>");
			return;
		}
		if(location.href.indexOf("/GBPSY/")>0)
		{
			document.write("<a href='http://www.chevroletmylife.com/lumina/jump.aspx?id=GTO&lang=0' target='_blank'><img src='/content_data/LAAM/BV/en/GBPBV/chevrolet/images/syr_en.gif' border=0></a>");
			return;
		}	
	}
//	document.write("<img src='images/topLogo.gif' width='760' height='75'>");	// Uncomment this to revert back to old banners
}

function redirect_locator()
{
/*	if(location.href.indexOf("/GBPSA/")>0)
			{
				alert("SA.. Dealer Locator")
			}
	if(location.href.indexOf("/GBPBH/")>0)
			{
				alert("BH.. Dealer Locator")
			}*/

			dealerLocatorCountry();
}
function commonFunctionInBV()
{
	if(location.href.indexOf("/GBPAE/")>0 || location.href.indexOf("/GBPBH/")>0 || location.href.indexOf("/GBPOM/")>0 || location.href.indexOf("/GBPSA/")>0 || location.href.indexOf("/GBPQA/")>0)
	{
		if(location.href.indexOf("/chevrolet/index.htm")>0)
		{
			if (location.href.indexOf("/en/")>0)
				window.open("/content_data/LAAM/BV/en/GBPBV/chevrolet/chevy_faststart_en.html","SatyamFSWin","width=384,height=437,left=150,top=150");
			if (location.href.indexOf("/ar/")>0)
				window.open("/content_data/LAAM/BV/en/GBPBV/chevrolet/chevy_faststart_ar.html","SatyamFSWin","width=384,height=437,left=150,top=150");
		}
	}
}
//commonFunctionInBV();

function reflexOn(){
	//showXoPopUp();
}

//All Pop-up is closed by Mathan by 30th July 2004 7.35PM
// Cookie Section Starts here...  //

/*
function DeleteCookie (name) 
{
	var exp = new Date("January 1, 1970");
	var cval = GetCookie (name);
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

function checkClosed()
{

}
/*
if(location.href.indexOf("GENOAP")==-1)
{
	window.onunload=checkClosed;
}
*/


