function $(a){if(typeof a=="string"){a=document.getElementById(a)}return a}function trim(a){return a.replace(/^\s+|\s+$/g,"")}String.prototype.trim=function(a){trim(a)};String.prototype.endsWith=function(a){return(this.match(a+"$")==a)};function emp(a){return(a==null||a==undefined||a==0||a=="")}function qmsgl(a,b){qmsg.showAtObj(a,__userLoginMsg,3000,b)}function qmsge(c,b,d){var a=__errMsg;if(b){__errMsg+=" ("+b+")"}qmsg.showAtObj(c,a,2000,d)}function qmsgo(a,b){qmsg.showAtObj(a,__loadingMsg,0,b)}function gosInArray(c,b){for(k in b){if(b[k]==c){return true}}return false}var reUsername=/^([a-zA-Z0-9_-]+)$/;var reAlphanum=/^([a-zA-Z0-9]+)$/;var reEmail=/^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,6})+$/;function gosVldMsg(b,a){if($(b)){$(b).style.display=(a)?"":"none"}return a}function gosVldErrMsg(b,a){if($(b)){$(b).style.display=(a)?"none":""}return a}function gosGetRadioVal(a){r="";l=a.length;if(l==undefined){return(a.checked)?a.value:r}for(i=0;i<l;i++){if(a[i].checked){return a[i].value}}return r}function gosVldMsgClose(a){for(i in a){gosVldMsg(a[i],false)}}function gosTab(b,d){liObj=gosFindParentTag(b,"li");if(liObj){var a=liObj.parentNode.childNodes;for(var c in a){a[c].className=""}liObj.className="selected"}if(d){window[d]()}return false}function gosFav(d,g,b,a){if(!__userlogin){qmsgl(d,"fav")}else{var c,e;d.disabled=true;qmsgo(d,"fav");if(d.className=="dfav"){c=BASE_PATH+"/ajax/favorites?cmd=del&u="+g;e=function(f){var j=parseInt(f);if(j>0){var m=$(a);try{m.parentNode.removeChild(m)}catch(h){}qmsg.close()}else{if(j==M_NOAUTH){qmsgl(d,"fav");d.disabled=false}else{qmsg.showAtObj(d,__errMsg+"("+j+")",2000,"fav");d.disabled=false}}}}else{c=BASE_PATH+"/ajax/favorites?cmd=add&u="+g;e=function(f){rcode=parseInt(f);if(rcode==M_NOAUTH){qmsgl(d,"fav");d.disabled=false}else{if(rcode<0&&rcode!=M_DUPENT){qmsge(d,f,"fav");d.disabled=false}else{qmsg.showAtObj(d,"Thanks:)",1000,"fav");if(b){d.className=b}}}}}ajax.get(c,e)}}function gosFavSingle(a){gosFav(a,__favKey,"gto-favadded")}gsrate=new function GosStarRate(){var c={"1":"Poor","2":"Nothing Special","3":"Worth Playing","4":"Cool","5":"Awesome"};var a=false;var d=0;var b="star3";this.mover=function(e){this.showRate(e)};this.mout=function(){this.showOrgRate(__gameRate," ")};this.rate=function(e){if(!a){a=true;d=e;ajax.get(BASE_PATH+"/ajax/rating?uname="+__gameUname+"&rate="+e,gsrate.showResult);qmsgo($(b))}};this.showResult=function(e){if(this!=gsrate){gsrate.showResult(e)}else{e=parseInt(e);var f="";switch(e){case M_SUC:f="Thanks!";a=true;break;case M_DUPENT:f="Rated already!";a=true;break;case M_NOAUTH:f='Login or <a href="'+BASE_PATH+'/signup.htm">register</a> to rate';a=true;break;default:f="Oops! Error."}this.showRate(d);qmsg.showAtObj($(b),f,2000)}};this.showRate=function(e){if(e>=0){this.showStars(e)}};this.showOrgRate=function(e){this.showStars(e,true)};this.showStars=function(f,e){if(!a){if(f==0){f=3}for(i=0;i<5;i++){var g="ra0";if((f-i)>0){g=((f-i)==0.5)?"ra1":"ra2"}if(!e){g+="m"}$("star"+(i+1)).className=g}}}};function gosShowWalkthrough(){toggleDisplay("wtdiv")}function gosTabRelGames(){$("tab-content-rel").style.display="";$("tab-content-rev").style.display="none";if($("tab-content-excl")){$("tab-content-excl").style.display="none"}}var __revTabShown=false;__revTabShown=false;function gosTabReviews(){$("tab-content-rev").style.display="";$("tab-content-rel").style.display="none";if($("tab-content-excl")){$("tab-content-excl").style.display="none"}if(!__revTabShown){__revTabShown=true;ajax.update(__reviewsUrl,"tab-content-rev")}}function gosTabReviewsPage(a){ajax.update(__reviewsUrl+"&p="+a,"tab-content-rev")}function gosTabExclusive(){$("tab-content-rev").style.display="none";$("tab-content-rel").style.display="none";$("tab-content-excl").style.display=""}function gosPostReview(a){if(!__userlogin){gosReviewMsg(__userLoginMsg,true)}else{if(a.reviewText.value==""){gosReviewMsg("Your review text is empty!")}else{$("reviewBtn").disabled=true;a.gameId=__gameUname;var b=a.getAttribute("action");var c=function(e){var f=false;if(e==M_SUC){ajax.update(__reviewsUrl,"tab-content-rev");f=true}else{if(e==M_NOAUTH){gosReviewMsg(__userLoginMsg,true)}else{if(e==M_TOOMUCHREV){gosReviewMsg("So many posts in last few minutes",true)}else{gosReviewMsg("Error in your inputs.",true)}}}$("reviewBtn").disabled=f};ajax.post(b,c,ajax.serialize(a))}}return false}function gosReviewMsg(c,a){var b=new GosQMsg();b.showInside($("rev-result"),c,10000);if(a){b.changeClassName("qmsger")}}function gosVoteRev(a,c){c=(c>0)?1:-1;var f=$("rvs"+a);var e=$("rvtu"+a);var h=$("rvtd"+a);var d=(c<0)?e:h;if(!__userlogin){qmsgl(d);return}e.disabled=true;h.disabled=true;qmsgo(d);var g=function(j){e.disabled=false;h.disabled=false;if(j==M_SUC){f.innerHTML=parseInt(f.innerHTML)+c;qmsg.showAtObj(d,"Thanks:)",1000)}else{if(j==M_NOAUTH){qmsgl(d)}else{if(j==M_DUPENT){qmsg.showAtObj(d,"You have already voted this review.",2000)}else{qmsg.showAtObj(d,__errMsg+"("+parseInt(j)+")",2000)}}}};var b=BASE_PATH+"/do/review?cmd=vote&r="+a+"&v="+c+"&k="+__reviewVoteKey;ajax.get(b,g)}gpage=new function GosPage(){this.PTYPE_NORM=1;this.PTYPE_GAME=2;this.ptype=this.PTYPE_NORM;this.username=null;this.login=false;this.refr=null;this.init=function(){this.updateGameTh()};this.updateGameTh=function(){var e=this.findTags("a","class","gthli");for(var c=0;c<e.length;c++){var d=e[c];var b=d.getAttribute("name")+Math.floor(Math.random()*1000);d.setAttribute("name",b+"dov");var a=document.createElement("div");a.setAttribute("id",b+"dov");d.appendChild(a);a.className="gover";a.innerHTML="<span>&nbsp;</span>";d.onmouseover=function(){var f=$(this.getAttribute("name"));f.style.visibility="visible"};d.onmouseout=function(){var f=$(this.getAttribute("name"));f.style.visibility="hidden"}}};this.findTags=function(n,j,b){var d=document.getElementsByTagName(n);var h=new Array();var a=new RegExp(b);var m=(j=="class");for(var f in d){try{if((m&&a.test(d[f].className))||(!m&&a.test(d[f].getAttribute(j)))){h.push(d[f])}}catch(g){}}return h};this.addGameToCookie=function(d){var f=readCookie("gl");if(emp(f)){f="/"+d+"#1/"}else{var c=new RegExp("^.*/"+d+"#[0-9]+/$","g");if(!f.match(c)){var b=new RegExp("/"+d+"#[0-9]+/","g");var e=f.match(b);if(!emp(e)){e+="";e=e.substring(1,e.length-1);var a=e.split("#");a[1]++;e=a[0]+"#"+a[1];f=f.replace(b,"/")+e+"/"}else{f+=d+"#1/"}}while(f.length>400){f=f.substring(f.indexOf("/",1))}}createCookie("gl",f,360)}};GosFlashObject=function(b){var g=1;var d=2;var f=3;var j=-1;var c=-1;var e=b;var m=g;this.fo=null;this.findObj=function(h){if(h&&typeof(h)=="string"){e=h}else{if(h){this.fo=h;return h}}if(window.document[e]){return window.document[e]}if(navigator.appName.indexOf("Microsoft Internet")==-1){if(document.embeds&&document.embeds[e]){return document.embeds[e]}else{return $(e)}}return null};this.size=function(h,n){if(m==f){if(h>=0){j=h}if(n>=0){c=n}}return this};this.resize=function(h,n){if(m==f){this.size(h,n);this.fo.width=j;this.fo.height=c}return this};this.zoom=function(h){if(m==f){zf=1+h*0.1;this.resize(j*zf,c*zf)}return this};this.reload=function(){if(m==f){tfoid=this.fo.getAttribute("id");var n=this.fo.parentNode;var h=n.innerHTML;n.innerHTML="";n.innerHTML=h;this.fo=this.findObj(tfoid)}};this.init=function(){this.fo=this.findObj(e);if(this.fo){j=this.fo.width;c=this.fo.height}};this.init();this.HORIZONTAL=1;this.VERTICAL=2;this.pbar=null;this.pinf=null;this.pwrp=null;this.pmaxs=200;this.pdir=this.HORIZONTAL;var a=null;this.startProgress=function(p,o,h){m=d;if(p){this.pbar=$(p);this.pinf=$(p+"-info");this.pwrp=$(p+"-wrp")}this.pdir=(o)?o:this.VERTICAL;this.pmaxs=(h)?h:this.pmaxs;var n=this;if(this.pbar){a=setInterval(function(){return n.redrawProgress()},100)}else{m=f}return this};this.redrawProgress=function(){var h;if(h=this.fo.PercentLoaded()){newSize=h*this.pmaxs/100;this.pinf.innerHTML="Loading: "+h+"%";if(this.pdir==this.VERTICAL){this.pbar.style.width=newSize+"px"}else{this.pbar.style.height=newSize+"px"}if(newSize>=this.pmaxs){m=f;window.clearInterval(a);this.pwrp.innerHTML=""}}};this.activeGame=function(){m=f}};GosQMsg=function(){var h=1;var b=2;var f=3;var d=80;var g;var e;var c=b;var a=this;this.qbox=null;this.opacity=d;this.w=-1;this.h=-1;this.className="qmsg";this.divId="mbox"+Math.floor(Math.random()*10000);this.showInline=function(n,o,j,m){if(typeof(n)=="string"){n=$(n)}this.build(o,m);document.body.removeChild(this.qbox);switch(j){case 0:n.innerHTML="";n.appendChild(this.qbox);break;case -1:n.parentNode.insertBefore(this.qbox,n);break;case 1:if(n.nextSibling){n.parentNode.insertBefore(this.qbox,n.nextSibling)}else{n.parentNode.appendChild(this.qbox)}break}return this};this.showBefore=function(m,n,j){return this.showInline(m,n,-1,j)};this.showAfter=function(m,n,j){return this.showInline(m,n,1,j)};this.showInside=function(m,n,j){return this.showInline(m,n,0,j)};this.showAtLoc=function(m,j,o,n){this.build(o,n);this.qbox.style.position="absolute";tw=(this.w>0)?this.w:this.qbox.offsetWidth;th=(this.h>0)?this.h:this.qbox.offsetHeight;this.locate(m-tw/2,j-th/2);return this};this.showAtObj=function(p,s,o,q){this.build(s,o);this.qbox.style.position="absolute";var n=gosFindObjLoc(p);var j=(this.w>0)?this.w:this.qbox.offsetWidth;var m=(this.h>0)?this.h:this.qbox.offsetHeight;if(q=="fav"){n.x+=(p.offsetWidth-j)/2;n.y+=28}else{if(q=="over"){n.x+=(p.offsetWidth-j)/2;n.y+=(p.offsetHeight-m)/2}else{n.x+=(p.offsetWidth-j)/2;n.y+=p.offsetHeight+4}}this.locate(n.x,n.y);return this};this.build=function(m,j){if(c==h){clearTimeout(e);this.close()}else{if(c==f){clearInterval(g);this.close()}}c=h;this.opacity=d;this.qbox=document.createElement("div");this.qbox.setAttribute("id",this.divId);document.body.appendChild(this.qbox);this.qbox.innerHTML=m;this.qbox.className=this.className;this.setOpacity();if(j>0){e=setTimeout(this.hide,j)}return this};this.hide=function(){g=setInterval(a.fadeout,50);return a};this.fadeout=function(){c==f;a.opacity-=5;if(a.opacity<6){clearInterval(g);a.close()}else{a.setOpacity()}return a};this.close=function(){c==b;try{this.qbox.parentNode.removeChild(this.qbox)}catch(j){}this.qbox=null;return this};this.setOpacity=function(){if(this.qbox){this.qbox.style.opacity=this.opacity*0.01;this.qbox.style.filter="alpha(opacity="+this.opacity+")"}return this};this.changeOpacity=function(j){this.opacity=j;setOpacity()};this.locate=function(m,j){if(this.qbox){this.qbox.style.position="absolute";this.qbox.style.left=m+"px";this.qbox.style.top=j+"px"}return this};this.size=function(j,m){this.w=j;this.h=m;if(this.w>=0&&this.qbox){this.qbox.style.width=this.w+"px"}if(this.h>=0&&this.qbox){this.qbox.style.height=this.h+"px"}return this};this.resetSize=function(){this.size(0,0)};this.changeMsg=function(j){if(this.qbox){this.qbox.innerHTML=j}return this};this.changeClassName=function(j){this.className=j;if(this.qbox){this.qbox.className=this.className}return this};this.setDivId=function(j){this.divId=j;if(this.qbox){this.qbox.removeAttribute("id");this.qbox.setAttribute("id",this.divId)}return this}};var qmsg=new GosQMsg();function bookmarkPage(a,c){if(window.sidebar){window.sidebar.addPanel(c,a,"")}else{if(window.external){window.external.AddFavorite(a,c)}else{if(window.opera&&window.print){var b=document.createElement("a");b.setAttribute("href",a);b.setAttribute("title",c);b.setAttribute("rel","sidebar");b.click()}}}}function gosFindParentTag(b,a){a=a.toLowerCase();do{b=b.parentNode;if(b&&b.tagName.toLowerCase()==a){return b}}while(b);return null}function gosFindObjLoc(b){var a=new Object();a.x=0;a.y=0;if(b.offsetParent){do{a.x+=b.offsetLeft;a.y+=b.offsetTop;b=b.offsetParent}while(b.offsetParent)}else{if(b.x){a.x+=b.x}if(b.y){a.y+=b.y}}return a}function gosFindRefr(){refr=document.referrer;if(refr!=""){var a=new RegExp("(https|http|ftp)://");host=refr.replace(a,"");host=host.replace(/\/.*/,"");return host}return null}function toggleDisplay(a){a=$(a);a.style.display=(a.style.display=="none")?"":"none"}var ss=new function(){var b;var c;var a;this.scroll=function(d){c=$(d);var e=gosFindObjLoc(c);a=e.y;b=setInterval("ss.intv()",10)};this.intv=function(){var e=this.getTopOff();var f=(a-e)*0.15;if(f>30){f=30}if(f<3){f=3}window.scrollTo(0,e+f);var d=this.getTopOff();if(e==d||d>a){clearInterval(b);window.scrollTo(0,a)}};this.getTopOff=function(){if(document.body&&document.body.scrollTop){return document.body.scrollTop}if(document.documentElement&&document.documentElement.scrollTop){return document.documentElement.scrollTop}if(window.pageYOffset){return window.pageYOffset}return 0}};function createCookie(c,d,e){if(e){var b=new Date();b.setTime(b.getTime()+(e*24*60*60*1000));var a="; expires="+b.toGMTString()}else{var a=""}document.cookie=c+"="+d+a+"; path=/"}function readCookie(b){var e=b+"=";var a=document.cookie.split(";");for(var d=0;d<a.length;d++){var f=a[d];while(f.charAt(0)==" "){f=f.substring(1,f.length)}if(f.indexOf(e)==0){return f.substring(e.length,f.length)}}return null}function eraseCookie(a){createCookie(a,"",-1)}function collect(b,e){var g=[];for(var d=0;d<b.length;d++){var c=e(b[d]);if(c!=null){g.push(c)}}return g}ajax={};ajax.x=function(){try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(a){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(a){return new XMLHttpRequest()}}};ajax.serialize=function(h){var e=function(f){return h.getElementsByTagName(f)};var a=function(f){if(f.name){return encodeURIComponent(f.name)+"="+encodeURIComponent(f.value)}else{return""}};var c=collect(e("input"),function(f){if((f.type!="radio"&&f.type!="checkbox")||f.checked){return a(f)}});var d=collect(e("select"),a);var b=collect(e("textarea"),a);return c.concat(d).concat(b).join("&")};ajax.send=function(e,g,c,d){var b=ajax.x();b.open(c,e,true);b.onreadystatechange=function(){if(b.readyState==4){g(b.responseText)}};if(c=="POST"){b.setRequestHeader("Content-type","application/x-www-form-urlencoded")}b.send(d)};ajax.get=function(a,b){ajax.send(a,b,"GET")};ajax.gets=function(b){var a=ajax.x();a.open("GET",b,false);a.send(null);return a.responseText};ajax.post=function(b,c,a){ajax.send(b,c,"POST",a)};ajax.update=function(a,d){var c=$(d);var b=function(e){c.innerHTML=e};ajax.get(a,b)};ajax.submit=function(a,g,c){var d=$(g);var b=function(e){d.innerHTML=e};ajax.post(a,b,ajax.serialize(c))};