
	var version="20090720";
	var $name="";
	var $w=0;
	var $h=0;
	var $params={};
	var $gameatr={};
	
	
	window.onbeforeunload=function(){
		if(thisMovie("swfobj_game") && thisMovie("swfobj_game").sfs_disconnect != undefined )
		{
			thisMovie("swfobj_game").sfs_disconnect();
		}
		navTo("disconnect");
	}

    var globalSWFFilePath = "";
    //globalSWFFilePath = "http://m3.nflrush.com/dev";
	//globalSWFFilePath = "http://m3.nflrush.com/beta";
	globalSWFFilePath = "http://m3.nflrush.com/live";
	
	//alert(curUrl);
	if(curUrl==""){
		//alert(window.location.pathname);
		curUrl=window.location.pathname.substr(5);
		curUrl=(curUrl=="/")?"":curUrl;
	}
	  
		  var debugString="";
		  var debug=true;
		
	     var asdebug=function(s){
             if(window.location.href.indexOf("dejsbug")!=-1 || window.location.href.indexOf("dev.nfl.")!=-1){
							
				debugString=s+"\n";
				if($("asbug") && debug){
				var a=$("asbug");
				a.value+=debugString;
				a.style.display="";
				}

				}
          }
		
		function stopDebug(){
			
			debug=false;
		}

		 

		  //swfobject start

		 var params = { 
			quality:"high",
			play:"true",
			loop:"true",
			scale:"showall",
			//Pamila
			wmode:"transparent",
			devicefont:"false",
			bgcolor:"#ffffff",
			menu:"false",
			allowFullScreen:"false",
			allowScriptAccess:"always",
			salign:""
		};
		
		 
		var footeratr = {
			align:"middle",
			id:"nav_footer",
			name:"nav_footer"
		};

		var headatr = {
			align:"middle",
			id:"nav_head",
			name:"nav_head"
		};

		var mainparams = { 
			quality:"high",
			flashvars:"curUrl="+curUrl+"&lastUrl="+lastUrl+"&curPrames="+curPrames+"&curFrom="+curFrom+"&isChallenge="+isChallenge+"&challengeInfo="+challengeInfo+"&version="+version+"&globalSWFFilePath="+globalSWFFilePath,
			play:"true",
			loop:"true",
			scale:"showall",
			//Pamila
			wmode:"transparent",
			devicefont:"false",
			bgcolor:"#ffffff",
			menu:"false",
			allowFullScreen:"false",
			allowScriptAccess:"always",
			salign:""
		};

		var mainatr = {
			align:"middle",
			id:"main",
			name:"main"
		};

		var rzgamePoptr= {
			align:"middle",
			id:"rzgameExitPop",
			name:"rzgameExitPop"
		
		};

		var rzparams = { 
			quality:"high",
			play:"true",
			loop:"true",
			scale:"showall",
			//Pamila
			wmode:"transparent",
			//wmode:"window",
			devicefont:"false",
			menu:"false",
			allowFullScreen:"false",
			allowScriptAccess:"always",
			salign:""
		};
		//swfobject.embedSWF("/play/rzgamePopWindow.swf", "rzbowlExitPopupDiv", "250", "280", "9.0.0", "expressInstall.swf",false,rzparams,rzgamePoptr);
		//swfobject.embedSWF("/play/rzgamePopWindow.swf", "rzbowlExitPopup", "250", "280", "9.0.0", "expressInstall.swf",false,rzparams,rzgamePoptr);
		
        swfobject.embedSWF(globalSWFFilePath+"/play/nav_head.swf", "swfobj_header", "996", "142", "9.0.0", "expressInstall.swf",false,params,headatr);
		swfobject.embedSWF(globalSWFFilePath+"/play/FlashUniversial.swf", "swfobj_main", "996", "750", "9.0.0", "expressInstall.swf",false,mainparams,mainatr);
		swfobject.embedSWF(globalSWFFilePath+"/play/nav_footer.swf", "swfobj_footer", "996", "53", "9.0.0", "expressInstall.swf",false,params,footeratr);
		
		
		 //swfobject end

	
		//history javascript start
		

		var applicationMovieClipName="main";

		function addHistory (newHash)
		{
			//unFocus.History.addHistory(newHash.toString());
			//window.document.title="NFLRZ";
		}

		function onHistoryChange (newHash)

		{
			//thisMovie(applicationMovieClipName).addressBarNavigated(newHash);
		}

		

		function getFlashVarsFromHash () 
		{

			var result = "";

			if(location.hash != "")
			{
			result = location.hash;
			result = result.replace("#","");
			}

			return result;
		}

		//unFocus.History.addEventListener('historyChange', onHistoryChange);

		//history javascript end

		//play page javascript start

          var curGame="";
		  var gameChallenge=false;





          function showhead(){    
          	document.getElementById("nav_div").style.display="";
          	thisMovie("main").style.width="996px";
          	thisMovie("main").style.height="620px";
          }

		  	//External Link

		function linkExternal(){
			var url=location.href;
			/*
			var arrUrl=url.split("/");
			var l=arrUrl.length;
			var s="";
			for(i=3; i<l; i++){
				s+=arrUrl[i];
			}
			alert(s);
			*/
			if(url.indexOf("=")!=-1){
				return url.substring(url.indexOf("=")+1,url.length).replace("&","%26");
			}else{
				return "-1";
			}

		}

          function upgrade(){
          	window.location.href="https://nflrz.nflrush.com/Myaccount/changecreditview";
          }

		

          function activeAccount(){
			//active account
          	window.location.href="/login/active";
          }

		  function errorPage(){
			window.location.href="/errorpage/error.php";
		  }


		  
         function logout(a){
			var url=location.href;
			var logoutUrl="";
			
			if(url.indexOf("?")!=-1){
				var linkPrarm=url.substring(url.indexOf("?")+1,url.length);
				logoutUrl="/login/logout/?"+linkPrarm;
			}else{
				logoutUrl="/login/logout";
			}
          	window.location.href=logoutUrl;

          }


          function link(s){
          	if(s!=""){
          	var t=s.lastIndexOf(":");
          	var target=s.substr(t+1);
          	var url=s.substring(0,t);
          	if(target=="_self"){
          		window.location.href=url;
          		}else if(target=="_blank"){
          		window.open(url);
          		}
          	}
          }

		function exitGame(){
			navTo("nothing");
		}

		function exitRzbowlGame(b)
		{
			if(b)
			{
				goHistory();
			}
			else
			{
				$("rzbowlExitPopup").style.display="none";
			}
		}


		function forceExitGame(){ navTo("forceback")}

          var picstatus="avatar"; 

          function navTo(act){

					var curGameTemp=curGame;
					if(act=="disconnect"){
						try{
							thisMovie("main").jscall(act);
						}catch(e){
						
						}
					}
					if(act!="forceback"&&act!="disconnect"){
						//if(curGame=="/games/game/rz.bowl.v1.0.0.swf"){
						if(curGame.indexOf("/rz.bowl.")!=-1){
							//change exit rzbowlgame confirm to pop up swf
							$("rzbowlExitPopup").style.display="block";
							return;
							/*
							if(confirm("Really exit challenge?")){
								//thisMovie("main").jscall("exitChallenge");
								goHistory();

								return;
							}else{
								return;
							}
							*/
						 }
					}else{
						act="nothing";
					}

					
				   if(picstatus!="avatar"){
			
					document.getElementById("game_swf").style.display="none";

					if(gameChallenge && act=="nothing"){
														
								if(lastUrl.indexOf("challenge/selectgame")!=-1){
									submitUrl([ctrUrl(last2Url),[1,1,challengeInfo]],1);
								}else{
									submitUrl([ctrUrl(lastUrl),[1,1,challengeInfo]],1);
								}
								
								return;

					}
					
					gameswf(swfUrl + "/games/empty",600,600);
					thisMovie("main").style.width="996px";
					thisMovie("main").style.height="620px";
					document.getElementById("main_swf").style.marginLeft="0px";
					document.getElementById("main_swf").style.width="996px";
					document.getElementById("main_swf").style.height="620px";
					
						picstatus="avatar";
						curGame="/games/empty.swf";

						goHistory();
		
				   }

				   updateSession();
				
				  if(act!="nothing"){
					if(act=="highscores"){
						thisMovie("main").jscall(act,curGameTemp);
					}else if(act.indexOf("event:")==0){
						//alert(act);
						thisMovie("main").jscall("event",act.substr(6));
					}else{
						thisMovie("main").jscall(act);
					}
				}
		

          }

		  function ctrUrl(url){
			var l=url.indexOf("/play/");
			return url.substr(l+5);
		  }

          var profileStr=" $$$$$ $$$$$4";
          function setNav(s){
            profileStr=s;
          	window.setTimeout(updateNav,1800);
          }

          function updateNav(){
		  try{
          //thisMovie("nav_head").setinfo(profileStr);
          //thisMovie("nav_footer").setinfo(profileStr);
          var tempSubscriptionId = 0;
          if( subscriptiontypeid != undefined )
            tempSubscriptionId = subscriptiontypeid;
          thisMovie("nav_footer").setinfo(tempSubscriptionId);
          }catch(e){
			///alert(e)
		  }
          }
          
          function updateSession(){
			 try{
				thisMovie("main").jscall("updatesession");
			 }catch(e){
			 }
			}
          
          
          function thisMovie(movieName) {
                   if (navigator.appName.indexOf("Microsoft") != -1) {
                       return window[movieName];
                   } else {
                       return document[movieName];
                   }
               }
          
          var showNum=0;
          
          function $(s){return document.getElementById(s);}
          
          
          function gameswf(swf,w,h,id){
			  asdebug("gameswf"+swf)
				var vars="";
				if(swf.indexOf("?")!=-1){
					vars=swf.split("?")[1];
				}
				
				vars+=((vars=="")?"":"&")+"version="+version;
				//alert(vars);
				swf=swf.split(".swf")[0];
				if(w==undefined||w==0){w=600};
				if(h==undefined||h==0){h=600};
				if(swf==""||swf==undefined){swf=globalSWFFilePath + "/games/empty"};
				if(id==undefined){id="gamecontent"};
				
				var params = { 
					quality:"high",
					flashvars:vars+"&ip=74.63.14.74&port=9339&zone=40yards&globalSWFFilePath="+globalSWFFilePath,
					play:"true",
					loop:"true",
					scale:"showall",
					wmode:"window",
					devicefont:"false",
					bgcolor:"#003466",
					menu:"false",
					allowFullScreen:"false",
					allowScriptAccess:"always",
					salign:""
				};

				var gameatr = {
					align:"middle"

				}
                
                /*
                 * Appended nflrz/nflrush.com to all game SWFs
                */
                var swfName = swf.replace("..","")+".swf";
                swfName = globalSWFFilePath + swfName;
                /*#################################################*/
                
				swfobject.embedSWF(swfName, "swfobj_game", w, h, "9.0.0", "expressInstall.swf",false,params,gameatr);
				
				$name= swfName;
				$w=w;
				$h=h;
				$params=params;
				$gameatr=gameatr;

				$("gametd").style.width=w+"px";
				$("gametd").style.height=h+"px";

				$("gameTable").style.width=w+"px";
				$("gameTable").style.height=(h-(-56))+"px";

				$("gameTr").style.height=h+"px";
				
				//make the rzbowl popup window align center
				$("rzbowlExitPopup").style.left=((w-0)/2-125)+"px";
				$("rzbowlExitPopup").style.top=((h-0)/2-140)+"px";

			
          		
          	}

	function rematch()
	{
		swfobject.embedSWF($name, "swfobj_game", $w, $h, "9.0.0", "expressInstall.swf",false,$params,$gameatr);
	}
	
	function showgame(s){
	
		eval("var g="+s);
		
		curGame=(g.pathswf)?(g.pathswf):(g["trueurl"].split("?")[0]);//sun modify for train game back button 2009-2-10
		
		gameChallenge=(g["trueurl"].indexOf("type=gamechallenge")!=-1);
		

		document.getElementById("game_swf").style.display="";
		document.getElementById("main_swf").style.marginLeft="-10px";

		document.getElementById("main_swf").style.width="1px";
		document.getElementById("main_swf").style.height="1px";
		
		thisMovie("main").style.width="1px";
		thisMovie("main").style.height="1px";


		gameswf(g["trueurl"],g["gamewidth"],g["gameheight"]);
		
		if(!g["gameid"]||gameChallenge || g["hashighscore"]=="0"){
		 document.getElementById("highscoreBtn").style.display="none";
		}else{
		 document.getElementById("highscoreBtn").style.display="block";
		}

		picstatus="game"; 

	}


	function shownews(){
	 window.location.href="/nflrztimes";
	}



	function hiddenMailBtn(l){
			thisMovie("nav_head").mailBtn(l);
	}

