
var debug = false;
var currentContentID = "";
var currentVideoID = "none";
var currentURL = "";
var currentTitle = "";
var scrollToLocation = "";
var userName = "";

var isIE = "";
var isIE6 = false;
var isIE7 = "";
var isLTIE8 = "";

var shadows = true;

var videoloaded = false;
var bannerloaded = false;
var headerloaded = false;
var introloaded = false;
var musicloaded = false;
var formsloaded = false;

var queueValue = false;

var onthemove = false;

var initialLoad = true;
var browserWindowBuffer = 0;
var contentViewportWidth = 955;
var reposition = false;
var rootURL = "http://www.godofwar.com";

var introplayedval = false;
var introplayed = new Cookie('introplayed');

var expandHome = true;
var langlabel = 'en_us';
var localeSelected="";


//Wallpaper Sizes
var sizes = [];
sizes[0] = "800x600";
sizes[1] = "1024x768";
sizes[2] = "1280x960";
sizes[3] = "1600x1200";
sizes[4] = "1920x1200";

//positions
var origPositions = [];
var positionOffset = 100000;

var relHashContent = [];
relHashContent[titleHome] = "container-home";
//relHashContent["Skin"] = "container-skin";
relHashContent[titleStory] = "container-story";
relHashContent[titleOwnTheGame] = "container-ownthegames";
relHashContent[titleDiscoverTheGame] = "container-discoverthegames";
relHashContent[titleVideos] = "container-videos";
relHashContent[titleNews] = "container-news";
relHashContent[titleDownloads] = "container-downloads";
relHashContent[titleMerchandise] = "container-merchandise";
relHashContent[titleMemberLogin] = "container-members";
relHashContent[titlePowerOfGods] = "container-jointhespartanarmy";
relHashContent[titleMusic] = "container-music";


$(window).load(function(){ 
	everythingLoaded();
});

