

$(document).ready(function() {
	
	$('#contactform').submit(function(){
	
		var action = $(this).attr('action');
		
		$('#contactform #submit').attr('disabled','disabled').after('<img src="../img/ajax-loader.gif" class="loader" />');
		
		$("#message").slideUp(750,function() {
		$('#message').hide();			
		
		$.post(action, { 
			name: $('#name').val(),
			email: $('#email').val(),
			subject: $('#subject').val(),
			comments: $('#comments').val(),
			verify: $('#verify').val()
		},
			function(data){
				document.getElementById('message').innerHTML = data;
				$('#message').slideDown('slow');
				$('#contactform img.loader').fadeOut('fast',function(){$(this).remove()});
				$('#contactform #submit').attr('disabled',''); 
				if(data.match('success') != null) $('#contactform').slideUp('slow');
				
			}
		);
		
		});
		
		return false; 
	
	});
									
}); //document.ready function ends here	
	

jQuery(document).ready(function($) {
	
	sliderLeft=$('#thumbscroller .container').position().left;
	padding=$('#wrap-thumbscroller').css('paddingRight').replace("px", "");
	sliderWidth=$(window).width()-padding;
	
	$('#thumbscroller').css('width',sliderWidth);
	var totalContent=0;
	
	$('#thumbscroller .thumb').each(function () {
			totalContent+=$(this).innerWidth();
			$('#thumbscroller .container').css('width',totalContent);
	});
	
	$('#thumbscroller').mousemove(function(e){
		if($('#thumbscroller  .container').width()>sliderWidth){
		  var mouseCoords=(e.pageX - this.offsetLeft);
		  var mousePercentX=mouseCoords/sliderWidth;
		  var destX=-(((totalContent-(sliderWidth))-sliderWidth)*(mousePercentX));
		  var thePosA=mouseCoords-destX;
		  var thePosB=destX-mouseCoords;
		  var animSpeed=500; //ease amount
		  var easeType='easeOutCirc';
		  if(mouseCoords==destX){
			  $('#thumbscroller .container').stop();
		  }
		  else if(mouseCoords>destX){
			  //$('#thumbscroller .container').css('left',-thePosA); //without easing
			  $('#thumbscroller .container').stop().animate({left: -thePosA}, animSpeed,easeType); //with easing
		  }
		  else if(mouseCoords<destX){
			  //$('#thumbscroller .Container').css('left',thePosB); //without easing
			  $('#thumbscroller .container').stop().animate({left: thePosB}, animSpeed,easeType); //with easing
		  }
		}
		});
	});

// thumb Hover Title
jQuery(document).ready(function($){
	$(".thumb a").hover(function() {
		$(this).next(".service").animate({opacity: "show", bottom: "35"}, 300);
	}, function() {
		$(this).next(".service").animate({opacity: "hide", bottom: "-22"}, 300);
	});
});
	
	
	// Reflection.js for jQuery v1.03
	/*(c) 2006-2009 Christophe Beyls <http://www.digitalia.be> MIT-style license.*/
	(function(a){a.fn.extend({reflect:function(b){b=a.extend({height:1/9.95,opacity:0.4},b);return this.unreflect().each(function(){var c=this;if(/^img$/i.test(c.tagName)){function d(){var g=c.width,f=c.height,l,i,m,h,k;i=Math.floor((b.height>1)?Math.min(f,b.height):f*b.height);if(a.browser.msie){l=a("<img />").attr("src",c.src).css({width:g,height:f,marginBottom:i-f,filter:"flipv progid:DXImageTransform.Microsoft.Alpha(opacity="+(b.opacity*100)+", style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy="+(i/f*100)+")"})[0]}else{l=a("<canvas />")[0];if(!l.getContext){return}h=l.getContext("2d");try{a(l).attr({width:g,height:i});h.save();h.translate(0,f-1);h.scale(1,-1);h.drawImage(c,0,0,g,f);h.restore();h.globalCompositeOperation="destination-out";k=h.createLinearGradient(0,0,0,i);k.addColorStop(0,"rgba(255, 255, 255, "+(1-b.opacity)+")");k.addColorStop(1,"rgba(255, 255, 255, 1.0)");h.fillStyle=k;h.rect(0,0,g,i);h.fill()}catch(j){return}}a(l).css({display:"block",border:0});m=a(/^a$/i.test(c.parentNode.tagName)?"<span />":"<div />").insertAfter(c).append([c,l])[0];m.className=c.className;a.data(c,"reflected",m.style.cssText=c.style.cssText);a(m).css({width:g,height:f+i,overflow:"hidden"});c.style.cssText="display: block; border: 0px";c.className="reflected"}if(c.complete){d()}else{a(c).load(d)}}})},unreflect:function(){return this.unbind("load").each(function(){var c=this,b=a.data(this,"reflected"),d;if(b!==undefined){d=c.parentNode;c.className=d.className;c.style.cssText=b;a.removeData(c,"reflected");d.parentNode.replaceChild(c,d)}})}})})(jQuery);
	
	jQuery(function($) {
		$("img.attachment-post-thumbnail").reflect({});
	});
	
	
	// jQuery Toggle Box
	jQuery(document).ready(function($){
	$(".togglebox").hide();
		$(".toggle").click(function(){
			$(this).toggleClass("activetoggle").next().slideToggle("normal");
		});
	});
	


jQuery(function( $ ){
	/**
	 * Demo binding and preparation, no need to read this part
	 */
	//borrowed from jQuery easing plugin
	//http://gsgd.co.uk/sandbox/jquery.easing.php
	$.easing.elasout = function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},

	// This one is important, many browsers don't reset scroll on refreshes
	// Reset all scrollable panes to (0,0)
	$('div.pane').scrollTo( 0 );
	// Reset the screen to (0,0)
	$.scrollTo( 0 );
	
	// TOC, shows how to scroll the whole window
	$('body a').click(function(){//$.scrollTo works EXACTLY the same way, but scrolls the whole screen
		$.scrollTo( this.hash, 800);
		$(this.hash).find('span.message').text( this.title );
		return false;
	});

	// TOC, shows how to scroll the whole window
	$('.top a').click(function(){//$.scrollTo works EXACTLY the same way, but scrolls the whole screen
		$.scrollTo( this.hash, 800);
		$(this.hash).find('span.message').text( this.title );
		return false;
	});
	
	});
