$(document).ready(function()
{
	// Expand Panel
	$("#slidedown").click(function(){
		$("div#panel").slideDown("slow");
	});

	// Collapse Panel
	$("#slideup").click(function(){
		$("div#panel").slideUp("slow");
	});

	// Switch buttons from "Log In | Register" to "Close Panel" on click
	$("#toggle a").click(function () {
		$("#toggle a").toggle();
	});
	
	
	//---------------
	
	
	$('#feedback-client-testimonial-frontpage').cycle({
		fx: 'fade',
		timeout: 8000,
		speed: 1000,
		sync: 0,
		cleartype: 1,
		cleartypeNoBg: true
	});


	//---------------
	
	
	$('.box').hover(function(){
		$("ul.hover_block li img", this).stop().animate({top:'220px'},{queue:false,duration:500});
		}, function() {
		$("ul.hover_block li img", this).stop().animate({top:'0px'},{queue:false,duration:250});
	});

	
	//---------------


	$("img.a").hover(
		function() {
		$(this).stop().animate({"opacity": "0"}, "700");
		},
		function() {
		$(this).stop().animate({"opacity": "1"}, "700");
	});
	
	//---------------
	
	
	$("a#recent_work").fancybox({
		'opacity'		: true,
		'overlayShow'	: true,

		overlayOpacity : 0.5,
		overlayColor : '#000',

		'transitionIn'	: 'elastic',
		'transitionOut'	: 'none',
		
		width : 1000,
		height:	681,
		
		centerOnScroll: true
	});
	
	
	//---------------
	
	
	//Get the height of the first item
		//$('#mask').css({'height':$('#panel-sliding-1').height()});

		//Calculate the total width - sum of all sub-panels width
		//Width is generated according to the width of #mask * total of sub-panels
		$('#panel-sliding').width(parseInt($('#mask').width() * $('#panel-sliding div').length));

		//Set the sub-panel width according to the #mask width (width of #mask and sub-panel must be same)
		$('#panel-sliding div').width($('#mask').width());

		//Get all the links with rel as panel
		$('a[rel=panel-sliding]').click(function () {

		//Get the height of the sub-panel
		var panelheight = $($(this).attr('href')).height();

		//Set class for the selected item
		$('a[rel=panel-sliding]').removeClass('selected');
		$(this).addClass('selected');

		//Resize the height
		$('#mask').animate({'height':panelheight},{queue:false, duration:250});

		//Scroll to the correct panel, the panel id is grabbed from the href attribute of the anchor
		$('#mask').scrollTo($(this).attr('href'), 400);

		//Discard the link default behavior
		return false;
	});
});


Cufon.replace('h1.mainTitle');
Cufon.replace('#header h1.mainTitle');
Cufon.replace('h2.mainTitle');
Cufon.replace('#header h2.mainTitle');
Cufon.replace('h3.mainTitle');
Cufon.replace('#header h3.mainTitle');

/*
$(document).ready(function(){
{
	$('ul.hover_block li').hover(function(){
		$(this).find('img').animate({top:'220px'},{queue:false,duration:500});
	}, function(){
		$(this).find('img').animate({top:'0px'},{queue:false,duration:250});
	});
});
*/


$(function()
{
	$('#slides').slides({
		preload: true,
		preloadImage: 'img/loading.gif',

		effect: 'fade',
		fadeSpeed: 500,
		slideSpeed: 1000,

		play: 8000,
		pause: 8000,

		hoverPause: true,
		pagination: true
	});
});

function remName(a, b){
if(a.value==b){
a.value='';
}else if(a.value==''){
a.value=b;
}else{
a.value=a.value;
}
}

function chkName(a, b){
if(a.value==''){
a.value=b;
}else{
a.value=a.value;
}
}