//var arr:Array=[ts,[COM.curHttpUrl.url,COM.lastHttpUrl,strChallengeInfo],url2];
	function submitUrl(arr,cNum){
		//alert(clInfo);
		if(!cNum){cNum=0}

		$("urlForm").action="/play"+arr[0];
		$("curUrl").value=arr[0];
		$("lastUrl").value=arr[1][0];
		if(arr.length>2){
			$("curPrames").value=arr[2];
		}
		$("last2Url").value=arr[1][1];
		$("isChallenge").value=cNum;
		if(arr[1].length>2){
			$("challengeInfo").value=arr[1][2];
		}
		
		//$("pathUrl").value=
		$("urlForm").submit();
	}

	function backBtnCtr(b)
	{
		$("backBtn").style.display=(b)?"block":"none";
	}
    
    function show_popup()
	{
		document.getElementById("nonUnserPopup").style.display = 'block';
	}
	
	function hide_popup(){
		document.getElementById("nonUnserPopup").style.display = 'none';
	}
    
    function nonRegshow_popup()
	{
		document.getElementById("nonRegUnserPopup").style.display = 'block';        
    }
	
	function nonReghide_popup(){
		document.getElementById("nonRegUnserPopup").style.display = 'none';
	}

  function goHistory(url){
			//window.history.go(s);
			//if url then link to url,if not,call history.back()
			//alert(url);
			//alert("goHistory");
			//alert("URL : "+url+"document.referrer"+document.referrer);
			
			if(url){
				if(url != '1'){
						window.location.href=url;
					} else {
						//window.location.href = "mainstreet";
						//var str = window.location.href.replace("locker","mainstreet")
						//var str = 
						var str = window.location.href.slice(0,window.location.href.indexOf("play"))
						window.location.href = str+"play/mainstreet"
						
					}

				//alert("if");
			}else{
				//window.history.back();
				//alert("else");
				if(document.referrer != '')
				window.location=document.referrer
				else
				window.history.back();
			}
			//window.history.back();
		  }


