function searchSubmit(a,b){value=div("search_textbox").value;value=value.replace(" ","+");window.location=a+"/search/"+value+b}function resizeFullscreen(){if(fullscreen_active==1){ResizeFlash(glHeight,glWidth)}}function ResetFlash(){if(navigator.appName!="Microsoft Internet Explorer"){div("eID").setAttribute("width",glWidth);div("eID").setAttribute("height",glHeight)}else{div("ieID").setAttribute("width",glWidth);div("ieID").setAttribute("height",glHeight)}div("ava-game_container").className="flash_nopopup";div("ava-game_container").style.marginLeft="0px";div("overlay").style.display="none";div("close_fs").style.display="none";fullscreen_active=0}function ResizeFlash(a,b){wHeight=GetHeight();glHeight=a;glWidth=b;w1=wHeight/a;w2=b*w1;halfWidth=w2/2;if(navigator.appName!="Microsoft Internet Explorer"){div("eID").setAttribute("width",w2);div("eID").setAttribute("height",wHeight)}else{div("ieID").setAttribute("width",w2);div("ieID").setAttribute("height",wHeight)}div("ava-game_container").className="flash_popup";div("ava-game_container").style.marginLeft="-"+halfWidth+"px";div("overlay").style.display="inline";page_height=getDocHeight();div("overlay").style.height=page_height+"px";FadeDiv("overlay",0,"up",.5);div("overlay").onclick=ResetFlash;div("close_fs").style.display="inline";fullscreen_active=1}function GetHeight(){var a=0;if(self.innerHeight){a=self.innerHeight}else if(document.documentElement&&document.documentElement.clientHeight){a=document.documentElement.clientHeight}else if(document.body){a=document.body.clientHeight}return a}function getDocHeight(){var a=document;return Math.max(Math.max(a.body.scrollHeight,a.documentElement.scrollHeight),Math.max(a.body.offsetHeight,a.documentElement.offsetHeight),Math.max(a.body.clientHeight,a.documentElement.clientHeight))}function FadeDiv(a,b,c,d){if(b<d){b=b+.08;div(a).style.opacity=b;setTimeout('FadeDiv("'+a+'", '+b+', "up", '+d+")",10)}}function HidePopup(a){div("ava-popup").style.display="none";div("overlay").style.display="none";div("ava-game_container").style.visibility="visible"}function ShowPopup(a,b,c){AjaxPost(b,"",function(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){div(a+"-content").innerHTML=xmlHttp.responseText;div("ava-game_container").style.visibility="hidden";div(a+"-title").innerHTML=c;div(a).style.display="inline";div("overlay").style.display="inline";page_height=getDocHeight();div("overlay").style.height=page_height+"px";FadeDiv("overlay",0,"up",.5);div("overlay").onclick=HidePopup}})}function ShowJsPopup(a,b,c){window.open(b,"mywindow","menubar=1,resizable=1,width=620,height=250")}function SendReport(a,b,c){div("report_submit").disabled=true;div("report_submit").value="Reporting game...";thereport=div("the_report").value;AjaxPost(b+"/includes/view_game/ajax/add_report.php","report="+thereport+"&id="+a+"&type="+c,function(){div("report_submit").disabled=true;div("report_submit").value="Game Reported!";HidePopup("ava-popup")})}function DeleteHighscore(a,b){AjaxPost(b+"/admin/includes/delete_highscore.php?","id="+a,function(){div("game_highscore"+a).style.display="none"})}function HighscorePage(a,b,c,d,e){div("highscores_ajax").style.opacity=.5;div("highscore_pages").innerHTML='<img src="'+d+'/images/loader.gif" />';if(e==1){lb=div("leaderboard_select").value}else{lb=c}AjaxPost(d+"/includes/view_game/highscores.inc.php?id="+a+"&page="+b+"&lb_id="+lb,"",function(){div("highscores_ajax").innerHTML=xmlHttp.responseText;div("highscores_ajax").style.opacity=1;lastHSpage=b})}function countdown(){if(currentsecond!=1){currentsecond-=1;div("zzz").innerHTML=currentsecond}else{ShowGame();return}setTimeout("countdown()",1e3)}function ShowGame(){div("ava-game_container").style.display="inline";div("ava-advert_container").style.display="none"}function DeleteNewsComment(a,b){AjaxPost(b+"/admin/includes/delete_news_comment.php","id="+a,function(){div("comment-"+a).style.display="none"})}function DeleteComment(a,b){AjaxPost(b+"/admin/includes/delete_comment.php","id="+a,function(){div("comment-"+a).style.display="none"})}function clickrecall(a,b){if(a.value==""){a.value=b}}function clickclear(a,b){if(a.value==b){a.value=""}}function EnableButton(){div("comment_submit").value="Add comment";div("comment_submit").disabled=false}function AddComment(a,b,c){if(div("the_comment").value!=""){div("comment_submit").disabled=true;div("comment_submit").value="Adding comment...";thecomment=div("the_comment").value;if(c=="game"){post_url="/includes/view_game/ajax/add_comment.php"}else{post_url="/includes/news/ajax/news_add_comment.php"}AjaxPost(b+post_url,"comment="+thecomment+"&id="+a,function(){if(xmlHttp.readyState==4||xmlHttp.readyState=="complete"){if(xmlHttp.responseText==""){alert("An error occured in sending your comment")}else if(xmlHttp.responseText=="<e1>"){alert("Please wait 60 seconds between comments");div("comment_submit").value="Add comment";div("comment_submit").disabled=false}else{if(c=="game"){var a=document.getElementById("comment_list")}else{var a=document.getElementById("news_comment_list")}var b=document.createElement("li");b.innerHTML=xmlHttp.responseText;a.insertBefore(b,a.firstChild);window.location.hash="1";div("comment_submit").value="Comment added!";div("the_comment").value="";setTimeout("EnableButton()",3e4)}}})}}function AddFav(a,b,c,d,e){AjaxPost(c+"/includes/view_game/ajax/add_fav.php","id="+a,function(){});if(b==0){div("favbutton").innerHTML='<a href="#" onclick="AddFav('+a+", 1, '"+c+"', '"+d+"', '"+e+"'); return false\">"+d+"</a>"}else{div("favbutton").innerHTML='<a href="#" onclick="AddFav('+a+", 0, '"+c+"', '"+d+"', '"+e+"'); return false\">"+e+"</a>"}}function sendRate(a,b,c){AjaxPost(c+"/includes/view_game/ajax/add_rating.php","id="+b+"&rating="+a.title,function(){})}function rateIt(a,b,c){if(!rated){preSet=a;rated=1;sendRate(a,b,c);rating(a)}}function off(a){if(!rated){if(!preSet){for(i=1;i<=sMax;i++){document.getElementById("_"+i).className=""}}else{rating(preSet)}}}function rating(b){sMax=0;for(n=0;n<b.parentNode.childNodes.length;n++){if(b.parentNode.childNodes[n].nodeName=="A"){sMax++}}if(!rated){s=b.id.replace("_","");a=0;for(i=1;i<=sMax;i++){if(i<=s){document.getElementById("_"+i).className="on";holder=a+1;a++}else{document.getElementById("_"+i).className=""}}}}function div(a){return document.getElementById(a)}function AjaxPost(a,b,c){xmlHttp=GetXmlHttpObject();if(xmlHttp==null){alert("Your browser doesn't support AJAX. You should upgrade it!");return}xmlHttp.onreadystatechange=c;xmlHttp.open("POST",a,true);xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlHttp.send(b)}function GetXmlHttpObject(){var a=null;try{a=new XMLHttpRequest}catch(b){try{a=new ActiveXObject("Msxml2.XMLHTTP")}catch(b){a=new ActiveXObject("Microsoft.XMLHTTP")}}return a}var sMax;var holder;var preSet;var rated;var lastHSpage;var glWidth;var glHeight;var fullscreen_active;window.onresize=resizeFullscreen;currentsecond=15