$(function(){

////////////////////////////////////////////////////////////////////////////////////////////	
// -------------------------------------- GLOBAL ---------------------------------------- //

	//$("#viewport").show();
	//$("#header").show();
	//$("#footer").show();
	
	setupDesk();

	if($.browser.msie){
		isIE = true;
		if(parseFloat($.browser.version) < 8){
			isLTIE8 = true;
			if($.browser.version == "7.0"){
				isIE7 = true;
			} else if ($.browser.version == "6.0"){
				isIE6 = true;
			}
		}
	}
	if(!isIE6){
		var browser = navigator.appName;
		if($.browser.safari || browser == "PLAYSTATION 3" || ($.browser.opera && parseFloat($.browser.version) < 9.8)){
			$("#header-container").css("top",0);
			$("#animation img").css("margin-left","-380px");
		} else {
			$("#header-container").animate({top: '-255px'});
		}
	}
	if(isIE6){
		for(var i in relHashContent){
			$("#" + relHashContent[i] + " .frame").css("background-image",$("#" + relHashContent[i] + " .frame").css("background-image").replace("png","gif"));
		}
	}
	
	if(!isIE6){
		$("#header").css("top","auto");
	}
	
	if($.browser.opera){
		if(parseFloat($.browser.version) < 9.8){
		//	$("#msgbrowser").show();
		}
	}

	$("#intro").height($(document).height());


                                                                                          //
// ------------------------------------ END GLOBAL -------------------------------------- //
// ------------------------------------ NAVIGATION -------------------------------------- //
           
                                                                                   
	//Flash	
	var flashvars = {};
	var navPath=getAssetPath();
	 var curPath=window.location.pathname+"";
		if(curPath.indexOf("fr_FR")!=-1){
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_frfr_nav.xml"
		}
		else if(curPath.indexOf("de_DE")!=-1)
		{			
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_dede_nav.xml"			
		}
		else if(curPath.indexOf("en_GB")!=-1)
		{	
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_engb_nav.xml"			
		}
		else if(curPath.indexOf("es_ES")!=-1)
		{			
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_eses_nav.xml"			
		}
		else if(curPath.indexOf("it_IT")!=-1)
		{			
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_itit_nav.xml"			
		}
		else if(curPath.indexOf("da_DK")!=-1)
		{			
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_nav_dadk.xml"			
		}
		else if(curPath.indexOf("de_AT")!=-1)
		{			
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_deat_nav.xml"			
		}
		else if(curPath.indexOf("de_CH")!=-1)
		{			
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_dech_nav.xml"			
		}
		else if(curPath.indexOf("de_LU")!=-1)
		{			
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_delu_nav.xml"			
		}
		else if(curPath.indexOf("fi_FI")!=-1)
		{			
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_nav_fifi.xml"			
		}
		else if(curPath.indexOf("fr_BE")!=-1)
		{			
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_frbe_nav.xml"			
		}
		else if(curPath.indexOf("fr_CH")!=-1)
		{	
			
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_frch_nav.xml"			
		}
		else if(curPath.indexOf("fr_LU")!=-1)
		{			
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_frlu_nav.xml"			
		}
		else if(curPath.indexOf("it_CH")!=-1)
		{			
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_nav_itch.xml"			
		}
		else if(curPath.indexOf("nl_BE")!=-1)
		{			
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_nlbe_nav.xml"			
		}
		else if(curPath.indexOf("nl_NL")!=-1)
		{			
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_nav_nlnl.xml"			
		}
		else if(curPath.indexOf("no_NO")!=-1)
		{			
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_nav_nono.xml"			
		}
		else if(curPath.indexOf("pl_PL")!=-1)
		{			
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_nav_plpl.xml"			
		}
		else if(curPath.indexOf("pt_PT")!=-1)
		{			
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_ptpt_nav.xml"			
		}
		else if(curPath.indexOf("ru_RU")!=-1)
		{			
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_nav_ruru.xml"			
		}
		else if(curPath.indexOf("sv_SE")!=-1)
		{			
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_svse_nav.xml"			
		}
		else if(curPath.indexOf("en_AU")!=-1)
		{			
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_nav_enau.xml"			
		}	
		else if(curPath.indexOf("en_IE")!=-1)
		{			
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_nav_enie.xml"			
		}
		else if(curPath.indexOf("en_NZ")!=-1)
		{			
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_ennz_nav.xml"			
		}
		else{				
			flashvars.xmlTarget = ucmRoot+"groups/public/documents/webasset/g3_nav.xml";
		}
	userName=readCookie("userName");
	if(userName){
			flashvars.userName = userName;
	}	
	var parameters = { wmode: "transparent", allowScriptAccess: "always", scale: "noscale" };
	var attributes = {};
	attributes.name = "header";
	if(curPath.indexOf("Index")!=-1){
		swfobject.embedSWF(navPath+"g3_gow3nav.swf", "header", "100%", "160", "9.0.0", ucmRoot+"groups/public/documents/webasset/g3_expressinstall.swf", flashvars, parameters, attributes);
	}else if(curPath.indexOf("ru_RU")!=-1){ /* for Arial font*/
		swfobject.embedSWF(ucmRoot+"groups/public/documents/webasset/g3_gow3navarial.swf", "header", "100%", "160", "9.0.0", ucmRoot+"groups/public/documents/webasset/g3_expressinstall.swf", flashvars, parameters, attributes);
	}else if((curPath.indexOf("fr_FR")!=-1)||(curPath.indexOf("fr_BE")!=-1)||(curPath.indexOf("sv_SE")!=-1)||(curPath.indexOf("fr_LU")!=-1)||(curPath.indexOf("fr_CH")!=-1)||(curPath.indexOf("pl_PL")!=-1)){ /* for space issue in header navigation*/
		swfobject.embedSWF(ucmRoot+"groups/public/documents/webasset/g3_gow3navalign.swf", "header", "100%", "160", "9.0.0", ucmRoot+"groups/public/documents/webasset/g3_expressinstall.swf", flashvars, parameters, attributes);	
	}else{ /* for localized */
		swfobject.embedSWF(ucmRoot+"groups/public/documents/webasset/g3_gow3navlocalized.swf", "header", "100%", "160", "9.0.0", ucmRoot+"groups/public/documents/webasset/g3_expressinstall.swf", flashvars, parameters, attributes);
	}
	//set height to 100% of browser's viewport
	$("#viewport").height($(window).height()-browserWindowBuffer);
	$("#viewport").width($(window).width());
	
	//set height upon browser resize
	$(window).resize(function(){
		adjustViewport();
	});

	//load deep-link or default
	if(window.location.hash.indexOf('?')!=-1){
			
			msgId=window.location.hash.split('?')[1];
			var hashstring = window.location.hash.split('?')[0];
			//alert("msgId on js" + msgId);
	}else{
			var hashstring = window.location.hash.split('?')[0];
	}
	
	
	
	
	
	hashstring = hashstring.substring(1).replace("#","");
	if(hashstring != ""){
		//Videos deep-link
		var match = /Videos-(.*)/.test(hashstring);
		if(match == true){
			currentVideoID = hashstring.replace("Videos-","");
			scrollToLocation = relHashContent["Videos"];
		} else {
			scrollToLocation = relHashContent[hashstring];
			if(scrollToLocation == undefined || scrollToLocation == ""){
				handleUndefined();
			}
		}
	} else {
		//load default content instead
		scrollToLocation = $(".container-default").attr("id");		
	}

	$("#container").history(function(e, hash) {
		//scrollObject(relHashContent[hash]);
	});
	
                                                                                          //
// ---------------------------------- END NAVIGATION ------------------------------------ //
////////////////////////////////////////////////////////////////////////////////////////////	


////////////////////////////////////////////////////////////////////////////////////////////	
// -------------------------------------- TWITTER --------------------------------------- //
                                                                                          //

	$.ajax({
		type: "POST",
		url: "/gow3/TwitterFeed",
		success: function(msg){
			$("#container-home .twitter .tweets").html(msg);
			$("#container-discoverthegames .twitter .tweets").html(msg);
			$("#container-news .tweets").html(msg);
			var browser=navigator.appName;
	if(browser != "PLAYSTATION 3"){
		$(".scrollpane").jScrollPane({reinitialiseOnImageLoad:false, animateTo:true, dragMinHeight: 35, dragMaxHeight: 35, scrollbarWidth: 35});
	}
		}
	});
                                                                                          //
// ------------------------------------ END TWITTER ------------------------------------- //
////////////////////////////////////////////////////////////////////////////////////////////	


////////////////////////////////////////////////////////////////////////////////////////////
// -------------------------------------- SHARE ----------------------------------------- //
                                                                                          //


	$("img.facebook").click(function(){
		var urlFacebook = "http://www.facebook.com/sharer.php?u=" + currentURL;
		window.open(urlFacebook,'share');
	});

	$("img.myspace").click(function(){
		var urlMyspace = "http://www.myspace.com/index.cfm?fuseaction=postto&u=" + currentURL;
		window.open(urlMyspace,'share');
	});

	$("img.digg").click(function(){
		var urlDigg = "http://digg.com/submit?url=" + currentURL;
		window.open(urlDigg,'share');
	});

	$("img.twitter").click(function(){
		var urlTwitter = "http://twitter.com/home?status=Check Out " + currentURL;
		window.open(urlTwitter,'share');
	});






                                                                                          //
// ------------------------------------ END SHARE --------------------------------------- //
////////////////////////////////////////////////////////////////////////////////////////////	



////////////////////////////////////////////////////////////////////////////////////////////	
// ---------------------------------------- HOME ---------------------------------------- //
 
 if(expandHome){
	$("#container-home .twitter .tweets").addClass("scrollpane");
	//$("#container-home .frame").css("background-image","url(../webasset/g3_bg_home.png)");
	//$("#container-home .banner_bottom").show();
	$("#container-home .twitter").show();
	$("#container-home").css("padding-top","0");
} else {
	$("#container-home .twitter .tweets").removeClass("scrollpane");
}                                                                                         //
	
	
                                                                                          //	
// -------------------------------------  END HOME -------------------------------------- //
////////////////////////////////////////////////////////////////////////////////////////////	



////////////////////////////////////////////////////////////////////////////////////////////	
// ---------------------------------------- STORY --------------------------------------- //
                                                                                          //

	$("#container-story .text a.tooltip").tooltip();
	
                                                                                          //
// -------------------------------------  END STORY ------------------------------------- //
////////////////////////////////////////////////////////////////////////////////////////////	



////////////////////////////////////////////////////////////////////////////////////////////	
// --------------------------------------- VIDEOS --------------------------------------- //
                                                                                          //

$("#container-videos .sidebar a").click(function(){
	var rel = $(this).attr("rel");
	//scrollObject("container-" + rel);
});
                                                                                          //
// ------------------------------------- END VIDEOS ------------------------------------- //
////////////////////////////////////////////////////////////////////////////////////////////	



////////////////////////////////////////////////////////////////////////////////////////////	
// ------------------------------------ OWN THE GAME ------------------------------------ //
                                                                                          //

	//Default
	$("#container-ownthegames .content .description .gowsparta").show();
	$("#container-ownthegames .content .headings h3.gowsparta").show();
	$("#container-ownthegames .frame").css("background-image","url("+ucmRoot+"groups/public/documents/webasset/g3_bg_ownthegames_off.png)");
	
	//$("#container-ownthegames .content .sidebar .pandorasbox").show();
	//$("#container-ownthegames .games .nav img").animate({opacity: 1});
	$("#container-ownthegames .sidebar .amazon").show();
	document.getElementById('s2').style.border="1px solid #FF0000";
	document.getElementById('s2').style.opacity="1";
	if(curPath.indexOf("Index")!=-1){
		document.getElementById("gowREL1").src=ucmRoot+'groups/public/documents/webasset/g3_own_sparta_large.jpg';
	}
	document.getElementById('s1').style.opacity="0.5";
	document.getElementById('s3').style.opacity="0.5";
	//$("#container-ownthegames .games .nav img").css("opacity",0.5);
    //$("#container-ownthegames .games .nav img").css("border-color","#F00");
	
/*Lines added for Retailer*/
		setRetailers("gowsparta");
/* Lines ended for retialiers*/


	//Own the Games Sidebar Toggle
	var ownthegames_sidebar = true;
	if(ownthegames_sidebar == false){
		$("#container-ownthegames .frame").css("background-image","url("+ucmRoot+"groups/public/documents/webasset/g3_bg_ownthegames_off.png)");
		$("#container-ownthegames .sidebar").hide();
	}
	
	//Hover - Game
	var currGame = "";
	$("#container-ownthegames .games .nav a").hover(function(){
		var imgSrc = $(this).find("img").attr("src").replace("small","large");
		var imgRel = $(this).attr("rel");
		currGame = imgRel;
		
		$("#container-ownthegames .games .nav img").css("opacity",0.5);				
		$("#container-ownthegames .games .largeimage img").attr("src",imgSrc);	

		$("#container-ownthegames .headings h3").hide();			
		$("#container-ownthegames .headings h3." + imgRel).show();

		$("#container-ownthegames .description div").hide();
		$("#container-ownthegames .description div." + imgRel).show();

		$("#container-ownthegames .games .nav img").css("border-color","#333");
		
		$(this).find("img").css("border-color","#F00");	
		$(this).find("img").animate({opacity: 1});
		
		/* Lines added for Retailer links*/
		
		setRetailers(imgRel);
		/* Lines ends for Retailer links*/
		
		
		
		
		
	});
	
	//nav prev/next
	$("#container-ownthegames .next").unbind("click");
	$("#container-ownthegames .next").click(function(){
		$("#container-ownthegames .nav").scrollTo('+=106px', 800);
	});
	$("#container-ownthegames .prev").unbind("click");
	$("#container-ownthegames .prev").click(function(){
		$("#container-ownthegames .nav").scrollTo('-=106px', 800);
	});
	
	//Hover - Description
	$("#container-ownthegames .description li a").hover(function(){
		var imgRel = $(this).attr("rel");
		$("#container-ownthegames .sidebar_content").hide();
		$("#container-ownthegames .sidebar ." + imgRel).show();
	});

                                                                                          //
// -------------------------------  END OWN THE GAME ------------------------------------ //
////////////////////////////////////////////////////////////////////////////////////////////	



////////////////////////////////////////////////////////////////////////////////////////////	
// ------------------------------  DISCOVER THE GAMES ----------------------------------- //
                                                                                          //

	//Default
	
	/*$("#container-discoverthegames .heading img.gow3").show();
	$("#container-discoverthegames .bottom .button div.gow3").show();
	$("#container-discoverthegames .largeimage img.gow3").show();
	$("#container-discoverthegames .header h3.gow3").show();
	$("#container-discoverthegames .description div.gow3").show();*/
	$("#container-discoverthegames .heading img.gowsparta").show();
	$("#container-discoverthegames .bottom .button div.gowsparta").show();
	$("#container-discoverthegames .largeimage img.gowsparta").show();
	$("#container-discoverthegames .header h3.gowsparta").show();
	$("#container-discoverthegames .description div.gowsparta").show();
	
	//Hover
	$("#container-discoverthegames .thumbnails a").hover(function(){
		var imgRel = $(this).attr("rel");
		$("#container-discoverthegames .heading img").hide();
		$("#container-discoverthegames .heading img." + imgRel).show();
		$("#container-discoverthegames .button div").hide();
		$("#container-discoverthegames .button div." + imgRel).show();
		$("#container-discoverthegames .largeimage img").hide();
		$("#container-discoverthegames .largeimage img." + imgRel).show();
		$("#container-discoverthegames .header h3").hide();
		$("#container-discoverthegames .header h3." + imgRel).show();
		$("#container-discoverthegames .description div").hide();
		$("#container-discoverthegames .description div." + imgRel).show();
	});
	
	//buy link 
	$("#container-discoverthegames .buy").click(function(){
		scrollObject("container-ownthegames");
	});
	
	//home container
	
	//video link
	$("#container-discoverthegames .bottom .videos").click(function(){
		scrollObject("container-videos");
	});

	//download button
	$("#container-discoverthegames .bottom .button .gowc").click(function(){
		scrollObject("container-ownthegames");
	});
	
	//download button
	$("#container-home .frame .content .banner_bottom").click(function(){
		//scrollObject("container-ownthegames");
	});
	
	//heavy metal button
	// Link to SpartansStandTall
	$("#container-discoverthegames .bottom .button .gow3").click(function(){
		scrollObject("container-music");
	});
	
	$("#container-discoverthegames .bottom .button .gowsparta").click(function(){
		
	 	window.open("http://www.spartansstandtall.com");
	});
                                                                                          //
// ----------------------------  END DISCOVER THE GAMES --------------------------------- //
////////////////////////////////////////////////////////////////////////////////////////////	


////////////////////////////////////////////////////////////////////////////////////////////
// --------------------------------------- NEWS ----------------------------------------- //
                                                                                     //

$("#container-news .latestnews a").click(function(){

    var linkrel = $(this).attr("rel");
	var el = $("div.article[title='" + linkrel + "']");
	 
	//var position = el.position(); 
	//$("#newscontent")[0].scrollBy(position.top);
	
});


                                                                                          //
// ------------------------------------- END NEWS --------------------------------------- //
////////////////////////////////////////////////////////////////////////////////////////////	



////////////////////////////////////////////////////////////////////////////////////////////
// ------------------------------------- DOWNLOADS -------------------------------------- //
                                                                                          //

	if(!isLTIE8){
		$("#container-downloads .latestupdates table img").css("opacity",0.5);
		$("#container-downloads .latestupdates table img").hover(function(){
			$(this).animate({opacity: 1});
		},function(){
			$(this).animate({opacity: 0.5});
		});
	}
	
	$("#container-downloads .latestupdates table a").click(function(){
		toggleInterface();
		showItem($(this).attr("rel"));
	});
		
	$("#container-downloads .maininterface .back").click(function(){
		toggleInterface();
	});
	
	//Default Item
	$("#container-downloads .maininterface .wallpapers").show();
	showGallery("wallpapers");
		
	$("#container-downloads .maininterface .menu ul li a").unbind().click(function(){
		var rel = $(this).attr("rel");
		showItem(rel);		
		reInit();
		//on state
		$("#container-downloads .maininterface .menu ul li a").removeClass("active");
		$(this).addClass("active");
	});

	                                                                                      //
// ---------------------------------- END DOWNLOADS ------------------------------------- //
////////////////////////////////////////////////////////////////////////////////////////////	


////////////////////////////////////////////////////////////////////////////////////////////
// ----------------------------------- MERCHANDISE -------------------------------------- //
                                                                                          //
	//Defaults
	merchandiseGetProducts("apparel");		
	$("#container-merchandise .menu ul li a[rel='apparel']").addClass("active");
	
	$("#container-merchandise .menu ul li a").unbind().click(function(){
		var rel = $(this).attr("rel");
		merchandiseGetProducts(rel);		
		reInit();
		//on state
		$("#container-merchandise .menu ul li a").removeClass("active");
		$(this).addClass("active");
	});

	                                                                                      //
// -------------------------------- END MERCHANDISE ------------------------------------- //
////////////////////////////////////////////////////////////////////////////////////////////	

	reInit();	
});


