	
	
	if($.cookie("css")) {
		$(".cssswitch").attr("href",$.cookie("css"));
	}

	$(document).ready(function() {

		
		// transition effect
		style = 'easeOutQuart';

		// if the mouse hover the image
		$('.photo').hover(
			function() {
				//display heading and caption
				$(this).children('div:last').stop(false,true).animate({bottom:6},{duration:200, easing: style});
			},

			function() {
				//hide heading and caption
				$(this).children('div:last').stop(false,true).animate({bottom:-60},{duration:200, easing: style});
			}
		);

		$("#settingsfrm a").click(function() {
			$(".cssswitch").attr("href",$(this).attr('rel'));
			$.cookie("css",$(this).attr('rel'), {expires: 365, path: '/'});
			return false;
		});

		
		//transitions
		//for more transition, goto http://gsgd.co.uk/sandbox/jquery/easing/
		var style = 'easeOutExpo';
		
		//Retrieve the selected item position and width
		var default_left = Math.round($('#nav li.selected').offset().left - $('#nav').offset().left);
		var default_width = $('#nav li.selected').width();

		//Set the floating bar position and width
		$('#box').css({left: default_left});
		$('#box .head').css({width: default_width});

		//if mouseover the menu item
		$('#nav li').hover(function () {
			
			//Get the position and width of the menu item
			left = Math.round($(this).offset().left - $('#nav').offset().left);
			width = $(this).width(); 

			//Set the floating bar position, width and transition
			$('#box').stop(false, true).animate({left: left},{duration:1000, easing: style});	
			$('#box .head').stop(false, true).animate({width:width},{duration:1000, easing: style});
			$('#box').css({opacity:1});
		
		//if user click on the menu
		}).click(function () {
			
			//reset the selected item
			$('#nav li').removeClass('selected');	
			
			//select the current item
			$(this).addClass('selected');
	
		});
		
		//If the mouse leave the menu, reset the floating bar to the selected item
		$('#nav').mouseleave(function () {

			//Retrieve the selected item position and width
			default_left = Math.round($('#nav li.selected').offset().left - $('#nav').offset().left);
			default_width = $('#nav li.selected').width();
			
			//Set the floating bar position, width and transition
			$('#box').stop(false, true).animate({left: default_left},{duration:1500, easing: style});	
			$('#box .head').stop(false, true).animate({width:default_width},{duration:1500, easing: style});		
			
		});
		
		$('#stName').click(function() {
			$('#stName').addClass('inputboxover');					
									});
									
				
	});


$(function()
{
	//Add new list
    $(".mysettings a").click(function(event) {
        event.preventDefault();
        $("#settingsfrm").slideToggle();
    });

});

	function submitForm(formName)
	{
		$(".frmsend").addClass('loading');
		document.forms[formName].submit();
	}

	function validateForm(FormName)
	{
		var validator = $("#" + FormName).validate();
		var isValid = validator.form();
			  
		  if (isValid) {
			
			submitForm(FormName);
		  }
	}


$(document).ready(function() {
	$("a.contactform").fancybox();
	$(".photo a").fancybox();
	
	$("#stEmail").click(function() {
	    $("#stEmail").val("");
	});
});