gameswf('/games/empty',600,620,'gamecontent');



//play page javascript end

//omni javascript start
    
	var omnitrueLogintype='';
	var omnitrueSubscription='';
	var omnitrueAge="";
	var omnitrueCode="";
			
	function trackingLogin(omnitrueLogintype,omnitrueCode){
			

			if(omnitrueLogintype=='login'){

				switch(omnitrueCode){
					case "undefined","":
						oTrack("Login:RZ","RZ:Login","RZ|Login",null,null,"event11");
						break;
					case "spring08":
						oTrack("Login:RZ","RZ:Login","RZ|Login",null,"1|rz_pc_spring08,18|spring08","event11");
						break;
					default:
						oTrack("Login:RZ","RZ:Login","RZ|Login",null,"1|rz_pc_"+omnitrueCode+",18|"+omnitrueCode,"event11");
						break;
				}

			}


	}

	function ifrheight(){
		var a=document.getElementById("frmNews").height;
		//alert(a);
	}


	function omnitrueAc3(omnitrueSubscription,omnitrueAge,omnitrueCode){
		
			if(omnitrueAge<=13)
				omnitrueAge="Under 13";
			if(omnitrueAge<18 && omnitrueAge>13)
				omnitrueAge="13-17";
			if(omnitrueAge>=18)
				omnitrueAge="18+";

		if(typeof omnitrueCode === 'undefined' || omnitrueCode === "")
			oTrack(omnitrueSubscription+"|Complete:"+omnitrueAge+":Register:RZ", "RZ:RZ Complete", "RZ|Register|"+omnitrueAge+"|Complete|"+omnitrueSubscription, false, false, "event3");
		else
			oTrack(omnitrueSubscription+":Complete:"+omnitrueAge+":Register:RZ", "RZ:RZ Complete", "RZ|Register|"+omnitrueAge+"|Complete|"+omnitrueSubscription, false, "1|rz_pc_"+omnitrueCode+",18|"+omnitrueCode, "event3");
	}
//omni javascript end
//　

	function showInvalidPromoCode()
	{
		popup_show('invalidpopup', 'popup_drag', 'popup_exit', 'screen-center', 0, 0);
	}

	function showRedeemedPromoCode()
	{
		popup_show('redeemedpopup', 'redeemedpopup_drag', 'redeemedpopup_exit', 'screen-center', 0, 0);
	}