function merchandiseGetProducts(rel){

	//toggle nav
	if(merchandise[rel].length > 1){
		$("#container-merchandise .nav").show();
		$("#container-merchandise .next").show();
		$("#container-merchandise .prev").show();
	} else {
		$("#container-merchandise .nav").hide();
		$("#container-merchandise .next").hide();
		$("#container-merchandise .prev").hide();
	}

	var products = merchandise[rel];
	$("#container-merchandise .nav").html("<table align=\"left\"><tr></tr></table>");
	jQuery.each(products, function(){
		$("#container-merchandise .nav table tr").append("<td><a rel='" + this["id"] + "'><img style='background:url(" + this["image"].replace(".jpg","_tn.jpg") + ") no-repeat center center;' src='"+ucmRoot+"groups/public/documents/webasset/g3_pixel.gif'/></a></td>");
	});
	
	//show first item
	$("#container-merchandise .title").html(products[0]["title"]);
	$("#container-merchandise .description").html(products[0]["description"]);
	$("#container-merchandise .buy").html(products[0]["buy"]);
	$("#container-merchandise .items .image").css("background-image","url(" + products[0]["image"] + ")");

	$("#container-merchandise .items .nav a").click(function(){
		merchandiseGetItem(rel,$(this).attr("rel"));
	});

	//reset nav scroll
	$("#container-merchandise .nav").scrollTo(0);

	//nav prev/next
	$("#container-merchandise .next").unbind("click");
	$("#container-merchandise .next").click(function(){
		$("#container-merchandise .nav").scrollTo('+=106px', 800);
	});
	$("#container-merchandise .prev").unbind("click");
	$("#container-merchandise .prev").click(function(){
		$("#container-merchandise .nav").scrollTo('-=106px', 800);
	});

	//nav hover
	$("#container-merchandise .nav img").animate({opacity: 0.5});
	$("#container-merchandise .nav img").hover(function(){
		$(this).animate({opacity: 1});
	},function(){
		$(this).animate({opacity: 0.5});
	});

}

