$(document).ready(function(){$("#uploadify").uploadify({uploader:"js/uploadify.swf",script:"js/uploadify.php",cancelImg:"images/uploadify/cancel3.png",buttonImg:"images/uploadify/choose_file213.png",rollover:true,width:82,height:25,folder:"uploads",queueID:"fileQueue",auto:true,multi:false,sizeLimit:3670016,fileDesc:"Image Files",fileExt:"*.jpg;*.jpeg;*.png;*.gif;*.tiff;*.bmp",wmode:"transparent",onComplete:function(B,y,A,z,C){$("#filename").val(A.name);$("#uploadedfilename").val(z);$("#submit").removeAttr("disabled")},onProgress:function(A,y,z,B){$("#submit").attr("disabled","disabled")}});var e=9;var l=0;var f=525;var p=$(".slide");var s=p.length;$("#slidesContainer").css("overflow","hidden");p.wrapAll('<div id="slideInner"></div>').css({"float":"left",width:f});$("#slideInner").css("width",f*s);$("#slideshow").prepend('<span class="control" id="leftControl">Move left</span>').append('<span class="control" id="rightControl">Move right</span>');g(l);d(l);$(".control").bind("click",function(){l=($(this).attr("id")=="rightControl")?l+1:l-1;h(l,"easeInOutQuad",600)});function g(y){if(y==0){$("#leftControl").fadeOut(500)}else{$("#leftControl").fadeIn(500)}if(y==s-1){$("#rightControl").fadeOut(500)}else{$("#rightControl").fadeIn(500)}}function d(y){if(y<=e-1){$("#tabP").css("background-position","0 -25px");$("#tabBP").css("background-position","0 0")}else{$("#tabP").css("background-position","0 0");$("#tabBP").css("background-position","0 -25px")}}$(".slidetab").bind("click",function(){switch($(this).attr("id")){case"tabP":l=0;break;case"tabBP":l=e;break}h(l,"easeInOutQuad",1200)});var c=0;var q=644;var o=$(".mainslide");var i=o.length;$("#mainContainer").css("overflow","hidden");o.wrapAll('<div id="mainSlideInner"></div>').css({"float":"left",width:q});$("#mainSlideInner").css("width",q*i);j(c);$(".tab").bind("click",function(){switch($(this).attr("id")){case"tabHome":c=0;break;case"tabClients":c=1;break;case"tabEnquiries":c=2;break}j(c);jQuery.easing.def="easeInOutQuad";$("#mainSlideInner").animate({marginLeft:q*(-c)},600)});function j(y){switch(y){case 0:$("#tabHome").css("background-position","0 -25px");$("#tabClients").css("background-position","0 0");$("#tabEnquiries").css("background-position","0 0");if($("#maintabsslider").height()!=146){$("#maintabsslider").animate({height:"146px"},300);$("#maintabsslider #mainContainer").animate({height:"146px"},300)}break;case 1:$("#tabClients").css("background-position","0 -25px");$("#tabHome").css("background-position","0 0");$("#tabEnquiries").css("background-position","0 0");if($("#maintabsslider").height()!=194){$("#maintabsslider").animate({height:"194px"},300);$("#maintabsslider #mainContainer").animate({height:"194px"},300)}break;case 2:$("#tabEnquiries").css("background-position","0 -25px");$("#tabHome").css("background-position","0 0");$("#tabClients").css("background-position","0 0");if($("#maintabsslider").height()!=290){$("#maintabsslider").animate({height:"290px"},300);$("#maintabsslider #mainContainer").animate({height:"290px"},300)}break}}var r=0;var k=0;var n=$(".galSlide");var b=n.length;var v=0;var m=[];m[0]=0;$(".galSlide").each(function(y){currentSlideWidth=$(this).outerWidth(true);v+=currentSlideWidth;if(y<b-1){m[y+1]=m[y]+currentSlideWidth}});var a=v-$("#galleryContainer").outerWidth();var x=0;while(m[x]<a&&x<b){x++}$("#galleryContainer").css("overflow","hidden");$("#galleryslider").hide();n.wrapAll('<div id="galSlideInner"></div>').css({"float":"left",});$("#galSlideInner").css("width",v);$("#gallerymain").prepend('<span class="gallerycontrol" id="galleryLeftControl">Prev</span>').append('<span class="gallerycontrol" id="galleryRightControl">Next</span>');$("#galleryexpander").bind("click",function(){var z="url(images/ui/uparrow200.png)";var y="url(images/ui/downarrow200.png)";if($("#gallery").height()==14){jQuery.easing.def="easeInQuad";$("#gallery").animate({height:"110px"},700);$("#gallerymain").animate({height:"92px"},700);$("#galleryslider").fadeIn(1200);$(this).css("background-image",z)}else{if($("#gallery").height()==110){$(".gallerycontrol").fadeOut(500);$("#galleryslider").fadeOut(500);jQuery.easing.def="easeInBack";$("#gallery").animate({height:"14px"},700);$("#gallerymain").animate({height:"0px"},700);$(this).css("background-image",y)}}u(k)});function u(y){if(y<=0){$("#galleryLeftControl").fadeOut(500)}else{$("#galleryLeftControl").fadeIn(500)}if(y>=a){$("#galleryRightControl").fadeOut(500)}else{$("#galleryRightControl").fadeIn(500)}}$(".gallerycontrol").bind("click",function(){r=t(k);if($(this).attr("id")=="galleryLeftControl"&&r>0){r--}else{if($(this).attr("id")=="galleryRightControl"&&r<(x)){r++}}var y=m[r];if(y>a){y=a}w(y,"easeInOutQuad",150);$("#galleryslider").slider("value",y)});$(".galSlide").bind("click",function(){l=$(this).attr("id")-1;h(l,"easeInOutQuad",1000)});function t(z){var y=0;$(".galSlide").each(function(A){if((z>=y)&&(z<(y+$(this).outerWidth(true)))){slidenumber=A}y+=$(this).outerWidth(true)});return slidenumber}$("#galleryslider").slider({min:0,max:a,animate:true,start:function(z,y){},stop:function(z,y){},slide:function(z,y){k=y.value;$("#galSlideInner").css("margin-left",-y.value);u(y.value)}});$("#galleryContainer").mousewheel(function(y,A){r=t(k);if(A>0){if(r>0){r--}}else{if(A<0){if(r<(x)){r++}}}var z=m[r];if(z>a){z=a}w(z,"easeInOutQuad",150);$("#galleryslider").slider("value",z);y.stopPropagation();y.preventDefault()});$(".slide").mousewheel(function(y,z){if(z>0){if(l>0){l-=1}}else{if(z<0){if(l<s-1){l+=1}}else{return false}}h(l,"easeInOutQuad",150);y.stopPropagation();y.preventDefault()});function h(y,A,z){g(y);d(y);jQuery.easing.def=A;$("#slideInner").animate({marginLeft:f*(-y)},z)}function w(y,A,z){u(y);k=y;jQuery.easing.def=A;$("#galSlideInner").animate({marginLeft:-y},z)}$("#tabP").hover(function(){if(l>8){$("#tabP").css("background-position","0 -25px")}},function(){if(l>8){$("#tabP").css("background-position","0 0px")}});$("#tabBP").hover(function(){if(l<=8){$("#tabBP").css("background-position","0 -25px")}},function(){if(l<=8){$("#tabBP").css("background-position","0 0px")}});$("#tabHome").hover(function(){if(c!=0){$("#tabHome").css("background-position","0 -25px")}},function(){if(c!=0){$("#tabHome").css("background-position","0 0px")}});$("#tabClients").hover(function(){if(c!=1){$("#tabClients").css("background-position","0 -25px")}},function(){if(c!=1){$("#tabClients").css("background-position","0 0px")}});$("#tabEnquiries").hover(function(){if(c!=2){$("#tabEnquiries").css("background-position","0 -25px")}},function(){if(c!=2){$("#tabEnquiries").css("background-position","0 0px")}});$("#rightControl").hover(function(){$("#rightControl").css("background-position","-29px 0px")},function(){$("#rightControl").css("background-position","0 0")});$("#leftControl").hover(function(){$("#leftControl").css("background-position","-29px 0")},function(){$("#leftControl").css("background-position","0 0")});$("#galleryexpander").hover(function(){$("#galleryexpander").css("background-position","0 0")},function(){$("#galleryexpander").css("background-position","0 -10px")});$("#galleryLeftControl").hover(function(){$("#galleryLeftControl").css("background-position","-11px 0")},function(){$("#galleryLeftControl").css("background-position","0 0")});$("#galleryRightControl").hover(function(){$("#galleryRightControl").css("background-position","-11px 0")},function(){$("#galleryRightControl").css("background-position","0 0")})});