/* <![CDATA[ */
	jQuery(document).ready(function($) {
		$.extend($.fx.step,{
		    backgroundPosition: function(fx) {
	            if (fx.state === 0 && typeof fx.end == 'string') {
	                var start = $.curCSS(fx.elem,'backgroundPosition');
	                start = toArray(start);
	                fx.start = [start[0],start[2]];
	                var end = toArray(fx.end);
	                fx.end = [end[0],end[2]];
	                fx.unit = [end[1],end[3]];
				}
	            var nowPosX = [];
	            nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
	            nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];           
	            fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];
	            
	           function toArray(strg){
	               strg = strg.replace(/left|top/g,'0px');
	               strg = strg.replace(/right|bottom/g,'100%');
	               strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
	               var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
	               return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
	           }
	        }
		});
		//Comments Hide Show On Click
		$("#comments").hide();
		$(".read_link").click(function() {
			$("#response").hide();
			$("#comments").animate({width: "toggle", height: "toggle"}, 1000);
			return false;
		});
		$("#response").hide();
		$(".comment_link").click(function() {
			$("#comments").hide();
			$("#response").animate({height: "toggle", width: "toggle"}, 1000);
			return false;
		});
		//Nav DropDown
    	$(".nav li").hover(function(){
        	$(this).addClass("hover");
        	$('ul:first',this).css({visibility: "visible",display: "none"}).fadeIn(750);
    	}, function(){    
        	$(this).removeClass("hover");
        	$('ul:first',this).css({visibility: "hidden"});
    	});
    	$(".nav li ul li:has(ul)").find("a:first");
		//Sidebar Links Move
		var fadeDuration = 100;
		$('.sidebar_square ul li a').hover(function() {
			$(this).animate({ paddingLeft: '10px' }, fadeDuration);
			$(this).children('span').show().animate({ left: -5 }, fadeDuration);
		}, function() {
			$(this).animate({ paddingLeft: '0px' }, fadeDuration);
			$(this).children('span').animate({ left: -35 }, fadeDuration).fadeOut(fadeDuration);          
		});
		//Search
		$(".search").each(function(){
			if(this.value == ""){ this.value = "search keywords then press enter"; }
			if(this.value != "search keywords then press enter"){ $(this).removeClass("search"); }
		});
		$(".search").focus(function(){
			if(this.value == "search keywords then press enter"){ this.value = ""; $(this).removeClass("search"); }
		});
		$(".search").blur(function(){
			if(this.value == ""){ this.value = "search keywords then press enter"; $(this).addClass("search"); }
			if(this.value != "search keywords then press enter"){ $(this).removeClass("search"); }
		});
		// Tooltip
		$("p.tooltip").tooltip({offset: [47, 68]});
		$("a.tooltip").tooltip({offset: [38, 3]});
		$(".start").tooltip({offset: [47, 68]});
		
		//Ads
		$(".ads .adswrap:nth-child(odd)").css("margin-left", "0");
		$(".ads .adswrap:nth-child(even)").css("margin-right", "0");
		$(".login_left .adswrap:first").css("margin-left", "0");
		$(".login_left .adswrap:nth-child(3n)").css("margin-right", "0");
		$(".login_left .adswrap:nth-child(4n)").css("margin-left", "0");
		$(".register_left .adswrap:first").css("margin-left", "0");
		$(".register_left .adswrap:nth-child(3n)").css("margin-right", "0");
		$(".register_left .adswrap:nth-child(4n)").css("margin-left", "0");
		//Recent Post Hover State
		$('#recentposts .post').hover(
			function(){
				$(this).children(".readmore").fadeIn('slow');
				$(this).css("cursor", "pointer");
			},
			function(){
				$(".readmore").fadeOut('slow');
			}
		);
		$('#recentposts .post').click(function() {window.location=$(this).find("a").attr("href");});
		//IE Fix
		if(!document.defaultView || !document.defaultView.getComputedStyle){ // IE6-IE8
			var oldCurCSS = jQuery.curCSS;
			jQuery.curCSS = function(elem, name, force){
				if(name === 'background-position'){
					name = 'backgroundPosition';
				}
				if(name !== 'backgroundPosition' || !elem.currentStyle || elem.currentStyle[ name ]){
					return oldCurCSS.apply(this, arguments);
				}
				var style = elem.style;
				if ( !force && style && style[ name ] ){
					return style[ name ];
				}
				return oldCurCSS(elem, 'backgroundPositionX', force) +' '+ oldCurCSS(elem, 'backgroundPositionY', force);
			};
		}
		
		var oldAnim = $.fn.animate;
		$.fn.animate = function(prop){
			if('background-position' in prop){
				prop.backgroundPosition = prop['background-position'];
				delete prop['background-position'];
			}
			if('backgroundPosition' in prop){
				prop.backgroundPosition = '('+ prop.backgroundPosition;
			}
			return oldAnim.apply(this, arguments);
		};
		
		function toArray(strg){
			strg = strg.replace(/left|top/g,'0px');
			strg = strg.replace(/right|bottom/g,'100%');
			strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
			var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
			return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
		}
		
		$.fx.step. backgroundPosition = function(fx) {
			if (!fx.bgPosReady) {
				var start = $.curCSS(fx.elem,'backgroundPosition');
				
				if(!start){//FF2 no inline-style fallback
					start = '0px 0px';
				}
				
				start = toArray(start);
				
				fx.start = [start[0],start[2]];
				
				var end = toArray(fx.options.curAnim.backgroundPosition);
				fx.end = [end[0],end[2]];
				
				fx.unit = [end[1],end[3]];
				fx.bgPosReady = true;
			}
			//return;
			var nowPosX = [];
			nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
			nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];           
			fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];

		};
		//End IE Fix
		$("#pastposts .post").hover(function(){
			$(this).animate({backgroundPosition: '(0px 0px)'}, 800);
			$(this).css("cursor", "pointer");
		    }, function() {
		    $(this).animate({backgroundPosition: '(-710px 0px)'}, 1);
		});
		//Portfolio
		$('ul#filter a').click(function() {
			$(this).css('outline','none');
			$('ul#filter .current').removeClass('current');
			$(this).parent().addClass('current');
			var filterVal = $(this).text().toLowerCase().replace(' ','-');	
			if(filterVal == 'all') {
			$('ul#portfolio li.hidden').fadeIn('slow').removeClass('hidden');
			} else {	
				$('ul#portfolio li').each(function() {
					if(!$(this).hasClass(filterVal)) {
						$(this).fadeOut('normal').addClass('hidden');
					} else {
						$(this).fadeIn('slow').removeClass('hidden');
					}
				});
			}	
			return false;
		});
		$('ul#portfolio li').hover(
			function() {
				$(this).css("border", "3px solid #5881A8");
			},
			function() {
				$(this).css("border", "3px solid #DEDEDE");
			}
		);
		//Login
		$("p.login_button").click(function(){
			$("div#register").animate({
				height: "0px",
				width: "0px"
			}, "slow");
			$("div#login").animate({
				height: "500px",
				width: "1000px"
			}, "slow");
		});	
  		$("a.close2").click(function(){
			$("div#login").animate({
				height: "0px",
				width: "0px"
			}, "slow");	
   		});
		$("p.register_button").click(function(){
			$("div#login").animate({
				height: "0px",
				width: "0px"
			}, "slow");
			$("div#register").animate({
				height: "500px",
				width: "1000px"
			}, "slow");
		});
  		$("a.close2").click(function(){
			$("div#register").animate({
				height: "0px",
				width: "0px"
			}, "slow");	
   		});
	});