function merchandiseGetItem(cat,id){

	var products = merchandise[cat];
	var product = [];
	jQuery.each(products, function(){
		if(this["id"] == id){
			product = this;
		}
	});
	
	//reset current items
	$("#container-merchandise .title").html("");
	$("#container-merchandise .description").html("");
	$("#container-merchandise .items .image").css("background-image","");
	$("#container-merchandise .buy").html("");


	$("#container-merchandise .title").html(product["title"]);
	$("#container-merchandise .description").html(product["description"]);
	$("#container-merchandise .items .image").css("background-image","url(" + product["image"] + ")");
	$("#container-merchandise .buy").html(product["buy"]);

}


function scrollObject(contentID){

		
	if(debug){
		alert("scrollObject ased(" + contentID + ")");
	}

	if(contentID == undefined || contentID == ""){
	
		handleUndefined();
	}
	
	if((contentID != currentContentID || reposition == true) && contentID != undefined && onthemove == false){

		resetDesk(contentID);
		//retrieve original positioning
		var currPositions = origPositions[contentID].split("x");
		var origLeft = parseInt(currPositions[0]) + "px";
		var origTop = parseInt(currPositions[1]) + "px";

		onthemove = true;
		currentContentID = contentID;			
			
		if(reposition == false){
			$(".container").animate({opacity: 0}, 0, function(){
				$(this).css("overflow","hidden").height(0);
			});
		}
		
		var contentdiv = contentID;
		var leftpos = $("#" + contentdiv).css("left");
//		var toppos = $("#" + contentdiv).css("top");
		var leftpos = origLeft;
		var toppos = origTop;

		$("#" + contentdiv).css("left",origLeft);
		$("#" + contentdiv).css("top",origTop);
		
		//adjust to center
			var widthadj = (($(window).width() - contentViewportWidth)/2);
			origLeft = parseInt(currPositions[0]) - widthadj + "px";
		
		
		window.location.hash = getHash(contentID);		
		
		if($.browser.msie){	
			queueValue = true;
			if($.browser.version == "6.0"){
				$("#msgbrowser").show();
			}
		}
		
		if($("#viewport").height() < 768){
			$("#viewport").height(768);
		}
		
		setTimeout(function(){
			$("#viewport").scrollTo(
				{
					top:toppos,
					left:leftpos
				},
					1500,
				{
	
					onAfter: function(){
						onthemove=false;
						$("#" + contentID).css("overflow","visible").height(590).width(955).animate({opacity: 1}, 100);
						reposition = false;
					},
	
					easing:"easeInOutExpo",
					queue: queueValue
				}
			);
		}, 200);
		
		setCurrentURL();
		setCurrentTitle();

		if((initialLoad == false && reposition == false && headerloaded == true) || introplayedval){
			callToActionscript(contentID);
			
		} else {
			initialLoad = false;	
			
		}
		
		document.title = currentTitle + " - God of War III";
				
		reInit();
		

	}
}

