var ajax;var prettyPhotoLoaded;$(document).ready(function(){$("#tabs").tabs();if(window.location.hash=="#friends"){$("#tabs").tabs("select",1)}if(window.location.hash=="#messages"){$("#tabs").tabs("select",3)}$("#view-message-link").click(function(){$("#tabs").tabs("select",3)});featured_games_animation();$(".stranger .links li a").click(function(){var target=$(this).attr("href").replace("#","");$(".stranger .links li a").removeClass("current");$(this).addClass("current");$(".stranger form").hide();$(".stranger #"+target).show();return false});$("#mainTab .tabTitle li a").click(function(){$("#mainTab .tabTitle li a").removeClass("current");var target=$(this).attr("href").replace("#","");$(this).addClass("current");$("#mainTab .tabContent ul").hide();$("#mainTab .tabContent ."+target).show();return false});$("#gameTagSection .tabTitle li a").click(function(){$("#gameTagSection .tabTitle li a").removeClass("current");var target=$(this).attr("href").replace("#","");$(this).addClass("current");$("#gameTagSection .tabContent ul").hide();$("#gameTagSection .tabContent ."+target).show();return false});$("a[rel^='prettyPhoto']").prettyPhoto();$("input[type=file]").filestyle({image:"/templates/colorsplash/js/images/browse.png",imageheight:21,imagewidth:78,width:122});$("#birthday").datepicker({changeMonth:true,changeYear:true,yearRange:"-100:-13",dateFormat:"yy-mm-dd",maxDate:"-13y",onSelect:function(dateText,inst){}});$("a[rel]").overlay({mask:"#000",effect:"apple",onBeforeLoad:function(){$(".swfFile").css({"margin-left":"2000px"})},onLoad:function(){$(".swfFile").css({"margin-left":"2000px"})},onClose:function(){$(".swfFile").css({"margin-left":"0"})}});$("ul.sf-menu").superfish();$("#editProfileForm").validate({rules:{email:{required:true}},messages:{email:{required:"Required"}},submitHandler:function(){$("#editProfileForm").ajaxSubmit({url:$("#editProfileForm").attr("action"),type:$("#editProfileForm").attr("method"),timeout:600000,beforeSubmit:function(){$("#editProfileForm #save").hide();$("#editProfileForm .loader").show();$("ul.acfb-holder li span").each(function(i){$("#gametype").val($("#gametype").val()+"|"+$(this).html()+"|")});return},error:function(xhr,desc,e){var msg=(desc=="timeout")?"Connection Time Out, Please try again Later.":desc;alert("Failed to signup: "+msg)},success:function(msg){msg=msg.replace("<head></head><body>","");msg=msg.replace("</body>","");var msg_arr=msg.split("||");switch(msg_arr[0]){case"1":$("#editProfileForm").clearForm();$("#editProfileForm .suc").html(msg_arr[1]);$("#editProfileForm .suc").fadeIn(300).delay(2000,function(){$(location).attr("href",msg_arr[2])});break;case"0":$("#editProfileForm .err").html(msg_arr[1]);$("#editProfileForm .err").fadeIn().delay(300).fadeOut(4000);break;default:alert(msg)}},complete:function(){$("#editProfileForm #save").show();$("#editProfileForm .loader").hide()}})}});$("a[alt]").overlay({mask:"#000",effect:"apple",onBeforeLoad:function(){$(".swfFile").css({"margin-left":"2000px"})},onLoad:function(){$(".swfFile").css({"margin-left":"2000px"})},onClose:function(){$(".swfFile").css({"margin-left":"0"})}})});var delay=(function(){var timer=0;return function(callback,ms){clearTimeout(timer);timer=setTimeout(callback,ms)}})();jq_rate=function(gameid,myrating){$.post("/action.php?do=rate_game&gameid="+gameid+"&myrating="+myrating,function(data){var data_arr=data.split("||");switch(data_arr[0]){case"1":$("#votenow").html(data_arr[1]);break;case"0":alert(data_arr[1]);break;default:alert(data);break}return false})};featured_games_animation=function(){$("#featured .topgames .pager").css({"z-index":$("#featured .topgames ul li").size()+1});var stack=[];$("#featured .topgames img").each(function(){var img=new Image(350,220);img.src=$(this).attr("src");$(img).bind("load",function(){stack.push(this)})});$("#featured .newgames .picture img").each(function(){var img=new Image(62,62);img.src=$(this).attr("src");$(img).bind("load",function(){stack.push(img.src)})});$("#featured .topgames img").bind("load",function(){$(this).load()});$("#featured .newgames .picture img").bind("load",function(){$(this).load()});$("#featured .topgames ul").cycle({fx:"scrollHorz",cleartype:!$.support.opacity,cleartypeNoBg:false,speed:"slow",timeout:3000,pauseOnPagerHover:true,pager:"#featured .topgames .pager"});$("#featured .newgames .verticalItems").cycle({cleartype:!$.support.opacity,cleartypeNoBg:false,fx:"scrollUp",speed:"slow",timeout:10000,pauseOnPagerHover:true})};