/* ]]> */

(function($){$.tools=$.tools||{version:{}};$.tools.version.tooltip='0.1.0';var effects={toggle:[function(){this.getTip().show()},function(){this.getTip().hide()}],fade:[function(){this.getTip().fadeIn(this.getConf().fadeInSpeed)},function(){this.getTip().fadeOut(this.getConf().fadeOutSpeed)}]};$.tools.addTipEffect=function(name,loadFn,hideFn){effects[name]=[loadFn,hideFn]};$.tools.addTipEffect("slideup",function(){var conf=this.getConf();var o=conf.slideOffset||10;this.getTip().css({opacity:0}).animate({top:'-='+o,opacity:conf.opacity},conf.slideInSpeed||200).show()},function(){var conf=this.getConf();var o=conf.slideOffset||10;this.getTip().animate({top:'-='+o,opacity:0},conf.slideOutSpeed||200,function(){$(this).hide().animate({top:'+='+(o*2)},0)})});function Tooltip(trigger,conf){var self=this;var tip=trigger.children("span");if(conf.tip){if(conf.tip.indexOf("#")!=-1){tip=$(conf.tip)}else{tip=trigger.nextAll(conf.tip).eq(0);if(!tip.length){tip=trigger.parent().nextAll(conf.tip).eq(0)}}}function bind(name,fn){$(self).bind(name,function(e,args){if(fn&&fn.call(this)===false&&args){args.proceed=false}});return self}$.each(conf,function(name,fn){if($.isFunction(fn)){bind(name,fn)}});var isInput=trigger.is("input, textarea");trigger.bind(isInput?"focus":"mouseover",function(e){e.target=this;self.show(e);tip.hover(function(){self.show()},function(){self.hide()})});trigger.bind(isInput?"blur":"mouseout",function(){self.hide()});tip.css("opacity",conf.opacity);var timer=0;$.extend(self,{show:function(e){if(e){trigger=$(e.target)}clearTimeout(timer);if(tip.is(":animated")||tip.is(":visible")){return self}var p={proceed:true};$(self).trigger("onBeforeShow",p);if(!p.proceed){return self}var top=trigger.position().top-tip.outerHeight();var height=tip.outerHeight()+trigger.outerHeight();var pos=conf.position[0];if(pos=='center'){top+=height/2}if(pos=='bottom'){top+=height}var width=trigger.outerWidth()+tip.outerWidth();var left=trigger.position().left+trigger.outerWidth();pos=conf.position[1];if(pos=='center'){left-=width/2}if(pos=='left'){left-=width}top+=conf.offset[0];left+=conf.offset[1];tip.css({position:'absolute',top:top,left:left});effects[conf.effect][0].call(self);$(self).trigger("onShow");return self},hide:function(){clearTimeout(timer);timer=setTimeout(function(){if(!tip.is(":visible")){return self}var p={proceed:true};$(self).trigger("onBeforeHide",p);if(!p.proceed){return self}effects[conf.effect][1].call(self);$(self).trigger("onHide")},conf.delay||1);return self},isShown:function(){return tip.is(":visible, :animated")},getConf:function(){return conf},getTip:function(){return tip},getTrigger:function(){return trigger},onBeforeShow:function(fn){return bind("onBeforeShow",fn)},onShow:function(fn){return bind("onShow",fn)},onBeforeHide:function(fn){return bind("onBeforeHide",fn)},onHide:function(fn){return bind("onHide",fn)}})}$.prototype.tooltip=function(conf){var el=this.eq(typeof conf=='number'?conf:0).data("tooltip");if(el){return el}var opts={tip:null,effect:'slideup',delay:30,opacity:1,position:['top','center'],offset:[0,0],api:false};if($.isFunction(conf)){conf={onBeforeShow:conf}}$.extend(opts,conf);this.each(function(){$(this).prepend('<span class="tip"><span class="top"></span>'+$(this).attr("title")+'<span class="bottom"></span></span>');el=new Tooltip($(this),opts);$(this).data("tooltip",el)});return opts.api?el:this}})(jQuery);