function showGallery(rel){
	var data = downloads[rel];
	
	
	//show first image
	var img = data[0].replace(".jpg","_preview.jpg");
	$("#container-downloads .maininterface .items .preview").css("background-image","url(" + img + ")");
	//code for track
	if(localeSelected=="")
	{	
		$("#container-downloads .maininterface .items .preview").attr("onClick","javascript:pageTracker._trackPageview('/CTR/gow/download/" + img.substring(41) + " ');javascript: OmniTracker(this,'" + img.substring(41) + "','');return true;");
	}	
	else
	{	
		$("#container-downloads .maininterface .items .preview").attr("onClick","javascript:pageTracker._trackPageview('/CTR/gow/download/" + img.substring(41) + " ');return true;");
	}
	
	var previewImg = data[0];
	var imgID = 0;
	
	//reset nav scroll
	$("#container-downloads .maininterface .nav").scrollTo(0);

	//hide all other containers
	$("#container-downloads .maininterface .item").hide();

	//add nav items
	$("#container-downloads ." + rel).show();
	$("#container-downloads ." + rel + " .nav").html("<table><tr></tr></table>");
	//code for track
	
	if(localeSelected=="")
	{
		jQuery.each(data, function(i, val){
		
		$("#container-downloads ." + rel + "  .nav table tr").append("<td><a onClick=\"" + " javascript:pageTracker._trackPageview(\'ctr/download/"+ this.substring(41) +"   \');     javascript:OmniTracker(this,'" + this.substring(41) + "','');return true;\" ref='" + i + "' rel='" + this + "'><img style='background:url(" + this.replace(".jpg","_tn.jpg") + ") no-repeat top center;' src='"+ucmRoot+"groups/public/documents/webasset/g3_pixel.gif'/></a></td>");	
		});
	}
	else
	{	
		jQuery.each(data, function(i, val){
		$("#container-downloads ." + rel + "  .nav table tr").append("<td><a   onClick=\"" + " javascript:pageTracker._trackPageview(\'ctr/download/"+ this.substring(41) +"   \');     return true;\"                             ref='" + i + "' rel='" + this + "'           ><img style='background:url(" + this.replace(".jpg","_tn.jpg") + ") no-repeat top center;' src='"+ucmRoot+"groups/public/documents/webasset/g3_pixel.gif'/></a></td>");	
		});
		
	
	}

	//nav click bind
	$("#container-downloads .maininterface .items .gallery .nav a").click(function(){
		imgID = $(this).attr("ref");
		var img = $(this).attr("rel").replace(".jpg","_preview.jpg");
		$("#container-downloads .maininterface .items .preview").css("background-image","url(" + img + ")");
		previewImg = $("#container-downloads .maininterface .items .preview").css("backgroundImage").replace("_preview","").replace("url(","").replace(")","");		
		
	});
		
	//nav prev/next
	$("#container-downloads .maininterface .next").unbind("click");
	$("#container-downloads .maininterface .next").click(function(){
		$("#container-downloads .maininterface .nav").scrollTo('+=106px', 800);
	});
	$("#container-downloads .maininterface .prev").unbind("click");
	$("#container-downloads .maininterface .prev").click(function(){
		$("#container-downloads .maininterface .nav").scrollTo('-=106px', 800);
	});
	
	//Lightbox
	$("#container-downloads .maininterface .items .preview").click(function(){
		$("#overlay").css("opacity", "0.95");
		$("#overlay").height($(document).height());
		$("#overlay").fadeIn();
		$("#overlay-content").show();
		$("#overlay-content .image").html("<img src=" + previewImg + " />");
		$("#overlay-content .image img").unbind();
		$("#overlay-content .nav .close").click(function(){
			$("#overlay").fadeOut();
			$("#overlay-content").fadeOut();
			$("#agree-window").fadeOut();
		});
		$("#overlay-content .nav .next").unbind().click(function(){
			if((parseInt(imgID) + 1) > (data.length - 1)){
				imgID = 0;
			} else {
				imgID = (parseInt(imgID) + 1);
			}
			$("#overlay-content .image img").attr("src",data[imgID]);
		});
		$("#overlay-content .nav .prev").unbind().click(function(){
			if((parseInt(imgID) - 1) < 0){
				imgID = data.length - 1;
			} else {
				imgID = (parseInt(imgID) - 1);
			}
			$("#overlay-content .image img").attr("src",data[imgID]);
		});
		$("#overlay-content .nav .download").unbind("click").click(function(){
			$("#agree-window").fadeIn();
		});
		$("#agree-content .yes").unbind().click(function(){
			window.open(previewImg);

			
			$("#agree-window").fadeOut();
			
			
			pageTracker._trackPageview('ctr/download/agree/'+previewImg.substring(41));    
			if(localeSelected=="")
			{
			 	OmniTracker(this,'agree/'+previewImg.substring(41),'');
			}
			 return false;
			
			
			
		});
		
		$(".yesdownlad").unbind().click(function(){
			window.open(previewImg);

			pageTracker._trackPageview('ctr/download/agree/'+previewImg.substring(41));    
			if(localeSelected=="")
			{
			 	OmniTracker(this,'agree/'+previewImg.substring(41),'');
			}
			 return false;
			
		});
	
	
		$("#agree-content .no").unbind().click(function(){
			$("#agree-window").fadeOut();
		});
	});
	
	
	
		
		
	//nav hover
		if(!isIE6){
		$("#container-downloads .maininterface .nav img").animate({opacity: 0.5});
		$("#container-downloads .maininterface .nav img").hover(function(){
			$(this).animate({opacity: 1});
		},function(){
			$(this).animate({opacity: 0.5});
		});	
	}	
	
	//wallpaper-specific interface
	if(rel == "wallpapers"){
			
		$("#container-downloads .maininterface .items .preview").unbind("click");
		if(!isLTIE8){
			$("#container-downloads .maininterface .items .links").animate({opacity:0.8});
		}

		//default
		$("#container-downloads .maininterface .items .links .sizes").html("");
		//code for track
		
		if(localeSelected=="")
		{
			jQuery.each(sizes, function(){
				$("#container-downloads .maininterface .items .links .sizes").append("<span><a target=\"_blank \" onClick=\"" + "javascript:pageTracker._trackPageview('ctr/download/wallpaper/"  + (getSize(previewImg, this)).substring(41)+  "');javascript:OmniTracker(this,'gow\\download\\wallpaper"  + (getSize(previewImg, this)).substring(41)+  "','');return true;\"  href=\"" + getSize(previewImg, this) + "\")>" + this + "</a></span>");
			});
		}
		else
		{		
			jQuery.each(sizes, function(){
				$("#container-downloads .maininterface .items .links .sizes").append("<span><a target=\"_blank \" onClick=\"" + "javascript:pageTracker._trackPageview('ctr/download/wallpaper/"  + (getSize(previewImg, this)).substring(41)+  "');return true;\"  href=\"" + getSize(previewImg, this) + "\")>" + this + "</a></span>");
			});		
		}
		
		$("#container-downloads .maininterface .preview").hover(function(){
			$("#container-downloads .maininterface .items .links").show();
			$("#container-downloads .maininterface .items .links .sizes").html("");
			//code for track
			
			if(localeSelected=="")
			{
				jQuery.each(sizes, function(){
					$("#container-downloads .maininterface .items .links .sizes").append("<span><a target=\"_blank \" onClick=\"" + "javascript:pageTracker._trackPageview('ctr/download/wallpaper/"  + (getSize(previewImg, this)).substring(41)+  "');javascript:OmniTracker(this,'gow\\download\\wallpaper"  + (getSize(previewImg, this)).substring(41)+  "','');return true;\"  href=\"" + getSize(previewImg, this) + "\")>" + this + "</a></span>");
				});
			}
			else
			{			
				jQuery.each(sizes, function(){
					$("#container-downloads .maininterface .items .links .sizes").append("<span><a target=\"_blank \" onClick=\"" + "javascript:pageTracker._trackPageview('ctr/download/wallpaper/"  + (getSize(previewImg, this)).substring(41)+  "');return true;\"  href=\"" + getSize(previewImg, this) + "\")>" + this + "</a></span>");
				});			
			}
		},function(){
			$("#container-downloads .maininterface .items .links").hide();
		});
		
	}	

}


