$(document).ready(function(){$(".menu-select").click(function(){$(this).next(".menu-content").slideToggle(600)});$(".tipsy").tipsy();$("#search").click(function(){if($(this).val()=="Game Search"){$(this).css({color:"black"});$(this).val("")}else{if($(this).val()&&$(this).val()!="Game Search"){$(this).css({color:"black"})}else{}}});$("#search").blur(function(){if($(this).val()=="Game Search"){$(this).css({color:"#939090"})}else{if($(this).val()&&$(this).val()!="Game Search"){$(this).css({color:"black"})}else{$(this).val("Game Search");$(this).css({color:"#939090"})}}});$("ul.tabs li:first").addClass("active").show();$(".tab_content:first").show();$("ul.tabs li").click(function(){$("ul.tabs li").removeClass("active");$(this).addClass("active");$(".tab_content").hide();var activeTab=$(this).find("a").attr("href");$(activeTab).fadeIn();recreate_cycle();return false});$(".loopedslider").loopedSlider();recreate_cycle();$("input[type=file]").filestyle({image:"/templates/colorsplash/images/browse.png",imageheight:21,imagewidth:78,width:122});$(".skip .nicebtn a").addClass("round large red button");$(".skip .nicebtn a").html("<span>"+$(".skip .nicebtn a").html()+"</span>");$("#showLogin").click(function(){$.blockUI({message:$("#loginForm"),fadeIn:700,fadeOut:700,centerY:true,centerX:true,css:{width:"570px",border:"3px solid #0E59AE",padding:"10px",backgroundColor:"#E4F6FF","-webkit-border-radius":"10px","-moz-border-radius":"10px"}});$(".blockOverlay").attr("title","Click to unblock").click($.unblockUI)});$("#staticBarLogin").click(function(){$("#showLogin").click();return false});$("#commentLogin").click(function(){$("#redirecturl").val(window.location);$("#showLogin").click();return false});$("#loginForm").validate({rules:{username:{required:true},password:{required:true}},messages:{username:{required:"Enter username."},password:{required:"Enter password."}},submitHandler:function(){$("#loginForm").ajaxSubmit({url:$("#loginForm").attr("action"),type:$("#loginForm").attr("method"),timeout:20000,beforeSubmit:function(){$("#loginForm .submitBtn").hide();$("#loginForm .loader").show();$("#loginForm .textbox").attr("disabled",true)},error:function(xhr,desc,e){var msg=(desc=="timeout")?"Connection 20 sec Time Out, Please try again Later.":desc;alert("Failed to login: "+msg)},success:function(msg){msg=jQuery.trim(msg);var msg_arr=msg.split("||");switch(msg_arr[0]){case"1":if($("#redirecturl").val()){$("#loginForm .successMsg").html("Welcome back. Please wait, we are refreshing the page...");$("#loginForm .successMsg").fadeIn(300,function(){window.location.replace($("#redirecturl").val())})}else{$("#loginForm .successMsg").html(msg_arr[1]);$("#loginForm .successMsg").fadeIn(300,function(){window.location.replace(msg_arr[2])})}break;case"0":$("#loginForm .errorMsg").html(msg_arr[1]);$("#loginForm .textbox").attr("disabled",false);$("#loginForm #username").select();$("#loginForm .errorMsg").fadeIn().delay(300).fadeOut(4000);break;default:alert(msg);break}},complete:function(){$("#loginForm .submitBtn").show();$("#loginForm .loader").hide();$("#loginForm").clearForm()}})}});$("#signUpForm").validate({rules:{newusername:{required:true},newpasswordone:{required:true},newpasswordtwo:{required:true,equalTo:"#newpasswordone"},newemailaddress:{required:true,email:true}},messages:{newusername:{required:"Enter username."},newpasswordone:{required:"Enter password."},newpasswordtwo:{required:"Enter password.",equalTo:"Please enter the same password again."},newemailaddress:{required:"Enter e-mail.",email:"Invalid e-mail format."}},submitHandler:function(){$("#signUpForm").ajaxSubmit({url:$("#signUpForm").attr("action"),type:$("#signUpForm").attr("method"),timeout:20000,beforeSubmit:function(){$("#signUpForm .submitBtn").hide();$("#signUpForm .loader").show();$("#signUpForm .textbox").attr("disabled",true)},error:function(xhr,desc,e){var msg=(desc=="timeout")?"Connection 20 sec Time Out, Please try again Later.":desc;alert("Failed to login: "+msg)},success:function(msg){msg=jQuery.trim(msg);var msg_arr=msg.split("||");switch(msg_arr[0]){case"2":$("#signUpForm .successMsg").html(msg_arr[1]);$("#signUpForm").clearForm();$("#signUpForm .textbox").attr("disabled",false);$("#signUpForm .successMsg").fadeIn(300,function(){window.location.replace(msg_arr[2])});break;case"1":$("#signUpForm .successMsg").html(msg_arr[1]);$("#signUpForm").clearForm();$("#signUpForm .textbox").attr("disabled",false);$("#signUpForm .successMsg").fadeIn(300,function(){});break;case"0":$("#signUpForm .errorMsg").html(msg_arr[1]);$("#signUpForm .textbox").attr("disabled",false);$("#signUpForm #newusername").select();$("#signUpForm .errorMsg").fadeIn().delay(300).fadeOut(4000);break;default:alert(msg);break}},complete:function(){$("#signUpForm .submitBtn").show();$("#signUpForm .loader").hide()}})}});$("#contactForm").validate({rules:{sender_name:{required:true},sender_email:{required:true,email:true},mail_comments:{required:true}},messages:{sender_name:{required:"Enter your name."},sender_email:{required:"Enter e-mail.",email:"Invalid e-mail format."},mail_comments:{required:"Enter your message."}},submitHandler:function(){$("#contactForm").ajaxSubmit({url:$("#contactForm").attr("action"),type:$("#contactForm").attr("method"),timeout:20000,beforeSubmit:function(){$("#contactForm .submitBtn").hide();$("#contactForm .loader").show();$("#contactForm .textbox").attr("disabled",true)},error:function(xhr,desc,e){var msg=(desc=="timeout")?"Connection 20 sec Time Out, Please try again Later.":desc;alert("Failed to login: "+msg)},success:function(msg){msg=jQuery.trim(msg);var msg_arr=msg.split("||");switch(msg_arr[0]){case"1":$("#contactForm .successMsg").html(msg_arr[1]);$("#contactForm").clearForm();$("#contactForm .textbox").attr("disabled",false);$("#contactForm .successMsg").fadeIn(300);break;case"0":$("#contactForm .errorMsg").html(msg_arr[1]);$("#contactForm .textbox").attr("disabled",false);$("#contactForm #newusername").select();$("#contactForm .errorMsg").fadeIn().delay(300).fadeOut(4000);break;default:alert(msg);break}},complete:function(){$("#contactForm .submitBtn").show();$("#contactForm .loader").hide()}})}})});recreate_cycle=function(){var stack=[];$("#slideFeatured img").each(function(){var img=new Image(236,312);img.src=$(this).attr("src");$(img).bind("load",function(){stack.push(this)})});$(".slideFeatured img").bind("load",function(){$(this).load()});$("#latestFeaturedGames .slideFeatured").cycle("destroy");$("#latestFeaturedGames .featuredPage .pages").html("");$("#latestFeaturedGames .slideFeatured").cycle({cleartype:!$.support.opacity,cleartypeNoBg:false,timeout:3000,pauseOnPagerHover:true,pager:"#latestFeaturedGames .featuredPage .pages",prev:"#latestFeaturedGames .prev-page",next:"#latestFeaturedGames .next-page"});$("#topFeaturedGames .slideFeatured").cycle("destroy");$("#topFeaturedGames .featuredPage .pages").html("");$("#topFeaturedGames .slideFeatured").cycle({cleartype:!$.support.opacity,cleartypeNoBg:false,speed:"slow",timeout:3000,pauseOnPagerHover:true,pager:"#topFeaturedGames .featuredPage .pages",prev:"#topFeaturedGames .prev-page",next:"#topFeaturedGames .next-page"})};
