pic1= new Image(337,75); 
pic1.src="http://www.catalytic-design.com/images/send-your-message-hover.gif"; 


$(document).ready(function () {
	
	
	jQuery.showContent = function(layer) {
		jQuery.scrollTo.window().queue([]).stop();
		$.scrollTo("#"+layer, 3000, {
			easing:'quadratic',
			onAfter:function(){
				
				window.location.hash = layer;
				/*_gaq.push(['_trackPageview',layer+'.php']);
				
				try {
					reinvigorate.track("62440-7ep68wz1c6");
				} catch(err) {}
				*/
			}
		});
		return false;
	}
	
	$speedfactor = 10;

	$.easing.exponential = function (x, t, b, c, d, s) {
		t /= d/2;
		if (t < 1) return c/2 * Math.pow( 2, 10 * (t - 1) ) + b;
		t--;
		return c/2 * ( -Math.pow( 2, -10 * t) + 2 ) + b;
	};

	$.easing.quadratic = function (x, t, b, c, d, s) {
		t /= d/2;
		if (t < 1) return c/2*t*t*t*t + b;
		t -= 2;
		return -c/2 * (t*t*t*t - 2) + b;
	};

	$.easing.sin = function (x, t, b, c, d, s) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	};
	

	$("navigation li").click(function () {
		
		$.showContent($(this).attr("class").split("-")[1]);
		
		return false;
	});


	$("a.onPage").click(function () {
		
		$.showContent(this.hash);
		
		return false;
	});
	
	
	$("div.preview a").fancybox({
		'titleShow'		: true,
		'transitionIn' : 'none',
		'transitionOut' : 'none',
		'titlePosition'	: 'inside',
		'overlayOpacity' : '.8',
		'overlayColor' : '#000'
	});
	
	$("#location a").fancybox({
		'width'	: '75%',
		'height' : '75%',
		'autoScale'	: false,
		'transitionIn' : 'none',
		'transitionOut' : 'none',
		'type' : 'iframe',
		'titlePosition'	: 'inside',
		'overlayOpacity' : '.8',
		'overlayColor' : '#000'
	});
	
	
	
	$("#home .box:not('.current')").hover(
		function () {
			$(this).css('background','url(http://www.catalytic-design.com/images/clear-bg-20-fs8.png)');
		},
		function () {
			$(this).css('background','transparent');
		}
	);	
	
	$("#what_we_do .box:not('.current')").hover(
		function () {
			$(this).css('background','url(http://www.catalytic-design.com/images/clear-bg-20-blue-fs8.png)');
		},
		function () {
			$(this).css('background','transparent');
		}
	);
	
	$("#how_we_do_it .box:not('.current')").hover(
		function () {
			$(this).css('background','url(http://www.catalytic-design.com/images/clear-bg-20-fs8.png)');
		},
		function () {
			$(this).css('background','transparent');
		}
	);	
	
	$("#our_work .box:not('.current')").hover(
		function () {
			$(this).css('background','url(http://www.catalytic-design.com/images/clear-bg-20-fs8.png)');
		},
		function () {
			$(this).css('background','transparent');
		}
	);
	
	$("#contact_us .box:not('.current')").hover(
		function () {
			$(this).css('background','url(http://www.catalytic-design.com/images/clear-bg-10-yellow-fs8.png)');
		},
		function () {
			$(this).css('background','transparent');
		}
	);
	
	
/*
	jQuery.validator.messages.required = "";
	$('#quoteForm').validate({submitHandler: function() {			
			$email = $('#email').val();
			$name = $('#name').val();
			$subject = "New message from " + $name;
			$msg = escape($('#msg').val());
			$phone = $('#phone').val();
			$url = $('#url').val();
			$budget = $('#budget').val();
			
			var datastr ='name=' + $name + '&email=' + $email + '&subject=' + $subject + '&msg=' + $msg + '&phone=' + $phone + '&url=' + $url + '&budget=' + $budget;
//			$("#response").css("display", "block");
			$("#response").html("Sending message .... ");
			$("#response").fadeIn(500);
			setTimeout("send('"+datastr+"')",2000);
		}
	});
	*/
	
	$('a#showComments').click(function() {
		if($(this).attr('href') == '#showComments') {
			//console.log('show');
			$('ol.commentlist').show(1500);
			$(this).html('hide them?');
			$(this).attr('href','#hideComments');
		}
		else if($(this).attr('href') == '#hideComments') {
			//console.log('hide');
			$('ol.commentlist').hide(1500);
			$(this).html('read some?');
			$(this).attr('href','#showComments');
		}
		return false;
	});


	$('#cases').anythingSlider({
				startStopped    : false, // If autoPlay is on, this can force it to start stopped
				resizeContents      : true, 
				width           : 840,   // Override the default CSS width
				height              : 334,
				buildArrows         : false,
				buildNavigation     : true, 
				easing: 'easeInOutExpo',
				autoPlay            : true,
				delay:5000,
				animationTime:1000,
				navigationFormatter : function(index, panel){ // Format navigation labels with text
					return ['PHP', 'MySQL', 'HTML/CSS', 'JS,JQuery', 'SEO','SVN'][index - 1];
				}
			
			});
	
	$(".preview a,a.top_up").fancybox({
			padding: 1,
			autoScale : false,
			overlayOpacity  : 0.8,
			overlayColor : '#111'
	});
	$("a.profile").fancybox({
				'autoDimensions'    : 'false',
				'autoScale'			: 'true',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe',
				'scrolling'			: 'no',
				'centerOnScroll'   	: 'true'
			});


		
});

function send(datastr){
	$.ajax({	
		type: "POST",
		url: "/scripts/mail.php",
		data: datastr,
		cache: false,
		success: function(html){
			//_gaq.push(['_trackPageview','/Questions-Quotes.php']);
			//$("#response").fadeIn("slow");
			$("#response").html(html);
			setTimeout('$("#response").fadeOut("slow")',4000);
		}
	});
}