function addHistory(contentID){
	$.history.add(contentID);
}

function callToActionscript(str) {
	if(debug){
		alert("callToActionScript()");
	}
	if(headerloaded == true){
		getFlashMovie("header").setNavHighlight(str);
	}
	killFlashVideos();
}

function killFlashVideos(){
	if(debug){  
		alert("killFlashVideos()");
	}
	jQuery.each(jQuery.browser, function(i, val) {
		if(i != "mozilla" && jQuery.browser.version.substr(0,3) != "1.9"){
			if (videoloaded == true){
				getFlashMovie("content-videos").killVideo();
			}
			if (bannerloaded == true){
				getFlashMovie("banner-home").killVideo();
			}
			if(musicloaded == true){
				getFlashMovie("content-music").ultimateKill();
			}
		}
	});
}

function getFlashMovie(movieName) {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[movieName] : document[movieName];
}

function getHash(contentID){
	for (var i in relHashContent){
		var value = relHashContent[i];
		if(value == contentID){
			return i;
		}
	}
}

function getSize(img, size){
	arr = size.split("x");
	img = img.replace(".jpg","_" + arr[0] + ".jpg");
	return(img);
}

function getVideoID(){
	return currentVideoID;
}

function reInit(){	
	var browser=navigator.appName;
	if(browser != "PLAYSTATION 3" ){	
	//$(".scrollpane").jScrollPane({ reinitialiseOnImageLoad:true, animateTo:true, dragMinHeight: 35, dragMaxHeight: 35, scrollbarWidth: 35});		
	$(".scrollpane").jScrollPane({ dragMinHeight: 35, dragMaxHeight: 35, scrollbarWidth: 35});
	}
}

function requestCurrentContentID(){
	if(debug){
		alert("requestCurrentContentID()");
	}
	headerLoaded();	
	return currentContentID;
}

function setVideoID(id){
	currentVideoID = id;
	setCurrentURL();
}

function setCurrentURL(){
	currentURL = rootURL + "/%23" + getHash(currentContentID);
	if (getHash(currentContentID) == "Videos"){
		currentURL = currentURL + "-" + currentVideoID;
	}
}

function OmniTracker(obj,sName,HtBxParam)
	{
		//var s=s_gi('sceapsogsprod');
		s.events='event2';
		s.linkTrackVars='events';		
		s.linkTrackEvents='event2';
		s.pageName='GOW/'+window.location.hash.split('#')[1]+'/'+sName;
		s.tl(obj,'o',sName);
	}
 

function setCurrentTitle(){ 

	document.getElementById('validemail').innerHTML="";
	document.getElementById('validdob').innerHTML="";
	document.getElementById('signup').value="Enter Email"; 
	document.getElementById('month').value="MM";
	document.getElementById('day').value="DD";
	document.getElementById('year').value="YYYY";
	document.getElementById('success').value="";	
	document.getElementById('month').style.border="solid #FFCC00 1px";
	document.getElementById('day').style.border="solid #FFCC00 1px";
	document.getElementById('year').style.border="solid #FFCC00 1px";
	
	document.getElementById('signup').style.border="solid #FFCC00 1px";


currentTitle = getHash(currentContentID).replace("/-/g"," ");

//************ This code is for Omniature tracking *************************/
if(localeSelected=="")
{

s.pageName="GOW/"+window.location.hash.split('#')[1];
	s.server=""
	s.channel="GOW"
	s.pageType=""
	s.referrer=""
	s.prop1=""
	s.prop2=""
	s.prop3=""
	s.prop4=""
	s.prop5=""
	s.prop6=""
	s.prop7=""
	s.prop8=""
	s.prop9=""
	s.prop10=""
	s.prop30='http://'+window.location.host+'/';
	s.campaign=""
	s.state=""
	s.zip=""
	s.events=""
	s.products=""
	s.purchaseID=""
	s.transactionID=""
	s.eVar1=""
	s.eVar2=""
	s.eVar3=""
	s.eVar4=""
	s.eVar5=""
	s.eVar6=""
	s.eVar7=""
	s.eVar8=""
	s.eVar9=""
	s.eVar10=""
	s.hier1=""
	var s_code=s.t();
	if(s_code)document.write(s_code)
}
//*************End of Omniature tracking code *****************************/
	
}

function showItem(rel){
	$("#container-downloads .maininterface .item").hide();
	$("#container-downloads .maininterface ." + rel).show();
	if(rel == "wallpapers" || rel == "screenshots" || rel == "conceptart"){
		showGallery(rel);
	}
	$("#container-downloads .maininterface .menu ul li a").removeClass("active");
	$("#container-downloads .maininterface .menu ul li a[rel=" + rel + "]").addClass("active");
}

function toggleInterface(){
	$("#container-downloads .latestupdates").toggle();
	$("#container-downloads .maininterface").toggle();
}

function headerLoaded(){
	if(debug){
		alert("headerLoaded()");
	}
	headerloaded = true;
	
	scrollObject(scrollToLocation);
}

function videoLoaded(){
	if(debug){
		alert("videoLoaded()");
	}
	videoloaded = true;
}

function bannerLoaded(){
	if(debug){
		alert("bannerLoaded()");
	}
	bannerloaded = true;
	
}

function introLoaded(){
	if(debug){
		alert("introLoaded()");
	}
	introloaded = true;
	if(formsloaded != true){
		loadForms();
	}
}
function musicLoaded(){
	if(debug){
		alert("musicLoaded()");
	}
	musicloaded = true;
}
function everythingLoaded(){

	if(debug){
		alert("everythingLoaded()");
	}
	introplayedval = introplayed.reader();

	loadForms();
	$("#intro").css("background","transparent");
	$("body").css("background-image","url("+ucmRoot+"groups/public/documents/webasset/g3_bg_tile.jpg)");
}

function slideHeader() {
  if(!isIE6){
		var browser = navigator.appName;
		if($.browser.safari || browser == "PLAYSTATION 3" || ($.browser.opera && parseFloat($.browser.version) < 9.8)){
			$("#header-container").css("top",0);
		} else {
			$("#header-container").animate({top: "0"});
		}
	}
}
function adjustViewport(){
	$("#viewport").height($(window).height()-browserWindowBuffer);
	if($("#viewport").height() < 768){
		$("#viewport").height(768);
	}
	$("#viewport").width($(window).width());
	$("#overlay").height($(document).height());
	$("#intro").height($(document).height());
	//reposition = true;
	scrollObject(currentContentID);
}

