/* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+  <http://cherne.net/brian/resources/jquery.hoverIntent.html>*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:3,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);

/* jQuery Color Animations
 * Copyright 2007 John Resig
 * Released under the MIT and GPL licenses. */
(function(jQuery){jQuery.each(['backgroundColor','borderBottomColor','borderLeftColor','borderRightColor','borderTopColor','color','outlineColor'],function(i,attr){jQuery.fx.step[attr]=function(fx){if(fx.state==0){fx.start=getColor(fx.elem,attr);fx.end=getRGB(fx.end);}
fx.elem.style[attr]="rgb("+[Math.max(Math.min(parseInt((fx.pos*(fx.end[0]-fx.start[0]))+fx.start[0]),255),0),Math.max(Math.min(parseInt((fx.pos*(fx.end[1]-fx.start[1]))+fx.start[1]),255),0),Math.max(Math.min(parseInt((fx.pos*(fx.end[2]-fx.start[2]))+fx.start[2]),255),0)].join(",")+")";}});function getRGB(color){var result;if(color&&color.constructor==Array&&color.length==3)
return color;if(result=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
return[parseInt(result[1]),parseInt(result[2]),parseInt(result[3])];if(result=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
return[parseFloat(result[1])*2.55,parseFloat(result[2])*2.55,parseFloat(result[3])*2.55];if(result=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
return[parseInt(result[1],16),parseInt(result[2],16),parseInt(result[3],16)];if(result=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
return[parseInt(result[1]+result[1],16),parseInt(result[2]+result[2],16),parseInt(result[3]+result[3],16)];return colors[jQuery.trim(color).toLowerCase()];}
function getColor(elem,attr){var color;do{color=jQuery.curCSS(elem,attr);if(color!=''&&color!='transparent'||jQuery.nodeName(elem,"body"))
break;attr="backgroundColor";}while(elem=elem.parentNode);return getRGB(color);};var colors={brown:[139,72,42],};})(jQuery);

/* Textbox resizer(c) 2005 Nicolas Martin & Olivier Meunier and contributors */
jQuery.fn.resizehandle = function() {
  return this.each(function() {
    var me = jQuery(this);
    me.after(
      jQuery('<div class="resizehandle"></div>')
      .bind('mousedown', function(e) {
        var h = me.height();
        var y = e.clientY;
        var moveHandler = function(e) {
          me
          .height(Math.max(20, e.clientY + h - y));
        };
        var upHandler = function(e) {
          jQuery('html')
          .unbind('mousemove',moveHandler)
          .unbind('mouseup',upHandler);
        };
        jQuery('html')
        .bind('mousemove', moveHandler)
        .bind('mouseup', upHandler);
      })
    );
  });
}

jQuery.fn.toggleVal=function(focusClass){this.each(function(){$(this).focus(function(){if($(this).val()==this.defaultValue){$(this).val("")}if(focusClass){$(this).addClass(focusClass)}}).blur(function(){if($(this).val()==""){$(this).val(this.defaultValue)}if(focusClass){$(this).removeClass(focusClass)}})})}

//$(document).ready(function(){
$(window).load(function(){

	//For top sliding thing
    $('#mycarousel li').css('visibility', 'visible');  
	$('#threemiddle .photos a, #main .img a, .im a, .skin li').lightBox();
	$("#s").toggleVal("active");
	$('#quote p').load('quote_gen.php');
	//For adding images to types of links
	$("a[@href$=pdf]").addClass("pdf");
	$("a[@href$=zip]").addClass("zip");
	$("a[@href$=psd]").addClass("psd");
	//$("a[@href$=js]").addClass("js");
	$("textarea").resizehandle();
	//$("a:not([@href*=http://www.catalyticat.com])").not("[href^=#]")
	//	.addClass("external")
	//	.attr({ target: "_blank" });

	//initialise the slider by hiding all the child divs
	$('div.jslider> div.slide_content').hide();
	
	//Toggle the divs and fade the other parts of the screen.
	$('div.jslider>h3.slide_header, div.jslider>img.slide_header').toggle (function() {
		$('#footer, #rightbar').fadeTo(500, 0.2);
		$(this).next('.slide_up').css('display', 'block'); 
		$(this).next().slideDown('fast');
	}, function() {
		$('#footer, #rightbar').fadeTo(500, 1,function(){$(this).fixClearType()});
		$(this).next().slideUp('fast');
	});
	
	//Slides open the appropriate link from the quicklinks
	$('.quicklinks a').click(function() {
	s_div = $(this).attr('href');
	$('#footer, #rightbar').fadeTo(500, 0.2);
	$(s_div).next().slideDown('fast');	
	});

	//For expanding all slides
	$('#toggle_all').toggle(function() {
		$('div.jslider > div:hidden').slideDown('fast');
		$('h3').toggleClass('opened');
		$(this).text('Collapse All');
		$('#footer, #rightbar').fadeTo(500, 0.2);
		return false;
	}, function() {
		$('div.jslider > div:visible').slideUp('fast');
		$('h3').toggleClass('opened');
		$(this).text('Expand All');
		$('#footer, #rightbar').fadeTo(500, 1,function(){$(this).fixClearType()});
		return false;
	});  

	$('.sidehide a').toggle(function() {
		//setTimeout("$('#rightbar').hide(200);",400);
		$('#rightbar').hide(200);
		setTimeout("$('#main').css('width', '755px');",250);
		//$('#main').css('width', '750px'); 
		$(this).text('Show sidebar');
		return false;
	}, function() {
		$('#main').css('width', '550px');
		$('#rightbar').show(200,function(){$(this).fixClearType()});
		$(this).text('Hide sidebar');
		return false;		
	});
			
	//For the main dropdown menu	
	$('#header .menu').hover(function() {
		$(this).addClass("showmenu");
		}, function() {
		$(this).removeClass("showmenu");
		});		

	//For displaying new quote
	$("#generate").click(function(){
		$('#quote').fadeOut('900').css('color', '#F4F3F3');
		setTimeout("$('#quote p').load('quote_gen.php').css('color', '#825636');",200);
		setTimeout("$('#quote').fadeIn('1500');",1200);
		return false;
	});

	$("#totop").hoverIntent(function(){
		$(this).animate({width: "100px", height: "30px", opacity: "0.7"}, 200);
		}, function() {
		$(this).animate({width: "20px", height: "8px", opacity: "1"}, 200);
	});

	$("#totop").click(function(){
		window.location=$(this).find("a").attr("href"); 
		return false;
	});

	function filterPath(string) {
		return string
		.replace(/^\//,'')
		.replace(/(index|default).[a-zA-Z]{3,4}$/,'')
		.replace(/\/$/,'');
	}

	var locationPath = filterPath(location.pathname);
		// Scroll to anchors
	$('a[href^=#]').each(function() {
		 var thisPath = filterPath(this.pathname) || locationPath;
		 if (locationPath == thisPath
		 && (location.hostname == this.hostname || !this.hostname)
		 && this.hash.replace(/#/,'') ) {
		   var $target = $(this.hash), target = this.hash;
		   if (target) {
			var targetOffset = $target.offset().top;
			$(this).click(function(event) {
				event.preventDefault();
			    $('html').animate({scrollTop: targetOffset}, 400, function() {
			    location.hash = target;
			    });
			});
		   }
		}
	});
 
	//Fade in menubar links 
	$("#menubar a").hover(function(){
		$(this).animate({ color: "#F4F3F3"}, 500);
		}, function() {
		if ($(this).hasClass("selected")) {
			$(this).animate({ color: "#876E5C" }, 500);
		} else {
			$(this).animate({ color: "#675345" }, 500);
		}
		
	});


	$('.reply').hoverIntent(function() {
		$(this).siblings().fadeTo(300, 0.4,function(){$(this).fixClearType()});
	}, function() {
		$(this).siblings().fadeTo(300, 1,function(){$(this).fixClearType()});
	});	

}); //End doc ready

// Fix clear type on MSIE
jQuery.fn.fixClearType = function(){return this.each(function(){if(typeof this.style.filter  && this.style.removeAttribute)this.style.removeAttribute("filter");})}

// Lightbox
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(6($){$.2L.3f=6(4){4=1W.2F({2x:\'#32\',2e:0.8,1O:\'V/5-3e-T.Z\',2i:\'V/5-1t-2S.Z\',23:\'V/5-1t-2O.Z\',1V:\'V/5-1t-2I.Z\',19:\'V/5-2G.Z\',17:10,1I:2B,2z:\'1f\',2p:\'33\',2m:\'c\',2h:\'p\',2c:\'n\',h:[],9:0},4);f E=C;6 20(){1Z(C,E);D 1g}6 1Z(1a,E){$(\'1R, 1Q, 1N\').k({\'1M\':\'2D\'});1K();4.h.y=0;4.9=0;7(E.y==1){4.h.1F(u 1h(1a.16(\'H\'),1a.16(\'2v\')))}m{36(f i=0;i<E.y;i++){4.h.1F(u 1h(E[i].16(\'H\'),E[i].16(\'2v\')))}}2n(4.h[4.9][0]!=1a.16(\'H\')){4.9++}J()}6 1K(){$(\'l\').31(\'<e g="r-N"></e><e g="r-5"><e g="5-t-d-v"><e g="5-t-d"><1s g="5-d"><e 2V="" g="5-j"><a H="#" g="5-j-13"></a><a H="#" g="5-j-X"></a></e><e g="5-T"><a H="#" g="5-T-25"><1s P="\'+4.1O+\'"></a></e></e></e><e g="5-t-d-Y-v"><e g="5-t-d-Y"><e g="5-d-F"><1c g="5-d-F-1p"></1c><1c g="5-d-F-1o"></1c></e><e g="5-1B"><a H="#" g="5-1B-1Y"><1s P="\'+4.1V+\'"></a></e></e></e></e>\');f w=1m();$(\'#r-N\').k({2J:4.2x,2H:4.2e,Q:w[0],I:w[1]}).1S();f L=1l();$(\'#r-5\').k({1P:L[1]+(w[3]/10),1k:L[0]}).B();$(\'#r-N,#r-5\').K(6(){18()});$(\'#5-T-25,#5-1B-1Y\').K(6(){18();D 1g});$(A).2E(6(){f w=1m();$(\'#r-N\').k({Q:w[0],I:w[1]});f L=1l();$(\'#r-5\').k({1P:L[1]+(w[3]/10),1k:L[0]})})}6 J(){$(\'#5-T\').B();$(\'#5-d,#5-j,#5-j-13,#5-j-X,#5-t-d-Y-v,#5-d-F-1o\').1j();f M=u 1f();M.1L=6(){$(\'#5-d\').2C(\'P\',4.h[4.9][0]);1J(M.Q,M.I);M.1L=6(){}};M.P=4.h[4.9][0]};6 1J(1n,1i){f 1H=$(\'#5-t-d-v\').Q();f 1G=$(\'#5-t-d-v\').I();f 1q=(1n+(4.17*2));f 1r=(1i+(4.17*2));f 1E=1H-1q;f 26=1G-1r;$(\'#5-t-d-v\').3d({Q:1q,I:1r},4.1I,6(){2y()});7((1E==0)&&(26==0)){7($.3c.3b){1C(3a)}m{1C(38)}}$(\'#5-j-13,#5-j-X\').k({I:1i+(4.17*2)});$(\'#5-t-d-Y-v\').k({Q:1n})};6 2y(){$(\'#5-T\').1j();$(\'#5-d\').1S(6(){2u();2s()});2r()};6 2u(){$(\'#5-t-d-Y-v\').35(\'34\');$(\'#5-d-F-1p\').1j();7(4.h[4.9][1]){$(\'#5-d-F-1p\').2o(4.h[4.9][1]).B()}7(4.h.y>1){$(\'#5-d-F-1o\').2o(4.2z+\' \'+(4.9+1)+\' \'+4.2p+\' \'+4.h.y).B()}}6 2s(){$(\'#5-j\').B();$(\'#5-j-13,#5-j-X\').k({\'11\':\'1y U(\'+4.19+\') 12-14\'});7(4.9!=0){$(\'#5-j-13\').1d().2l(6(){$(C).k({\'11\':\'U(\'+4.2i+\') 1k 15% 12-14\'})},6(){$(C).k({\'11\':\'1y U(\'+4.19+\') 12-14\'})}).B().2k(\'K\',6(){4.9=4.9-1;J();D 1g})}7(4.9!=(4.h.y-1)){$(\'#5-j-X\').1d().2l(6(){$(C).k({\'11\':\'U(\'+4.23+\') 30 15% 12-14\'})},6(){$(C).k({\'11\':\'1y U(\'+4.19+\') 12-14\'})}).B().2k(\'K\',6(){4.9=4.9+1;J();D 1g})}2j()}6 2j(){$(b).2Z(6(O){2g(O)})}6 1w(){$(b).1d()}6 2g(O){7(O==2f){S=2Y.2d;1u=27}m{S=O.2d;1u=O.2X}W=2W.2U(S).2T();7((W==4.2m)||(W==\'x\')||(S==1u)){18()}7((W==4.2h)||(S==37)){7(4.9!=0){4.9=4.9-1;J();1w()}}7((W==4.2c)||(S==39)){7(4.9!=(4.h.y-1)){4.9=4.9+1;J();1w()}}}6 2r(){7((4.h.y-1)>4.9){2a=u 1f();2a.P=4.h[4.9+1][0]}7(4.9>0){29=u 1f();29.P=4.h[4.9-1][0]}}6 18(){$(\'#r-5\').28();$(\'#r-N\').2R(6(){$(\'#r-N\').28()});$(\'1R, 1Q, 1N\').k({\'1M\':\'2Q\'})}6 1m(){f q,o;7(A.1b&&A.24){q=A.22+A.2P;o=A.1b+A.24}m 7(b.l.21>b.l.2b){q=b.l.2N;o=b.l.21}m{q=b.l.2M;o=b.l.2b}f z,G;7(R.1b){7(b.s.1e){z=b.s.1e}m{z=R.22}G=R.1b}m 7(b.s&&b.s.1v){z=b.s.1e;G=b.s.1v}m 7(b.l){z=b.l.1e;G=b.l.1v}7(o<G){1x=G}m{1x=o}7(q<z){1A=q}m{1A=z}1X=u 1h(1A,1x,z,G);D 1X};6 1l(){f q,o;7(R.2A){o=R.2A;q=R.2K}m 7(b.s&&b.s.1z){o=b.s.1z;q=b.s.2t}m 7(b.l){o=b.l.1z;q=b.l.2t}2q=u 1h(q,o);D 2q};6 1C(1U){f 2w=u 1T();1D=2f;3g{f 1D=u 1T()}2n(1D-2w<1U)};D C.1d(\'K\').K(20)}})(1W);',62,203,'||||settings|lightbox|function|if||activeImage||document||image|div|var|id|imageArray||nav|css|body|else||yScroll||xScroll|jquery|documentElement|container|new|box|arrPageSizes||length|windowWidth|window|show|this|return|jQueryMatchedObj|details|windowHeight|href|height|_set_image_to_view|click|arrPageScroll|objImagePreloader|overlay|objEvent|src|width|self|keycode|loading|url|files|key|btnNext|data|gif||background|no|btnPrev|repeat||getAttribute|containerBorderSize|_finish|imageBlank|objClicked|innerHeight|span|unbind|clientWidth|Image|false|Array|intImageHeight|hide|left|___getPageScroll|___getPageSize|intImageWidth|currentNumber|caption|intWidth|intHeight|img|btn|escapeKey|clientHeight|_disable_keyboard_navigation|pageHeight|transparent|scrollTop|pageWidth|secNav|___pause|curDate|intDiffW|push|intCurrentHeight|intCurrentWidth|containerResizeSpeed|_resize_container_image_box|_set_interface|onload|visibility|select|imageLoading|top|object|embed|fadeIn|Date|ms|imageBtnClose|jQuery|arrayPageSize|btnClose|_start|_initialize|scrollHeight|innerWidth|imageBtnNext|scrollMaxY|link|intDiffH||remove|objPrev|objNext|offsetHeight|keyToNext|keyCode|overlayOpacity|null|_keyboard_action|keyToPrev|imageBtnPrev|_enable_keyboard_navigation|bind|hover|keyToClose|while|html|txtOf|arrayPageScroll|_preload_neighbor_images|_set_navigation|scrollLeft|_show_image_data|title|date|overlayBgColor|_show_image|txtImage|pageYOffset|300|attr|hidden|resize|extend|blank|opacity|close|backgroundColor|pageXOffset|fn|offsetWidth|scrollWidth|next|scrollMaxX|visible|fadeOut|prev|toLowerCase|fromCharCode|style|String|DOM_VK_ESCAPE|event|keydown|right|append|000|of|fast|slideDown|for||100||250|msie|browser|animate|ico|lightBox|do'.split('|'),0,{}))	