var LoginOpened=false;function findPos(obj)
{var objLeft=objTop=0;var objWidth=objHeight=0;objWidth=obj.offsetWidth;objHeight=obj.offsetHeight;if(obj.offsetParent)
{do
{objLeft+=obj.offsetLeft;objTop+=obj.offsetTop;}while(obj=obj.offsetParent);}
return[objLeft,objTop,objWidth,objHeight];}
function getWindowSize()
{var wWidth=0,wHeight=0;var xScroll=0,yScroll=0;if(typeof(window.innerWidth)=='number')
{wWidth=window.innerWidth;wHeight=window.innerHeight;xScroll=window.pageXOffset;yScroll=window.pageYOffset;}
else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight))
{wWidth=document.documentElement.clientWidth;wHeight=document.documentElement.clientHeight;xScroll=document.documentElement.scrollLeft;yScroll=document.documentElement.scrollTop;}
else if(document.body&&(document.body.clientWidth||document.body.clientHeight))
{wWidth=document.body.clientWidth;wHeight=document.body.clientHeight;xScroll=document.body.scrollLeft;yScroll=document.body.scrollTop;}
return[wWidth,wHeight,xScroll,yScroll];}
function InitializeMainSuggester()
{var Options={TargetElement:'BuyServerSuggester',DataSource:'/Ajax/SuggestServerAndGame.php',LettersToSuggestion:2,Suggestions:100,DivClass:'results',ListItemClass:'',ListItemHover:'hover',ListItemCategory:'',Event:'keydown',Type:1}
var SuggesterObj=new Suggester();SuggesterObj.Initialize(Options);}
function InitializeBlocksSuggester()
{if($('ServerId'))
{var Options={TargetElement:'BlockSuggester',DataSource:'/Ajax/ExpressCheckout.php',LettersToSuggestion:2,Suggestions:100,DivClass:'results',ListItemClass:'',ListItemHover:'selected',ListItemCategory:'',Event:'click',Type:2}
BlockSuggesterObj=new Suggester();BlockSuggesterObj.Initialize(Options);}}
function AlertKeys(e)
{if(!e)
{if(window.event)
{e=window.event;}
else
{return;}}
if(typeof(e.keyCode)=='number')
{e=e.keyCode;}
else if(typeof(e.which)=='number')
{e=e.which;}
else if(typeof(e.charCode)=='number')
{e=e.charCode;}
else
{return;}
switch(e)
{case 13:if(LoginOpened)
Login();else if($('SearchServerButton'))
MoveToStep2();return;break;default:break;}}
Event.observe(document,'keyup',AlertKeys,false);function popUp(URL)
{day=new Date();id=day.getTime();eval("page"+id+" = window.open(URL, '"+id+"', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=1200,height=1200,left = 40,top = -88');");}
function CheckEmail(Email)
{var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if(filter.test(Email))
{return true;}
else
{return false;}}
function CheckPhone(Phone)
{var filter=/^\+?(\d+[\- ])*\d+$/;if(filter.test(Phone))
{return true;}
else
{return false;}}
function Failure()
{$('GeneralMessage').innerHTML=ConnectionError;}
function ShowMBIframe()
{if($('MoneyBookersIframe'))
{$('MoneyBookersIframe').style.display='block';}}
function MoveToStep2()
{ServerName=$('BuyServerSuggester').value;var MyAjax=new Ajax.Request
('/Ajax/OrderCmd.php',{method:'post',parameters:'Action=LoadServer'+'&ServerName='+ServerName,onSuccess:MoveToStep2Success,onFailure:Failure});}
function MoveToStep2Success(response)
{eval('var Result='+response.responseText);if(Result.Success)
{SetCookie('ServerId',Result.ServerId,1,CookieDomain);window.location=Result.Data;}}
function MoveToStep3()
{BlockId=$('Block').getAttribute('productid');Server=$('ServerId').value;BuyNow(BlockId,Server);}
function SetCookie(c_name,value,expiredays,domain)
{var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);document.cookie=c_name+"="+escape(value)+
((expiredays==null)?"":";expires="+exdate.toGMTString())+";path="+"/"+
((domain)?";domain="+domain:"");}
function SaveCustomerDetails(FowardLink)
{if($('CharacterName').value!='')
{SetCookie('CharName',$('CharacterName').value,1,CookieDomain);}
if($('AltChar1'))
if($('AltChar1').value!='')
{SetCookie('AltChar1',$('AltChar1').value,1,CookieDomain);}
if($('AltChar2'))
if($('AltChar2').value!='')
{SetCookie('AltChar2',$('AltChar2').value,1,CookieDomain);}
if($('AltChar3'))
if($('AltChar3').value!='')
{SetCookie('AltChar3',$('AltChar3').value,1,CookieDomain);}
if($('AltChar4'))
if($('AltChar4').value!='')
{SetCookie('AltChar4',$('AltChar4').value,1,CookieDomain);}
if($('FirstName').value!='')
{SetCookie('FirstName',$('FirstName').value,1,CookieDomain);}
if($('LastName').value!='')
{SetCookie('LastName',$('LastName').value,1,CookieDomain);}
if($('Email').value)
{SetCookie('Email',$('Email').value,1,CookieDomain);}
if($('PhoneNumber').value!='')
{SetCookie('Phone',$('AreaCode').value+'||'+$('PhoneNumber').value,1,CookieDomain);}
if(FowardLink)
{window.location=FowardLink;}}
function CheckChangeServer()
{if($('ChangeServer'))
{if($('ChangeServer').checked)
{$('SelectServer').style.display='block';$('TextServer').style.display='none';if(/MSIE (\d+\.\d+);/.test(navigator.userAgent))
$('PriceWarning').style.display='block';else
$('PriceWarning').style.display='table-row';}
else
{$('SelectServer').style.display='none';$('TextServer').style.display='block';$('PriceWarning').style.display='none';}}}
function Trim(string)
{return string.replace(/^\s+|\s+$/g,'');}
function ShowTooltip(ToolId,event)
{$(ToolId).setStyle({display:'block'});$(ToolId).observe('click',HideTooltip.bind($(ToolId)));return false;}
function HideTooltip()
{this.hide();}
function CheckMouseLeaveOrEnter(e,handler)
{if(e.type!='mouseout'&&e.type!='mouseover')
return false;var reltg=e.relatedTarget?e.relatedTarget:e.type=='mouseout'?e.toElement:e.fromElement;while(reltg&&reltg!=handler)
reltg=reltg.parentNode;return(reltg!=handler);}
function ShowCouponServers()
{$('CouponServersDiv').style.display='block';}
function HideCouponServers()
{$('CouponServersDiv').style.display='none';}
var HallTreatTime=0;var LoadEvent=0;var HallCount=0;var GeneratingInProgress=0;function CheckForPromotion()
{var AjaxRq=new Ajax.Request
('/Ajax/ActionsPromotion.php',{method:'post',parameters:'action=check',onSuccess:StartPromotionResponse,onFailure:Failure});}
function StartPromotionResponse(Response)
{var Result=Response.responseText.evalJSON();if(Result.Success)
{$('GeneratedCouponCodeSpan').innerHTML=Result.Data.Code;$('PromoCouponOpener').style.display='block';PrivateTime=Result.Data.TimeToLive;CountDown();}
else
{$('PromoCouponOpener').style.display='none';$('PromotionContent').style.display='none';}}
function CountDown()
{var Seconds=PrivateTime%60;var Minutes=Math.floor(PrivateTime/60);var Hours=Math.floor(Minutes/60);Minutes=Minutes%60;var Days=Math.floor(Hours/24);Hours=Hours%24;if(PrivateTime>=0)
{setTimeout('CountDown()',1000);if($('CouponCountdownDisplay')&&$('NoticeCouponCountdownDisplay'))
{if(Days>0)
{if(Days==1)
{$('CouponCountdownDisplay').innerHTML=Days+' day '+(Hours<10?'0'+Hours:Hours)+':'+(Minutes<10?'0'+Minutes:Minutes)+' minutes';$('NoticeCouponCountdownDisplay').innerHTML=Days+' day '+(Hours<10?'0'+Hours:Hours)+':'+(Minutes<10?'0'+Minutes:Minutes)+' minutes';}
else
{$('CouponCountdownDisplay').innerHTML=Days+' days '+(Hours<10?'0'+Hours:Hours)+':'+(Minutes<10?'0'+Minutes:Minutes)+' minutes';$('NoticeCouponCountdownDisplay').innerHTML=Days+' days '+(Hours<10?'0'+Hours:Hours)+':'+(Minutes<10?'0'+Minutes:Minutes)+' minutes';}}
else if(Hours>0)
{if(Hours==1)
{$('CouponCountdownDisplay').innerHTML=Hours+' hour '+(Minutes<10?'0'+Minutes:Minutes)+':'+(Seconds<10?'0'+Seconds:Seconds)+' minutes';$('NoticeCouponCountdownDisplay').innerHTML=Hours+' hour '+(Minutes<10?'0'+Minutes:Minutes)+':'+(Seconds<10?'0'+Seconds:Seconds)+' minutes';}
else
{$('CouponCountdownDisplay').innerHTML=Hours+' hours '+(Minutes<10?'0'+Minutes:Minutes)+':'+(Seconds<10?'0'+Seconds:Seconds)+' minutes';$('NoticeCouponCountdownDisplay').innerHTML=Hours+' hours '+(Minutes<10?'0'+Minutes:Minutes)+':'+(Seconds<10?'0'+Seconds:Seconds)+' minutes';}}
else
{$('CouponCountdownDisplay').innerHTML=(Minutes<10?'0'+Minutes:Minutes)+':'+(Seconds<10?'0'+Seconds:Seconds)+' minutes';$('NoticeCouponCountdownDisplay').innerHTML=(Minutes<10?'0'+Minutes:Minutes)+':'+(Seconds<10?'0'+Seconds:Seconds)+' minutes';}}
PrivateTime--;}
else
{DismissCouponPromotion();}}
function DismissCouponPromotion()
{var AjaxRq=new Ajax.Request
('/Ajax/ActionsPromotion.php',{method:'post',parameters:'action=dismiss',onSuccess:StartPromotionResponse,onFailure:Failure});$('PromoCouponOpener').style.display='none';$('PromotionContent').style.display='none';return false;}
function OpenPromotionDiv()
{if($('PromotionContent').style.display=='block')
{$('PromotionContent').style.display='none';}
else
{$('CartContent').style.display='none';Coords=$('CartOpenDiv').cumulativeOffset();Size=$('CartOpenDiv').getDimensions();$('PromotionContent').style.left=(Coords.left+Size.width-$('PromotionContent').getWidth()-30)+'px';$('PromotionContent').style.top=(Coords.top+Size.height+30)+'px';$('PromotionContent').style.display='block';}}
function ClipBoard()
{var browser_type=navigator.appName
if(browser_type=="Microsoft Internet Explorer")
{$('holdtext').innerText=$('GeneratedCouponCodeSpan').innerText;Copied=$('holdtext').createTextRange();Copied.execCommand("Copy");}
else
{$('GeneratedCouponCodeSpan').focus();$('GeneratedCouponCodeSpan').select();}}
function AddAutomaticCoupon(Area)
{if(Area==1)
CouponCode=encodeURIComponent($('GeneratedCouponCodeSpan').innerHTML);else
{if($('HallCouponCode'))
CouponCode=encodeURIComponent($('HallCouponCode').innerHTML);else
CouponCode='';}
var AjaxRequest=new Ajax.Request
('/Ajax/CartCmd.php?',{method:'get',parameters:'Action=AddAutomaticCart&Coupon='+CouponCode,onSuccess:AddAutoCouponSuccess,onFailure:Failure});}
function AddAutoCouponSuccess(response)
{var Result=response.responseText.evalJSON();window.location=Result.Message;}
function HallSearchUser()
{if($('SearchUserError'))
$('SearchUserError').innerHTML='';if(($('HallEmail').value!='')&&($('HallPass').value!=''))
{var AjaxRequest=new Ajax.Request
('/Ajax/ActionsHalloween.php?',{method:'post',parameters:'action=Search&Email='+Trim($('HallEmail').value)
+'&Password='+encodeURIComponent(Trim($('HallPass').value))
+'&HallPage='+HallPage,onSuccess:HallSearchUserSuccess,onFailure:Failure});}
else if($('HallEmail').value=='')
{if($('SearchUserError'))
$('SearchUserError').innerHTML=LongEmailError;}
else
{if($('SearchUserError'))
$('SearchUserError').innerHTML=MissingPassword;}}
function HallSearchUserSuccess(response)
{eval('var Result='+response.responseText);if(Result.Success)
{$('WelcomeMessage').innerHTML=Result.Data;$('FooterLogin').style.display='none';GetTrickTreat(1);}
else
{if(Result.HallPage==1)
$('HallPageContent').innerHTML=Result.HtmlContent;else
$('HalloweenContent').innerHTML=Result.HtmlContent;}}
function CloseHallDiv()
{$('HalloweenContent').style.display='none';if($('Games'))
{$('Games').style.visibility='visible';$('Servers').style.visibility='visible';$('Blocks').style.visibility='visible';}}
function GetTrickTreat(Generate)
{if(GeneratingInProgress==1)
{return false;}
GeneratingInProgress=1;if($('Loading'))
{$('Loading').style.display='block';}
if($('SearchUserError'))
$('SearchUserError').innerHTML='';if((LoadEvent==1)&&(Generate!=1))
return false;LoadEvent=1;if($('HallEmail'))
Email=$('HallEmail').value;else
Email='';var AjaxRequest=new Ajax.Request
('/Ajax/ActionsHalloween.php?',{method:'post',parameters:'action=treat&Email='+Trim(Email)+'&Generate='+((Generate==1)?'1':'0')+'&HallPage='+HallPage,onSuccess:TreatSuccess,onFailure:Failure});}
function TreatSuccess(response)
{eval('var Result='+response.responseText);if(Result.Success)
{if(Result.Data.Type==1)
{if(Result.Data.HallPage==1)
$('HallPageContent').innerHTML=Result.HtmlContent;else
$('HalloweenContent').innerHTML=Result.HtmlContent;if(Result.Data.LifeTime>0)
{HallTreatTime=Result.Data.LifeTime;Count=HallCountDown();if($('HalloweenMessage'))
{$('HalloweenMessage').innerHTML='You got a treat! Hurry, it expires in '+Count+'. Click here!';$('HalloweenOpener').style.display='block';}}
else
{if($('HalloweenMessage'))
{var txt=document.createTextNode(Result.ExpireMessage);$('HalloweenOpener').insertBefore(txt,$('HalloweenOpener').firstChild);$('HalloweenMessage').innerHTML='';$('HalloweenOpener').style.display='block';}
$('HalloweenContent').style.display='none';}}
else
{if(Result.Data.HallPage==1)
$('HallPageContent').innerHTML=Result.HtmlContent;else
$('HalloweenContent').innerHTML=Result.HtmlContent;if(Result.Data.Tricks==2)
{if($('HalloweenMessage'))
{$('HalloweenMessage').innerHTML='Boo! You\'ve received a trick. Click here to try again!';$('HalloweenOpener').style.display='block';}}
else
{if($('HalloweenMessage'))
{$('HalloweenMessage').innerHTML='You got tricked! Don\'t get spooked, click here to try again!';$('HalloweenOpener').style.display='block';}}}}
else
{if(Result.Data.HallPage==1)
$('HallPageContent').innerHTML=Result.HtmlContent;else
$('HalloweenContent').innerHTML=Result.HtmlContent;if($('HalloweenMessage'))
{$('HalloweenMessage').innerHTML='Trick or Treat! Get as much as 50% off, FREE gold, or even cash discounts on orders! Click here.';$('HalloweenOpener').style.display='block';}}
if(Result.Data.Generated==1)
{$('CartContent').style.display='none';Coords=$('CartOpenDiv').cumulativeOffset();Size=$('CartOpenDiv').getDimensions();$('HalloweenContent').style.left=(Coords.left+Size.width-$('HalloweenContent').getWidth()-57)+'px';$('HalloweenContent').style.top=(Coords.top+Size.height+38)+'px';$('HalloweenContent').style.display='block';if($('Games'))
{$('Games').style.visibility='hidden';$('Servers').style.visibility='hidden';$('Blocks').style.visibility='hidden';}}
if($('Loading'))
{$('Loading').style.display='none';}
GeneratingInProgress=0;}
function OldTreatSuccess(response)
{eval('var Result='+response.responseText);if(Result.Success)
{if(Result.Data.Type==1)
{if(Result.Data.LifeTime>0)
{$('HallCouponDetails').innerHTML=Result.Data.Text;HallTreatTime=Result.Data.LifeTime;Count=HallCountDown();$('HallTreatBox').style.display='block';if($('HalloweenMessage'))
{$('HalloweenMessage').innerHTML='You got a treat! Hurry, it expires in '+Count+'. Click here!';$('HalloweenOpener').style.display='block';}}
else
{$('HallTreatBox').style.display='none';$('HallTreatExpired').style.display='block';if($('HalloweenMessage'))
{var txt=document.createTextNode("Happy Halloween.");$('HalloweenOpener').insertBefore(txt,$('HalloweenOpener').firstChild);$('HalloweenMessage').innerHTML='';$('HalloweenOpener').style.display='block';}
$('HalloweenContent').style.display='none';}
$('HallEnterEmailBox').style.display='none';$('HallRegisterBox').style.display='none';$('HallTrickBox').style.display='none';}
else
{$('TrickMessage').innerHTML='Wanna try again?Click here.';if(Result.Data.Tricks==2)
{$('TrickedAgain').innerHTML='WHOOPS, YOU GOT TRICKED AGAIN!';if($('HalloweenMessage'))
{$('HalloweenMessage').innerHTML='Boo! You\'ve received a trick. Click here to try again!';$('HalloweenOpener').style.display='block';}}
else
{if($('HalloweenMessage'))
{$('HalloweenMessage').innerHTML='You got tricked! Don\'t get spooked, click here to try again!';$('HalloweenOpener').style.display='block';}}
$('HallEnterEmailBox').style.display='none';$('HallRegisterBox').style.display='none';$('HallTreatBox').style.display='none';$('HallTrickBox').style.display='block';}}
else
{$('HallEmail').value='';$('HallPass').value='';$('HallEnterEmailBox').style.display='block';$('HallRegisterBox').style.display='none';$('HallTreatBox').style.display='none';$('HallTrickBox').style.display='none';if($('HalloweenMessage'))
{$('HalloweenMessage').innerHTML='Trick or Treat! Get as much as 50% off, FREE gold, or even cash discounts on orders! Click here.';$('HalloweenOpener').style.display='block';}}
if(Result.Data.Generated==1)
{$('CartContent').style.display='none';Coords=$('CartOpenDiv').cumulativeOffset();Size=$('CartOpenDiv').getDimensions();$('HalloweenContent').style.left=(Coords.left+Size.width-$('HalloweenContent').getWidth()-55)+'px';$('HalloweenContent').style.top=(Coords.top+Size.height+40)+'px';$('HalloweenContent').style.display='block';if($('Games'))
{$('Games').style.visibility='hidden';$('Servers').style.visibility='hidden';$('Blocks').style.visibility='hidden';}}
if($('Loading'))
{$('Loading').style.display='none';}
GeneratingInProgress=0;}
function HallCountDown()
{var Seconds=HallTreatTime%60;var Minutes=Math.floor(HallTreatTime/60);var Hours=Math.floor(Minutes/60);Minutes=Minutes%60;var Days=Math.floor(Hours/24);Hours=Hours%24;if(HallTreatTime>=0)
{clearTimeout(HallCount);HallCount=setTimeout('HallCountDown()',1000);if($('HallTimer'))
{if(Days>0)
{if(Days==1)
{if($('HallHeadCountDown'))
{$('HallHeadCountDown').innerHTML=Days+'day '+Hours+'hr '+(Minutes<10?'0'+Minutes:Minutes)+':'+(Seconds<10?'0'+Seconds:Seconds)+' minutes';}
$('HallTimer').innerHTML=Days+'day '+Hours+'hr '+(Minutes<10?'0'+Minutes:Minutes)+':'+(Seconds<10?'0'+Seconds:Seconds)+'min';Value=Days+'day '+Hours+'hr '+(Minutes<10?'0'+Minutes:Minutes)+':'+(Seconds<10?'0'+Seconds:Seconds)+' minutes';}
else
{if($('HallHeadCountDown'))
{$('HallHeadCountDown').innerHTML=Days+'days '+Hours+'hr '+(Minutes<10?'0'+Minutes:Minutes)+':'+(Seconds<10?'0'+Seconds:Seconds)+' minutes';}
$('HallTimer').innerHTML=Days+'days '+Hours+'hr '+(Minutes<10?'0'+Minutes:Minutes)+':'+(Seconds<10?'0'+Seconds:Seconds)+'min';Value=Days+'days '+Hours+'hr '+(Minutes<10?'0'+Minutes:Minutes)+':'+(Seconds<10?'0'+Seconds:Seconds)+' minutes';}}
else if(Hours>0)
{if($('HallHeadCountDown'))
{$('HallHeadCountDown').innerHTML=Hours+'hr '+(Minutes<10?'0'+Minutes:Minutes)+':'+(Seconds<10?'0'+Seconds:Seconds)+' minutes';}
$('HallTimer').innerHTML=Hours+'hr '+(Minutes<10?'0'+Minutes:Minutes)+':'+(Seconds<10?'0'+Seconds:Seconds)+'min';Value=Hours+'hr '+(Minutes<10?'0'+Minutes:Minutes)+':'+(Seconds<10?'0'+Seconds:Seconds)+' minutes';}
else
{if($('HallHeadCountDown'))
{$('HallHeadCountDown').innerHTML=(Minutes<10?'0'+Minutes:Minutes)+':'+(Seconds<10?'0'+Seconds:Seconds)+' minutes';}
$('HallTimer').innerHTML=(Minutes<10?'0'+Minutes:Minutes)+':'+(Seconds<10?'0'+Seconds:Seconds)+'min';Value=(Minutes<10?'0'+Minutes:Minutes)+':'+(Seconds<10?'0'+Seconds:Seconds)+' minutes';}}
HallTreatTime--;return Value;}
else
{GetTrickTreat(1);return 0;}}
function HallClick(e)
{if(!e)
{if(window.event)
{e=window.event;}else{return;}}
if(e.keyCode==13)
{HallSearchUser();}}
function AddTreat()
{var AjaxRequest=new Ajax.Request
('/Ajax/CartCmd.php?',{method:'get',parameters:'Action=AddTreat',onSuccess:AddTreatSuccess,onFailure:Failure});}
function AddTreatSuccess(response)
{var Result=response.responseText.evalJSON();window.location=Result.Message;}
function AddBlockSuccess(response)
{eval('var Result='+response.responseText);if(Result.Success)
{$('CartContent').innerHTML=Result.Data;if($('Check_CartContent'))
{if(Result.CheckData!='')
{$('Check_CartContent').innerHTML=Result.CheckData;if($('TextServer'))
{$('TextServer').innerHTML=Result.ServerName;}
if(Result.GiftCoupon==1)
{$('PaymentCovered').style.display='block';$('PaymentArea').style.display='none';}
else
{$('PaymentCovered').style.display='none';$('PaymentArea').style.display='block';}}
else
{window.location=Result.EmptyCartLink;}}
if(Result.CurrencyId)
{CurrencyId=Result.CurrencyId;if(CurrencyId==1)
{$('USD').className+=' selected';$('EUR').className=$('EUR').className.replace('selected','');$('GBP').className=$('GBP').className.replace('selected','');}
if(CurrencyId==2)
{$('EUR').className+=' selected';$('USD').className=$('USD').className.replace('selected','');$('GBP').className=$('GBP').className.replace('selected','');}
if(CurrencyId==3)
{$('GBP').className+=' selected';$('EUR').className=$('EUR').className.replace('selected','');$('USD').className=$('USD').className.replace('selected','');}}}
else
{if((Result.RedirectLink)&&(Result.RedirectLink!=''))
{window.location=Result.RedirectLink;}
if(Result.AddCoupon)
{$('CouponError').innerHTML=Result.Message;}}}
function BuyNow(BlockId,ServerId)
{if(!BlockId)
{$('GeneralMessage')=InvalidBlock;}
if(!ServerId)
{$('GeneralMessage')=InvalidServer;}
var AjaxRequest=new Ajax.Request
('/Ajax/CartCmd.php?',{method:'get',parameters:'Action=Buy&Block='+BlockId
+'&ServerId='+ServerId,onSuccess:BuyNowSuccess,onFailure:Failure});}
function BuyNowSuccess(response)
{eval('var Result='+response.responseText);if($('GeneralMessage'))
$('GeneralMessage').innerHTML=Result.Message;if(Result.Link!='')
{window.location=Result.Link;}}
function DelItem(BlockId)
{if(!BlockId)
{$('GeneralMessage')=InvalidBlock;}
var AjaxRequest=new Ajax.Request
('/Ajax/CartCmd.php?',{method:'get',parameters:'Action=Del&Block='+BlockId+
((NewCheck&&NewCheck==1)?'&NewCheck=1':''),onSuccess:AddBlockSuccess,onFailure:Failure});}
function UpdateCart()
{AllInputs=document.getElementsByTagName('INPUT');NotArray=new Array();k=0;for(var i=0;i1)
Select.removeChild(Select.options[Select.options.length-1]);var i,NoOptions,NewOption,Select=$('ic-blocks');while(Select.options.length>1)
Select.removeChild(Select.options[Select.options.length-1]);if($('ic_final_price'))
{$('ic_final_price').innerHTML='';}}
$('ic_message').innerHTML='';$('ic_selected').value=0;}}
else
{if($('Games'))
{Game=$('Games').value;if(Game!=0)
{var MyAjax=new Ajax.Request
('/Ajax/ExpressCheckout.php',{method:'post',parameters:'Action=LoadServers'+'&GameId='+Game+'&Area=0',onSuccess:LoadServersSuccess,onFailure:Failure});}
else
{var i,NoOptions,NewOption,Select=$('Servers');while(Select.options.length>1)
Select.removeChild(Select.options[Select.options.length-1]);var i,NoOptions,NewOption,Select=$('Blocks');while(Select.options.length>1)
Select.removeChild(Select.options[Select.options.length-1]);$('BlockPrice').innerHTML='';if($('TotalText'))
{$('TotalText').innerHTML='';}
if($('PriceWithDisc'))
{$('PriceWithDisc').innerHTML='';}}}}}
function LoadServersSuccess(response)
{eval('var Result='+response.responseText);if(Result.Success)
{if(Result.Area==1)
{var i,NoOptions,NewOption,Select=$('ic-servers');while(Select.options.length>1)
Select.removeChild(Select.options[Select.options.length-1]);for(i=0;i1)
Select.removeChild(Select.options[Select.options.length-1]);if($('ic_final_price'))
{$('ic_final_price').innerHTML='';}}
else
{var i,NoOptions,NewOption,Select=$('Servers');while(Select.options.length>1)
Select.removeChild(Select.options[Select.options.length-1]);for(i=0;i1)
Select.removeChild(Select.options[Select.options.length-1]);$('BlockPrice').innerHTML='';if($('TotalText'))
{$('TotalText').innerHTML='';}
if($('PriceWithDisc'))
{$('PriceWithDisc').innerHTML='';}}}
else
{if(Result.Area==1)
{var i,NoOptions,NewOption,Select=$('ic-servers');while(Select.options.length>1)
Select.removeChild(Select.options[Select.options.length-1]);var i,NoOptions,NewOption,Select=$('ic-blocks');while(Select.options.length>1)
Select.removeChild(Select.options[Select.options.length-1]);if($('ic_final_price'))
{$('ic_final_price').innerHTML='';}
$('ic_message').innerHTML=Result.Message;}}}
function LoadBlocks(Area,CurrencyId)
{if(Area==1)
{if(CurrencyId!=0)
{var MyAjax=new Ajax.Request
('/Ajax/CartCmd.php',{method:'get',parameters:'Action=ChangeCurrency'+'&CurrencyId='+CurrencyId,onSuccess:ChangeCurrencySuccess,onFailure:Failure});}
else
{$('ic_selected').value=0;}
Server=$('ic-servers').value;if(Server!=0)
{var MyAjax=new Ajax.Request
('/Ajax/ExpressCheckout.php',{method:'post',parameters:'Action=LoadBlocks'+'&ServerId='+Server+
(CurrencyId?('&CurrencyId='+CurrencyId):'')+'&CouponId='+($('ic-couponid')?$('ic-couponid').value:0)+'&CouponCode='+($('ic_couponcode')?$('ic_couponcode').value:'')+'&Area=1',onSuccess:LoadBlocksSuccess,onFailure:Failure});}
else
{var i,NoOptions,NewOption,Select=$('ic-blocks');while(Select.options.length>1)
Select.removeChild(Select.options[Select.options.length-1]);if($('ic_final_price'))
{$('ic_final_price').innerHTML='';}}
$('ic_message').innerHTML='';}
else
{Server=$('Servers').value;if(Server!=0)
{var MyAjax=new Ajax.Request
('/Ajax/ExpressCheckout.php',{method:'post',parameters:'Action=LoadBlocks'+'&ServerId='+Server+'&CouponId='+($('CouponId')?$('CouponId').value:0)+'&CouponCode='+($('CouponCode')?$('CouponCode').value:'')+'&Area=0',onSuccess:LoadBlocksSuccess,onFailure:Failure});}
else
{var i,NoOptions,NewOption,Select=$('Blocks');while(Select.options.length>1)
Select.removeChild(Select.options[Select.options.length-1]);$('BlockPrice').innerHTML='';if($('TotalText'))
{$('TotalText').innerHTML='';}
if($('PriceWithDisc'))
{$('PriceWithDisc').innerHTML='';}}}}
function LoadBlocksSuccess(response)
{eval('var Result='+response.responseText);if(Result.Success)
{if(Result.Area==1)
{AmountObj=Result.Data;var i,NoOptions,NewOption,Select=$('ic-blocks');while(Select.options.length>1)
Select.removeChild(Select.options[Select.options.length-1]);for(i=0;i1)
Select.removeChild(Select.options[Select.options.length-1]);for(i=0;i'+AmountObj[i].Price+'
'+AmountObj[i].DiscountDetail;$('TotalText').innerHTML=AmountObj[i].TotalPrice;}
else
{$('BlockPrice').innerHTML=AmountObj[i].Price;if($('TotalText'))
$('TotalText').innerHTML='';}
if($('PriceWithDisc'))
{if($('CouponCode')&&AmountObj[i].AcceptsCoupon)
$('PriceWithDisc').innerHTML=AmountObj[i].PriceWithDisc;else
$('PriceWithDisc').innerHTML=AmountObj[i].Price;}}}}
else
{$('BlockPrice').innerHTML='';if($('TotalText'))
{$('TotalText').innerHTML='';}
if($('PriceWithDisc'))
{$('PriceWithDisc').innerHTML='';}}}}
function OpenLogin(Area)
{$('LoginDiv').style.height=document.body.offsetHeight+'px';$('LoginDiv').style.display='block';if($('HalloweenContent'))
{$('HalloweenContent').style.display='none';}
var ieversion=new Number(RegExp.$1);if(/MSIE (\d+\.\d+);/.test(navigator.userAgent)&&(ieversion<=6))
{}
else
{if(Area==1)
{$('RadioLogin').checked=true;}
else if(Area==2)
{$('RadioRegister').checked=true;}}
LoginOpened=true;}
function CloseLogin()
{$('LoginDiv').style.display='none';$('LoginEmail').value='';$('LoginPassword').value='';$('RFirstName').value='';$('RLastName').value='';$('REmail').value='';$('RPassword').value='';$('RRetypePassword').value='';$('ContinueError').innerHTML='';$('ContinueError').className='error';LoginOpened=false;return false;}
function ShowForgotPassDiv()
{$('RecoverPassDiv').style.height=document.body.offsetHeight+'px';$('OverRPassEmail').value='';$('RecoverPassDiv').style.display='block';$('RPassResponse').style.display='none';$('MainRPassArea').style.display='block';$('RecPassError').innerHTML='';CloseLogin();}
function CloseForgotPassDiv()
{$('OverRPassEmail').value='';$('RecoverPassDiv').style.display='none';}
function SendPassword()
{ReturnEmail=Trim($('OverRPassEmail').value);$('RecPassError').innerHTML='';if(!CheckEmail(ReturnEmail))
{$('RecPassError').innerHTML=EmailError;return false;}
var AjaxRequest=new Ajax.Request
('/Ajax/SendEmails.php?',{method:'get',parameters:'Action=Pass&Email='+ReturnEmail,onSuccess:SendPassSuccess,onFailure:Failure});}
function SendPassSuccess(response)
{eval('var Response = '+response.responseText);if(Response.Success)
{$('RPassResponse').style.display='block';$('MainRPassArea').style.display='none';}
else
{$('RecPassError').innerHTML=Response.Message;}}
function Login()
{if($('RadioLogin').checked)
{if(($('LoginEmail').value!='')&&($('LoginPassword').value!=''))
{var AjaxRequest=new Ajax.Request
('/Ajax/CustomerCmd.php?',{method:'post',parameters:'Action=Login&Email='+Trim($('LoginEmail').value)
+'&Password='+encodeURIComponent(Trim($('LoginPassword').value)),onSuccess:LoginSuccess,onFailure:Failure});}
else if($('LoginEmail').value!='')
{$('ContinueError').innerHTML=LongEmailError;}
else
{$('ContinueError').innerHTML=MissingPassword;}}
else if($('RadioRegister').checked)
{if(Trim($('RFirstName').value)=='')
{$('ContinueError').innerHTML=EmptyString;return false;}
if(Trim($('RLastName').value)=='')
{$('ContinueError').innerHTML=EmptyString;return false;}
if(!CheckEmail($('REmail').value))
{$('ContinueError').innerHTML=LongEmailError;return false;}
if(Trim($('RPassword').value).length<3)
{$('ContinueError').innerHTML=ShortPassword.replace('||number||',3);return false;}
if(Trim($('RPassword').value)!=Trim($('RRetypePassword').value))
{$('ContinueError').innerHTML=PasswordNoMatch;return false;}
if(!$('OTermsAgreed').checked)
{$('ContinueError').innerHTML=TermsAndCondError;return false;}
var AjaxRequest=new Ajax.Request
('/Ajax/CustomerCmd.php?',{method:'post',parameters:'Action=Add&FirstName='+encodeURIComponent(Trim($('RFirstName').value))
+'&LastName='+encodeURIComponent(Trim($('RLastName').value))
+'&Email='+Trim($('REmail').value)
+'&Password='+encodeURIComponent(Trim($('RPassword').value)),onSuccess:RegisterSuccess,onFailure:Failure});}
else
{}}
function LoginSuccess(response)
{eval('var Result='+response.responseText);if(Result.Success)
{LoadEvent=0;if($('HalloweenContent')||$('HallPageContent'))
if(HallEnabled==1)
GetTrickTreat(0);$('ContinueError').innerHTML=Result.Message;$('ContinueError').className='';$('WelcomeMessage').innerHTML=Result.Data;setTimeout('CloseLogin();',2000);$('FooterLogin').style.display='none';}
else
{$('ContinueError').innerHTML=Result.Message;}}
function RegisterSuccess(response)
{eval('var Result='+response.responseText);if(Result.Success)
{$('ContinueError').innerHTML=Result.Message;$('ContinueError').className='';$('WelcomeMessage').innerHTML=Result.Data;setTimeout('CloseLogin();',5000);}
else
{$('ContinueError').innerHTML=Result.Message;}}
function LoadCustomer()
{var AjaxRequest=new Ajax.Request
('/Ajax/CustomerCmd.php?',{method:'post',parameters:'Action=Load',onSuccess:LoadCustomerSuccess,onFailure:Failure});}
function LoadCustomerSuccess(response)
{eval('var Result='+response.responseText);if(Result.Success)
{$('PFirstName').value=Result.Data.FirstName;$('PLastName').value=Result.Data.LastName;$('PEmail').innerHTML=Result.Data.Email;$('PContactEmail').value=(Result.Data.ContactEmail)?Result.Data.ContactEmail:Result.Data.Email;$('Countries').value=Result.Data.CountryId;if(Result.Data.PhoneCountryCode==1)
{$('USChecked').checked=true;$('IntChecked').checked=false;}
else
{$('USChecked').checked=false;$('IntChecked').checked=true;}
$('ProfileCountryPrefix').value=(Result.Data.PhoneCountryCode!=0)?Result.Data.PhoneCountryCode:'';$('ProfileAreaCode').value=(Result.Data.AreaCode)?Result.Data.AreaCode:'';$('ProfilePhoneNumber').value=(Result.Data.Phone)?Result.Data.Phone:'';$('POldPass').value='';$('PNewPass').value='';$('PRetypePass').value='';$('UpdateError').innerHTML='';$('UpdateError').className='error';$('ProfileDiv').style.height=document.body.offsetHeight+'px';$('ProfileDiv').style.display='block';if($('HalloweenContent'))
{$('HalloweenContent').style.display='none';}}}
function CloseProfileDiv()
{$('ProfileDiv').style.display='none';}
function UpdateCustomer()
{AllowAdd=true;if(Trim($('PFirstName').value)=='')
{$('UpdateError').innerHTML=FirstNameError;AllowAdd=false;}
if(Trim($('PLastName').value)=='')
{$('UpdateError').innerHTML=LastNameError;AllowAdd=false;}
if((Trim($('PContactEmail').value)=='')||!CheckEmail($('PContactEmail').value))
{$('UpdateError').innerHTML=EmailError;AllowAdd=false;}
if((Trim($('ProfileAreaCode').value)!='')||(Trim($('ProfilePhoneNumber').value)!=''))
{if((Trim($('ProfileAreaCode').value)!='')&&((!CheckPhone($('ProfileAreaCode').value))))
{$('UpdateError').innerHTML=AreaCodeError;AllowAdd=false;}
if(!CheckPhone($('ProfilePhoneNumber').value))
{$('UpdateError').innerHTML=AreaCodeError;AllowAdd=false;}
if((Trim($('ProfileCountryPrefix').value)!='')&&((!CheckPhone($('ProfileCountryPrefix').value))||($('ProfileCountryPrefix').value<0)))
{$('UpdateError').innerHTML=AreaCodeError;AllowAdd=false;}}
if((Trim($('POldPass').value)!='')||(Trim($('PNewPass').value)!=''))
{if(Trim($('POldPass').value)=='')
{$('UpdateError').innerHTML=MissingPassword;AllowAdd=false;}
if(Trim($('PNewPass').value)=='')
{$('UpdateError').innerHTML=MissingPassword;AllowAdd=false;}
if(Trim($('PNewPass').value)!=Trim($('PRetypePass').value))
{$('UpdateError').innerHTML=PasswordNoMatch;AllowAdd=false;}
if(Trim($('PNewPass').value).length<3)
{$('UpdateError').innerHTML=ShortPassword.replace('||number||',3);AllowAdd=false;}
ChangePassword='&OldPass='+encodeURIComponent(Trim($('POldPass').value))+'&NewPass='+encodeURIComponent(Trim($('PNewPass').value));}
else
{ChangePassword='';}
if(!AllowAdd)
{return false;}
var AjaxRequest=new Ajax.Request
('/Ajax/CustomerCmd.php?',{method:'post',parameters:'Action=Update'+'&FirstName='+encodeURIComponent(Trim($('PFirstName').value))+'&LastName='+encodeURIComponent(Trim($('PLastName').value))+'&Email='+encodeURIComponent(Trim($('PContactEmail').value))+'&CountryId='+$('Countries').value+'&CountryPrefix='+Trim($('ProfileCountryPrefix').value)+'&AreaCode='+Trim($('ProfileAreaCode').value)+'&PhoneNumber='+Trim($('ProfilePhoneNumber').value)+
ChangePassword,onSuccess:UpdateCustomerSuccess,onFailure:Failure});}
function UpdateCustomerSuccess(response)
{eval('var Result='+response.responseText);if(Result.Success)
{$('UpdateError').innerHTML=Result.Message;$('UpdateError').className='ok_message';$('WelcomeMessage').innerHTML=Result.Data;setTimeout('CloseProfileDiv();',5000);}
else
{$('UpdateError').innerHTML=Result.Message;}}
function ChangeAreaCode()
{if($('USChecked').checked)
{$('ProfileCountryPrefix').value=1;}
else
{if($('Countries').value==0)
$('ProfileCountryPrefix').value='';else
$('ProfileCountryPrefix').value=CountryCodes[$('Countries').value];}}
function CheckLoginRadio(Area)
{if(Area==1)
{$('RadioLogin').checked=true;}
else
{$('RadioRegister').checked=true;}}
function CloseRecPas()
{$('RecovPassSuccess').style.display='none';}
function OpenJoinDetails(Area)
{$('JoinUsDetails').style.height=document.body.offsetHeight+'px';if(Area==1)
$('JoinUsInner').style.top='1000px';else
$('JoinUsInner').style.top='200px';$('JoinUsDetails').style.display='block';}
function CloseJoinDetails()
{$('JoinUsDetails').style.display='none';}
function LoadOverlays()
{var AjaxRequest=new Ajax.Request
('/Ajax/Overlays.php?',{method:'post',parameters:'',onSuccess:LoadOverlaysSuccess,onFailure:Failure});}
function LoadOverlaysSuccess(response)
{eval('var Result='+response.responseText);$('Login_Overlays').innerHTML=Result.Data;}
function OpenIC(e,CouponCode)
{if(CouponCode)
$('ic_couponcode').value=CouponCode;$('ic-games').value=0;$('ic-servers').value=0;$('ic-blocks').value=0;$('ic_final_price').innerHTML='';$('ic_message').innerHTML='';$('ic_selected').value=0;var i,NoOptions,NewOption,Select=$('ic-servers');while(Select.options.length>1)
Select.removeChild(Select.options[Select.options.length-1]);var i,NoOptions,NewOption,Select=$('ic-blocks');while(Select.options.length>1)
Select.removeChild(Select.options[Select.options.length-1]);if(mouseY(e)+646>document.body.offsetHeight)
$('ic-overlay').style.top=(mouseY(e)-400)+'px';else if(mouseY(e)<400)
$('ic-overlay').style.top=mouseY(e)+'px';else
$('ic-overlay').style.top=(mouseY(e)-200)+'px';$('ICDIv').style.height=document.body.offsetHeight+'px';$('ICDIv').style.display='block';}
function CloseIC()
{$('ICDIv').style.display='none';}
function mouseX(evt)
{if(!evt)
var evt=evt||window.event;if(evt.pageX)return evt.pageX;else if(evt.clientX)
return evt.clientX+(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft);else return null;}
function mouseY(evt){if(!evt)
var evt=evt||window.event;if(evt.pageY)return evt.pageY;else if(evt.clientY)
return evt.clientY+(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop);else return null;}