function handleUndefined(){
	scrollToLocation = $(".container-default").attr("id");
	scrollObject(scrollToLocation);
}

function setupDesk(){
	//debugLog("setupDesk()");
	var debugMsg = "";
	$(".container").each(function(){
		var currLeft = $(this).css("left").replace("px","");
		var currTop = $(this).css("top").replace("px","");
		var newLeft = 2600;
		var newTop = 0;
		$(this).css("top", newTop);
		$(this).css("left", newLeft);
		var elId = $(this).attr("id");
		origPositions[elId] = currLeft + "x" + currTop;
		//debugMsg = debugMsg + elId + ": " + origPositions[elId] + "\n";
	});
	//debugLog(debugMsg);
	return false;
}


function resetDesk(cid){
	//debugLog("resetDesk(" + cid + ")");	
	var debugMsg = "";	
	$(".container").each(function(){
		var elId = $(this).attr("id");
		if(elId != cid){
			var currPositions = origPositions[elId].split("x");
			var newLeft = "2600px";
			var newTop = "0px";
			$(this).css("top", newTop);
			$(this).css("left", newLeft);
			if(reposition == false){
				$(this).css("overflow","hidden").height(0);
			}
		//	debugMsg = "elid: " + elId + " currPosition: " + origPositions[elId] + "\n";
		//	debugLog(debugMsg);
		}
	});
	return false;
}


function voidlink(){

}


function setPendora()
{

$("#container-ownthegames .content .sidebar .pandorasbox").show();
$("#container-ownthegames .frame").css("background-image","url("+ucmRoot+"groups/public/documents/webasset/g3_bg_ownthegames.png)");
		$("#container-ownthegames .sidebar").show();
		
		//$("#container-ownthegames .content .sidebar .pandorasbox").show();
}

function setEmpty()
{
//$("#container-ownthegames .sidebar_content").hide();
//$("#container-ownthegames .frame").css("background-image","url("+ucmRoot+"groups/public/documents/webasset/g3_bg_ownthegames_off.png)");
	//	$("#container-ownthegames .sidebar").hide();
}


/* Lines added for Retialers*/

function setRetailers(imgRel){
	if(imgRel == "gow3"){
	
		$("#container-ownthegames .retailers .nav a.amazon").attr("href","http://www.amazon.com/exec/obidos/ASIN/B000ZK9QCS/ref=nosim/6553221-rg1864-00-20");
		$("#container-ownthegames .retailers .nav a.bestbuy").attr("href","http://www.bestbuy.com/site/olspage.jsp?id=pcmcat196500050006&type=category");
		$("#container-ownthegames .retailers .nav a.gamestop").attr("href","http://www.gamestop.com/Catalog/ProductDetails.aspx?sku=270204&affID=77777&sourceID=RJcopG_LB_Q-YoruRfJpYeYZ2OZItMpfcw");
		$("#container-ownthegames .retailers .nav a.gamecrazy").attr("href","http://www.gamecrazy.com/storelocator/mappoint.aspx#startaddress");
		
		$("#container-ownthegames .retailers .nav a.amazon").attr("onClick","javascript:pageTracker._trackPageview('/CTR/gow_OwnTheGame/gow3amazon');javascript: OmniTracker(this,'gow/OwnTheGame/gow3amazon','');return true;");
		$("#container-ownthegames .retailers .nav a.bestbuy").attr("onClick","javascript:pageTracker._trackPageview('/CTR/gow_OwnTheGame/gow3bestbuy');javascript: OmniTracker(this,'gow/OwnTheGame/gow3bestbuy','');return true;");
		$("#container-ownthegames .retailers .nav a.gamestop").attr("onClick","javascript:pageTracker._trackPageview('/CTR/gow_OwnTheGame/gow3gamestop');javascript: OmniTracker(this,'gow/OwnTheGame/gow3gamestop','');return true;");
		$("#container-ownthegames .retailers .nav a.gamecrazy").attr("onClick","javascript:pageTracker._trackPageview('/CTR/gow_OwnTheGame/gow3gamescrazy');javascript: OmniTracker(this,'gow/OwnTheGame/gow3gamescrazy','');return true;");
		
		$("#container-discoverthegames .frame .content .left .buy").attr("onClick","javascript:pageTracker._trackPageview('/CTR/dicover-the-game/gow3buy');javascript: OmniTracker(this,'gow/Dicover-the-game/gow3buy','');return true;");
		
	}

	if(imgRel == "gowsparta"){
	
	
		$("#container-ownthegames .retailers .nav a.amazon").attr("href","http://www.amazon.com/God-War-Ghost-Sparta-Sony-PSP/dp/B003L51GW2/ref=sr_1_1?ie=UTF8&s=videogames&qid=1274897009&sr=8-1");
		$("#container-ownthegames .retailers .nav a.bestbuy").attr("href","http://www.bestbuy.com/");
		$("#container-ownthegames .retailers .nav a.gamestop").attr("href","http://www.gamestop.com/Catalog/ProductDetails.aspx?product_id=77807");
		$("#container-ownthegames .retailers .nav a.gamecrazy").attr("href","http://www.gamecrazy.com/games/game.aspx?id=14833&LF=STL");
		
		$("#container-ownthegames .retailers .nav a.amazon").attr("onClick","javascript:pageTracker._trackPageview('/CTR/gow_OwnTheGame/gowspartaamazon');javascript: OmniTracker(this,'gow/OwnTheGame/gowspartaamazon','');return true;");
		$("#container-ownthegames .retailers .nav a.bestbuy").attr("onClick","javascript:pageTracker._trackPageview('/CTR/gow_OwnTheGame/gowspartabestbuy');javascript: OmniTracker(this,'gow/OwnTheGame/gowspartabestbuy','');return true;");
		$("#container-ownthegames .retailers .nav a.gamestop").attr("onClick","javascript:pageTracker._trackPageview('/CTR/gow_OwnTheGame/gowspartagamestop');javascript: OmniTracker(this,'gow/OwnTheGame/gowspartagamestop','');return true;");
		$("#container-ownthegames .retailers .nav a.gamecrazy").attr("onClick","javascript:pageTracker._trackPageview('/CTR/gow_OwnTheGame/gowspartagamemedia');javascript: OmniTracker(this,'gow/OwnTheGame/gowspartagamescrazy','');return true;");
	}

	if(imgRel == "gowc"){
	
		$("#container-ownthegames .retailers .nav a.amazon").attr("href","http://www.amazon.com/exec/obidos/ASIN/B002NN7AKU/ref=nosim/6553221-rg1864-00-20");
		$("#container-ownthegames .retailers .nav a.bestbuy").attr("href","http://www.bestbuy.com/site/olspage.jsp?id=pcmcat196500050006&type=category");
		$("#container-ownthegames .retailers .nav a.gamestop").attr("href","http://www.gamestop.com/browse/search.aspx?N=0&Ntk=TitleKeyword&Ntx=mode+matchallpartial&Ntt=god%20of%20war%20collection");
		$("#container-ownthegames .retailers .nav a.gamecrazy").attr("href","http://www.gamecrazy.com/games/game.aspx?id=14623&LF=STL");
		
		$("#container-ownthegames .retailers .nav a.amazon").attr("onClick","javascript:pageTracker._trackPageview('/CTR/gow_OwnTheGame/gowcamazon');javascript: OmniTracker(this,'gow/OwnTheGame/gowcamazon','');return true;");
		$("#container-ownthegames .retailers .nav a.bestbuy").attr("onClick","javascript:pageTracker._trackPageview('/CTR/gow_OwnTheGame/gowcbestbuy');javascript: OmniTracker(this,'gow/OwnTheGame/gowcbestbuy','');return true;");
		$("#container-ownthegames .retailers .nav a.gamestop").attr("onClick","javascript:pageTracker._trackPageview('/CTR/gow_OwnTheGame/gowcgamestop');javascript: OmniTracker(this,'gow/OwnTheGame/gowcgamestop','');return true;");
		$("#container-ownthegames .retailers .nav a.gamecrazy").attr("onClick","javascript:pageTracker._trackPageview('/CTR/gow_OwnTheGame/gowcgamescrazy');javascript: OmniTracker(this,'gow/OwnTheGame/gowcgamescrazy','');return true;");
		
		$("#container-discoverthegames .frame .content .left .buy").attr("onClick","javascript:pageTracker._trackPageview('/CTR/gow/discover-the-game/gowcbuy');javascript: OmniTracker(this,'gow/discover-the-game/gowcbuy','');return true;");
	}
}