(function($){var ie6=$.browser.msie&&parseInt($.browser.version)==6&&typeof window['XMLHttpRequest']!="object",ieQuirks=null,w=[];$.modal=function(data,options){return $.modal.impl.init(data,options);};$.modal.close=function(){$.modal.impl.close();};$.fn.modal=function(options){return $.modal.impl.init(this,options);};$.modal.defaults={appendTo:'body',focus:true,opacity:50,overlayId:'overlay',overlayCss:{},containerId:'container',containerCss:{},dataId:'data',dataCss:{},minHeight:200,minWidth:300,maxHeight:null,maxWidth:null,autoResize:false,autoPosition:true,zIndex:1000,close:true,closeClass:'close',escClose:true,overlayClose:false,position:null,persist:false,onOpen:null,onShow:null,onClose:null};$.modal.impl={o:null,d:{},init:function(data,options){var s=this;if(s.d.data){return false;}ieQuirks=$.browser.msie&&!$.boxModel;s.o=$.extend({},$.modal.defaults,options);s.zIndex=s.o.zIndex;s.occb=false;if(typeof data=='object'){data=data instanceof jQuery?data:$(data);if(data.parent().parent().size()>0){s.d.parentNode=data.parent();if(!s.o.persist){s.d.orig=data.clone(true);}}}else if(typeof data=='string'||typeof data=='number'){data=$('<div></div>').html(data);}else{alert('Modal Error: Unsupported data type: '+typeof data);return s;}s.create(data);data=null;s.open();if($.isFunction(s.o.onShow)){s.o.onShow.apply(s,[s.d]);}return s;},create:function(data){var s=this;w=s.getDimensions();if(ie6){s.d.iframe=$('<iframe src="javascript:false;"></iframe>').css($.extend(s.o.iframeCss,{display:'none',opacity:0,position:'fixed',height:w[0],width:w[1],zIndex:s.o.zIndex,top:0,left:0})).appendTo(s.o.appendTo);}s.d.overlay=$('<div></div>').attr('id',s.o.overlayId).addClass('overlay').css($.extend(s.o.overlayCss,{display:'none',opacity:s.o.opacity/100,height:w[0],width:w[1],position:'fixed',left:0,top:0,zIndex:s.o.zIndex+1})).appendTo(s.o.appendTo);s.d.container=$('<div></div>').attr('id',s.o.containerId).addClass('simplemodal-container').css($.extend(s.o.containerCss,{display:'none',position:'fixed',zIndex:s.o.zIndex+2})).append(s.o.close&&s.o.closeHTML?$(s.o.closeHTML).addClass(s.o.closeClass):'').appendTo(s.o.appendTo);s.d.wrap=$('<div></div>').attr('tabIndex',-1).addClass('simplemodal-wrap').css({height:'100%',outline:0,width:'100%'}).appendTo(s.d.container);s.d.data=data.attr('id',data.attr('id')||s.o.dataId).addClass('simplemodal-data').css($.extend(s.o.dataCss,{display:'none'})).appendTo('body');data=null;s.setContainerDimensions();s.d.data.appendTo(s.d.wrap);if(ie6||ieQuirks){s.fixIE();}},bindEvents:function(){var s=this;$('.'+s.o.closeClass).bind('click.simplemodal',function(e){e.preventDefault();s.close();});if(s.o.close&&s.o.overlayClose){s.d.overlay.bind('click.simplemodal',function(e){e.preventDefault();s.close();});}$(document).bind('keydown.simplemodal',function(e){if(s.o.focus&&e.keyCode==9){s.watchTab(e);}else if((s.o.close&&s.o.escClose)&&e.keyCode==27){e.preventDefault();s.close();}});$(window).bind('resize.simplemodal',function(){w=s.getDimensions();s.setContainerDimensions(true);if(ie6||ieQuirks){s.fixIE();}else{s.d.iframe&&s.d.iframe.css({height:w[0],width:w[1]});s.d.overlay.css({height:w[0],width:w[1]});}});},unbindEvents:function(){$('.'+this.o.closeClass).unbind('click.simplemodal');$(document).unbind('keydown.simplemodal');$(window).unbind('resize.simplemodal');this.d.overlay.unbind('click.simplemodal');},fixIE:function(){var s=this,p=s.o.position;$.each([s.d.iframe||null,s.d.overlay,s.d.container],function(i,el){if(el){var bch='document.body.clientHeight',bcw='document.body.clientWidth',bsh='document.body.scrollHeight',bsl='document.body.scrollLeft',bst='document.body.scrollTop',bsw='document.body.scrollWidth',ch='document.documentElement.clientHeight',cw='document.documentElement.clientWidth',sl='document.documentElement.scrollLeft',st='document.documentElement.scrollTop',s=el[0].style;s.position='absolute';if(i<2){s.removeExpression('height');s.removeExpression('width');s.setExpression('height',''+bsh+' > '+bch+' ? '+bsh+' : '+bch+' + "px"');s.setExpression('width',''+bsw+' > '+bcw+' ? '+bsw+' : '+bcw+' + "px"');}else{var te,le;if(p&&p.constructor==Array){var top=p[0]?typeof p[0]=='number'?p[0].toString():p[0].replace(/px/,''):el.css('top').replace(/px/,'');te=top.indexOf('%')==-1?top+' + (t = '+st+' ? '+st+' : '+bst+') + "px"':parseInt(top.replace(/%/,''))+' * (('+ch+' || '+bch+') / 100) + (t = '+st+' ? '+st+' : '+bst+') + "px"';if(p[1]){var left=typeof p[1]=='number'?p[1].toString():p[1].replace(/px/,'');le=left.indexOf('%')==-1?left+' + (t = '+sl+' ? '+sl+' : '+bsl+') + "px"':parseInt(left.replace(/%/,''))+' * (('+cw+' || '+bcw+') / 100) + (t = '+sl+' ? '+sl+' : '+bsl+') + "px"';}}else{te='('+ch+' || '+bch+') / 2 - (this.offsetHeight / 2) + (t = '+st+' ? '+st+' : '+bst+') + "px"';le='('+cw+' || '+bcw+') / 2 - (this.offsetWidth / 2) + (t = '+sl+' ? '+sl+' : '+bsl+') + "px"';}s.removeExpression('top');s.removeExpression('left');s.setExpression('top',te);s.setExpression('left',le);}}});},focus:function(pos){var s=this,p=pos||'first';var input=$(':input:enabled:visible:'+p,s.d.wrap);input.length>0?input.focus():s.d.wrap.focus();},getDimensions:function(){var el=$(window);var h=$.browser.opera&&$.browser.version>'9.5'&&$.fn.jquery<='1.2.6'?document.documentElement['clientHeight']:$.browser.opera&&$.browser.version<'9.5'&&$.fn.jquery>'1.2.6'?window.innerHeight:el.height();return[h,el.width()];},getVal:function(v){return v=='auto'?0:v.indexOf('%')>0?v:parseInt(v.replace(/px/,''));},setContainerDimensions:function(resize){var s=this;if(!resize||(resize&&s.o.autoResize)){var ch=s.getVal(s.d.container.css('height')),cw=s.getVal(s.d.container.css('width')),dh=s.d.data.outerHeight(true),dw=s.d.data.outerWidth(true);var mh=s.o.maxHeight&&s.o.maxHeight<w[0]?s.o.maxHeight:w[0],mw=s.o.maxWidth&&s.o.maxWidth<w[1]?s.o.maxWidth:w[1];if(!ch){if(!dh){ch=s.o.minHeight;}else{if(dh>mh){ch=mh;}else if(dh<s.o.minHeight){ch=s.o.minHeight;}else{ch=dh;}}}else{ch=ch>mh?mh:ch;}if(!cw){if(!dw){cw=s.o.minWidth;}else{if(dw>mw){cw=mw;}else if(dw<s.o.minWidth){cw=s.o.minWidth;}else{cw=dw;}}}else{cw=cw>mw?mw:cw;}s.d.container.css({height:ch,width:cw});if(dh>ch||dw>cw){s.d.wrap.css({overflow:'auto'});}}if(s.o.autoPosition){s.setPosition();}},setPosition:function(){var s=this,top,left,hc=(w[0]/2)-(s.d.container.outerHeight(true)/2),vc=(w[1]/2)-(s.d.container.outerWidth(true)/2);if(s.o.position&&Object.prototype.toString.call(s.o.position)==="[object Array]"){top=s.o.position[0]||hc;left=s.o.position[1]||vc;}else{top=hc;left=vc;}s.d.container.css({left:left,top:top});},watchTab:function(e){var s=this;if($(e.target).parents('.container').length>0){s.inputs=$(':input:enabled:visible:first, :input:enabled:visible:last',s.d.data[0]);if((!e.shiftKey&&e.target==s.inputs[s.inputs.length-1])||(e.shiftKey&&e.target==s.inputs[0])||s.inputs.length==0){e.preventDefault();var pos=e.shiftKey?'last':'first';setTimeout(function(){s.focus(pos);},10);}}else{e.preventDefault();setTimeout(function(){s.focus();},10);}},open:function(){var s=this;s.d.iframe&&s.d.iframe.show();if($.isFunction(s.o.onOpen)){s.o.onOpen.apply(s,[s.d]);}else{s.d.overlay.show();s.d.container.show();s.d.data.show();}s.focus();s.bindEvents();},close:function(){var s=this;if(!s.d.data){return false;}s.unbindEvents();if($.isFunction(s.o.onClose)&&!s.occb){s.occb=true;s.o.onClose.apply(s,[s.d]);}else{if(s.d.parentNode){if(s.o.persist){s.d.data.hide().appendTo(s.d.parentNode);}else{s.d.data.hide().remove();s.d.orig.appendTo(s.d.parentNode);}}else{s.d.data.hide().remove();}s.d.container.hide().remove();s.d.overlay.hide().remove();s.d.iframe&&s.d.iframe.hide().remove();s.d={};}}};})(jQuery);

jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};