function slideSwitch(){var a=$("#slideshow a.active");if(a.length==0)a=$("#slideshow a:last");var b=a.next().length?a.next():$("#slideshow a:first");a.addClass("last-active");b.css({opacity:0}).addClass("active").animate({opacity:1},1e3,function(){a.removeClass("active last-active")})}function slideHome(){var a=$("#slideshowHome a.active");if(a.length==0)a=$("#slideshowHome a:last");var b=a.next().length?a.next():$("#slideshowHome a:first");a.addClass("last-active");b.css({opacity:0}).addClass("active").animate({opacity:1},1e3,function(){a.removeClass("active last-active")})}$(function(){$("#details a:first").click(function(){window.location="helpdesk.html"});$("#toTop").click(function(){$("html, body").animate({scrollTop:0},500);return false});$("#clientLogin button").click(function(){if($("#clientEmail,#clientPassword").val()!=""){$("#clientEmail,#clientPassword").css({borderColor:"#999"});$("#clientError").html("")}var a=$("input#clientEmail").val(),b=$("input#clientPassword").val(),c=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;if(a==""){$("#clientError").html("Please enter your email address.");$("input#clientEmail").css({borderColor:"red"}).focus();$("#clientPassword").css({borderColor:"#999"});return false}if(c.test(a)==false){$("#clientError").html("Please enter a valid email address.");$("input#clientEmail").css({borderColor:"red"}).focus();$("#clientPassword").css({borderColor:"#999"});return false}if(b==""){$("#clientError").html("Please enter your password.");$("input#clientPassword").css({borderColor:"red"}).focus();$("#clientEmail").css({borderColor:"#999"});return false}});$("input#regTelephone").keypress(function(a){if(a.which!=8&&a.which!=0&&a.which!=13&&(a.which<48||a.which>57)){return false}});$("#clientRegister button").click(function(){if($("#regUser,#regTelephone,#regEmail,#regPassword").val()!=""){$("#regUser,#regTelephone,#regEmail,#regPassword").css({borderColor:"#999"});$("#regError").html("")}var a=$("input#regUser").val(),b=$("input#regTelephone").val(),c=$("input#regEmail").val(),d=$("input#regPassword").val(),e=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;if(a==""){$("#regError").html("Please enter your name.");$("input#regUser").css({borderColor:"red"}).focus();$("#regTelephone,#regEmail,#regPassword").css({borderColor:"#999"});return false}if(b==""){$("#regError").html("Please enter your telephone number.");$("input#regTelephone").css({borderColor:"red"}).focus();$("#regUser,#regEmail,#regPassword").css({borderColor:"#999"});return false}if(b==""||b.length<8){$("#regError").html("Please enter a valid telephone number.");$("input#regTelephone").css({borderColor:"red"}).focus();$("#regUser,#regEmail,#regPassword").css({borderColor:"#999"});return false}if(c==""){$("#regError").html("Please enter your email address.");$("input#regEmail").css({borderColor:"red"}).focus();$("#regUser,#regTelephone,#regPassword").css({borderColor:"#999"});return false}if(e.test(c)==false){$("#regError").html("Please enter a valid email address.");$("input#regEmail").css({borderColor:"red"}).focus();$("#regUser,#regTelephone,#regPassword").css({borderColor:"#999"});return false}if(d==""){$("#regError").html("Please enter a password.");$("input#regPassword").css({borderColor:"red"}).focus();$("#regUser,#regTelephone,#regEmail").css({borderColor:"#999"});return false}if(d.length<7){$("#regError").html("Your password must be more than 7 characters.");$("input#regPassword").css({borderColor:"red"}).focus();$("#regUser,#regTelephone,#regEmail").css({borderColor:"#999"});return false}});$("#forgotPassword button").click(function(){if($("input#forgotEmail").val()!=""){$("#forgotEmail").css({borderColor:"#999"});$("#forgotError").html("")}var a=$("input#forgotEmail").val(),b=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;if(a==""){$("#forgotError").html("Please enter your email address.");$("input#forgotEmail").css({borderColor:"red"}).focus();return false}if(b.test(a)==false){$("#forgotError").html("Please enter a valid email address.");$("input#forgotEmail").css({borderColor:"red"}).focus();return false}});$("#techLogin button").click(function(){if($("input#techName,input#techPassword").val()!=""){$("#techName,#techPassword").css({borderColor:"#999"});$("#techError").html("")}var a=$("input#techName").val(),b=$("input#techPassword").val();if(a==""){$("#techError").html("Please your login name.");$("input#techName").css({borderColor:"red"}).focus();return false}if(b==""){$("#techError").html("Please enter your password.");$("input#techPassword").css({borderColor:"red"}).focus();return false}});$("a#forgot").click(function(){$("#clientEmail,#clientPassword").css({borderColor:"#999"});$("#clientError").html("");$("#clientLogin").fadeOut(500,function(){$("#forgotPassword").fadeIn(500)});return false});$("a#technician").click(function(){$("#clientEmail,#clientPassword,#forgotEmail,#techName,#techPassword").css({borderColor:"#999"});$("#clientError,#forgotError,#techError").html("");$("#clientLogin").fadeOut(500,function(){$("#techLogin").fadeIn(500)});return false});$("a#userLogin").click(function(){$("#clientEmail,#clientPassword").css({borderColor:"#999"});$("#clientError").html("");$("#techLogin").fadeOut(500,function(){$("#clientLogin").fadeIn(500)});return false});$("a#userLogin1").click(function(){$("#forgotEmail").css({borderColor:"#999"});$("#forgotError").html("");$("#forgotPassword").fadeOut(500,function(){$("#clientLogin").fadeIn(500)});return false});$("a#copyright").append("CTC Computer Services ©"+(new Date).getFullYear());var a=[];$.preLoadImages=function(){var b=arguments.length;for(var c=b;c--;){var d=document.createElement("img");d.src=arguments[c];a.push(d)}};$.preLoadImages("images/screen/validCSS-hover-trans.png","images/screen/validXHTML-hover-trans.png","images/contact/marker-hover-trans.png","images/contact/directions-hover-trans.png","images/enquiry/send-button-hover.png","images/contact/shadow-trans.png");$.fn.clearForm=function(){return this.each(function(){var a=this.type,b=this.tagName.toLowerCase();if(b=="form")return $(":input",this).clearForm();if(a=="text"||a=="password"||b=="textarea")this.value="";else if(a=="checkbox"||a=="radio")this.checked=false;else if(b=="select")this.selectedIndex=-1})};$("form").clearForm();$("input#dir_val").val("ENTER A POSTCODE").css({color:"#999",fontStyle:"italic",width:"150px"});$("input#dir_val").focus(function(){if($(this).val()!=""&&$(this).val()!="ENTER A POSTCODE"){$(this).css({color:"#666",fontStyle:"normal",width:"150px"})}else{$(this).val("").css({color:"#666",fontStyle:"normal",width:"150px"})}});$("input#dir_val").blur(function(){if($(this).val()==""||$(this).val()=="ENTER A POSTCODE"){$("input#dir_val").val("ENTER A POSTCODE").css({color:"#999",fontStyle:"italic",width:"150px"})}});$("form#dir").submit(function(){if($("input#dir_val").val()==""||$("input#dir_val").val()=="ENTER A POSTCODE"){return false}});$("input#enquiry_telephone").keypress(function(a){if(a.which!=8&&a.which!=0&&a.which!=13&&(a.which<48||a.which>57)){return false}});$("input#enquiry_telephone").bind("paste",function(){return false});$("#enquiry_submit").click(function(){$("#enquiry_error").css({color:"red"});if($("#enquiry_name,#enquiry_email,#enquiry_telephone,#enquiry_message").val()!=""){$("#enquiry_name,#enquiry_email,#enquiry_telephone,#enquiry_message").css({borderColor:"#999"})}var a=$("input#enquiry_name").val();if(a==""){$("#enquiry_error").html("Please enter your name.");$("input#enquiry_name").css({borderColor:"red"});$("#enquiry_email,#enquiry_telephone,#enquiry_message").css({borderColor:"#999"});$("input#enquiry_name").focus();return false}var b=$("input#enquiry_email").val();if(b==""){$("#enquiry_error").html("Please enter your email address.");$("input#enquiry_email").css({borderColor:"red"});$("#enquiry_name,#enquiry_telephone,#enquiry_message").css({borderColor:"#999"});$("input#enquiry_email").focus();return false}var c=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;if(c.test(b)==false){$("#enquiry_error").html("Please enter a valid email address.");$("input#enquiry_email").css({borderColor:"red"});$("#enquiry_name,#enquiry_telephone,#enquiry_message").css({borderColor:"#999"});$("input#enquiry_email").focus();return false}var d=$("input#enquiry_telephone").val();if(d==""||$("input#enquiry_telephone").val().length<6){$("#enquiry_error").html("Please enter your telephone number.");$("input#enquiry_telephone").css({borderColor:"red"});$("#enquiry_name,#enquiry_email,#enquiry_message").css({borderColor:"#999"});$("input#enquiry_telephone").focus();return false}var e=$("textarea#enquiry_message").val();if(e==""||$("textarea#enquiry_message").val().length<15){$("#enquiry_error").html("Please enter your enquiry.");$("textarea#enquiry_message").css({borderColor:"red"});$("#enquiry_name,#enquiry_email,#enquiry_telephone").css({borderColor:"#999"});$("textarea#enquiry_message").focus();return false}var f=$("input#enquiry_company").val();var g=$("input#enquiry_position").val();var h=$("input#enquiry_website").val();var i="enquiry_name="+a+"&enquiry_email="+b+"&enquiry_telephone="+d+"&enquiry_message="+e+"&enquiry_company="+f+"&enquiry_position="+g+"&enquiry_website="+h;$.ajax({type:"POST",url:"enquiry.php",data:i,dataType:"html",beforeSend:function(){$("#enquiry_error").html("Sending information...").css({color:"#EE7600"})},error:function(){$("#enquiry_error").html("Oops there seems to be a problem, please try again later.").css({color:"red"})},timeout:4e3,success:function(){$("form").clearForm();$("#enquiry_error").html("Thank you for your enquiry, we will be in touch soon.").css({color:"green"});$("#enquiry_name,#enquiry_email,#enquiry_telephone,#enquiry_message").css({borderColor:"#999"})}});return false});$("#slideshow a:first").addClass("active");setInterval("slideSwitch()",9e3);$("#slideshow a").click(function(){var a=$(this).attr("href");var b=a.substring(a.lastIndexOf("#")+1);var c=$("#"+b).offset().top+2;$("html, body").animate({scrollTop:c},1e3);return false});$("#slideshowHome a:first").addClass("active");setInterval("slideHome()",25e3);$("#nav").each(function(){function h(a,b){d.each(function(){$.dequeue(this,"fx")}).animate({width:100,marginLeft:a.offsetLeft},350,"linear",function(){setTimeout(function(){document.location.href=b},250)})}function g(a){d.css({marginLeft:a.offsetLeft+"px",width:"100px"});f=a}var a=$(this);var b=function(){};var c;if($.browser.msie&&$.browser.version==7){var d=$('<li class="slider"></li>').prependTo(a)}else{var d=$('<li class="slider"></li>').appendTo(a)}var e=$("li",this);var f=$("li.current",this)[0]||$(e[0]).addClass("current")[0];e.not(".slider").click(function(){c=$("a",this).attr("href");h(this,c);return false});g(f);});var b=$("#slide_container").width();var c=$("#slides li img").size();var d=b*c;$("#slide_control a:first").addClass("active");$("#slide_link a").attr("href",$("#slide_control a:first").attr("href"));$("#slides").css({width:d});rotate=function(){var a=$active.attr("rel")-1;var c=a*b;$("#slide_control a").removeClass("active");$active.addClass("active");$("#slide_link a").attr("href",$active.attr("href"));$("#slides").animate({left:-c},500)};rotateSwitch=function(){play=setInterval(function(){$active=$("#slide_control a.active").next();if($active.length===0){$active=$("#slide_control a:first")}rotate()},15e3)};rotateSwitch();$("#slides li,#slide_control a").mouseover(function(){clearInterval(play)});$("#slides li").mouseout(function(){rotateSwitch()});$("#slide_control a").click(function(){$active=$(this);$("#slide_link a").attr("href",$(this).attr("href"));clearInterval(play);rotate();return false})})