function setImage(imgRelative)
{
	if(imgRelative == "gow3")
	{
	document.getElementById("gowREL1").src=ucmRoot+'groups/public/documents/webasset/g3_own_gow3_large.jpg';
	//document.getElementById("s1").
   
	$("#container-ownthegames .content .description .gowsparta").hide();
	 $("#container-ownthegames .content .headings h3.gowsparta").hide();
	
	$("#container-ownthegames .content .description .gow3").show();
	$("#container-ownthegames .content .headings h3.gow3").show();
	$("#container-ownthegames .sidebar_content").hide();
	
	$("#container-ownthegames .games .nav img").css("opacity",0.5);
    $("#container-ownthegames .games .nav img").css("border-color","#F00");
	
		document.getElementById('s1').style.border="1px solid #FF0000";
		document.getElementById('s1').style.opacity="1";
	}
	else if(imgRelative == "gowc")
	{
	
	
	//  document.getElementById("s2.").    
	     $("#container-ownthegames .content .description .gowsparta").hide();
	 $("#container-ownthegames .content .headings h3.gowsparta").hide();

     $("#container-ownthegames .content .description .gowc").show();
	$("#container-ownthegames .content .headings h3.gowc").show();
	$("#container-ownthegames .sidebar_content").hide();
	$("#container-ownthegames .sidebar").hide();
	
	$("#container-ownthegames .games .nav img").css("opacity",0.5);
    $("#container-ownthegames .games .nav img").css("border-color","#F00");
	$("#container-ownthegames .frame").css("background-image","url("+ucmRoot+"groups/public/documents/webasset/g3_bg_ownthegames_off.png)");
		document.getElementById('s3').style.border="1px solid #FF0000";
		document.getElementById('s3').style.opacity="1";
		document.getElementById("gowREL1").src=ucmRoot+'groups/public/documents/webasset/g3_own_gowc_large.jpg';
	
	
	
	}
	
	else if(imgRelative == "gowsparta")
	{
	
	
	//  document.getElementById("s2.").    
	    $("#container-ownthegames .content .description .gowsparta").show();
	 $("#container-ownthegames .content .headings h3.gowsparta").show();
 	$("#container-ownthegames .content .description .gow3").hide();
	 $("#container-ownthegames .content .headings h3.gow3").hide();
     $("#container-ownthegames .content .description .gowc").hide();
	$("#container-ownthegames .content .headings h3.gowc").hide();
	$("#container-ownthegames .sidebar_content").hide();
	$("#container-ownthegames .sidebar").hide();
	
	$("#container-ownthegames .games .nav img").css("opacity",0.5);
    $("#container-ownthegames .games .nav img").css("border-color","#F00");
	$("#container-ownthegames .frame").css("background-image","url("+ucmRoot+"groups/public/documents/webasset/g3_bg_ownthegames_off.png)");
		document.getElementById('s2').style.border="1px solid #FF0000";
		document.getElementById('s2').style.opacity="1";
		document.getElementById("gowREL1").src=ucmRoot+'groups/public/documents/webasset/g3_discover_sparta_large.jpg';
	
	
	
	}
	
	
	
	
	
}


function localeSelecter(localeSelect)
{
	localeSelected=localeSelect;
	
}

function ukRetailerLinks(gameSelected)
{
	
	if(gameSelected=="gow3")
	{
		
		
		$("#container-ownthegames .retailers .nav a.ukamazon").attr("onClick","javascript:pageTracker._trackPageview('/CTR/gow_OwnTheGame/gow3_amazon');return true;");
		$("#container-ownthegames .retailers .nav a.ukgame").attr("onClick","javascript:pageTracker._trackPageview('/CTR/gow_OwnTheGame/gow3_game');return true;");
		$("#container-ownthegames .retailers .nav a.ukplay").attr("onClick","javascript:pageTracker._trackPageview('/CTR/gow_OwnTheGame/gow3_play');return true;");
	}	
	else if(gameSelected=="gowue")
	{
	$("#container-ownthegames .retailers .nav a.ukamazon").attr("onClick","javascript:pageTracker._trackPageview('/CTR/gow_OwnTheGame/gowsparta_amazon');return true;");
	$("#container-ownthegames .retailers .nav a.ukgame").attr("onClick","javascript:pageTracker._trackPageview('/CTR/gow_OwnTheGame/gowsparta_game');return true;");
	$("#container-ownthegames .retailers .nav a.ukplay").attr("onClick","javascript:pageTracker._trackPageview('/CTR/gow_OwnTheGame/gowsparta_play');return true;");
		
	}
	else
	{
	$("#container-ownthegames .retailers .nav a.ukamazon").attr("onClick","javascript:pageTracker._trackPageview('/CTR/gow_OwnTheGame/gowc_amazon');return true;");
	$("#container-ownthegames .retailers .nav a.ukgame").attr("onClick","javascript:pageTracker._trackPageview('/CTR/gow_OwnTheGame/gowc_game');return true;");
	$("#container-ownthegames .retailers .nav a.ukplay").attr("onClick","javascript:pageTracker._trackPageview('/CTR/gow_OwnTheGame/gowc_play');return true;");
		
	}
}



/*This file is changed for Stop Script error. */


