// JavaScript Document

<!-- back 2 top scripts -->
jQuery.fn.topLink = function(settings) {
	settings = jQuery.extend({
		min: 1,
		fadeSpeed: 200,
		ieOffset: 50
	}, settings);
	return this.each(function() {
		//listen for scroll
		var el = $(this);
		el.css('display','none'); //in case the user forgot
		$(window).scroll(function() {
			if(!jQuery.support.hrefNormalized) {
				el.css({
					'position': 'absolute',
					'top': $(window).scrollTop() + $(window).height() - settings.ieOffset
				});
			}
			if($(window).scrollTop() >= settings.min)
			{
				el.fadeIn(settings.fadeSpeed);
			}
			else
			{
				el.fadeOut(settings.fadeSpeed);
			}
		});
	});
};

$(document).ready(function() {
	$('#top-link').topLink({
		min: 50,
		fadeSpeed: 500
	});
	jQuery('.backtotop a').click(function(){
		jQuery('html, body').animate({scrollTop:0}, 'slow'); 
		return false; 
	});
});

<!-- Filter scripts -->
jQuery(document).ready(function() {
// Gallery filter
	  jQuery(".imagGallery li a").mouseover(function() {
			jQuery(this).children("p").stop().animate({
				height: '72'
			  }, 250);	
		});
	  jQuery(".imagGallery li a").mouseout(function() {
			jQuery(this).children("p").stop().animate({
				height: '0'
			  }, 250);	
		});

// footer filter
	var status = "close";
	status = getCookie("status");
	if(status == "close"){
		jQuery(".nav .arro").toggle(function() {
				jQuery(".nav .arro").addClass("active");
				jQuery(".nav").stop().animate({
					height: '100'
				  }, 250);	
				  setCookie("status","open",365);
		},
		function()
		{
				jQuery(".nav .arro").removeClass("active");
				jQuery(".nav").stop().animate({
					height: '15'
				  }, 250);
				  setCookie("status","close",365);
		});
	}else{
		jQuery(".nav .arro").toggle(function() {
				jQuery(".nav .arro").removeClass("active");
				jQuery(".nav").stop().animate({
					height: '15'
				  }, 250);
				  setCookie("status","close",365);
				
		},
		function()
		{
				jQuery(".nav .arro").addClass("active");
				jQuery(".nav").stop().animate({
					height: '100'
				  }, 250);	
				  setCookie("status","open",365);	  
				
		});
	}
		

// info filter
	jQuery(".infoArea .arro").toggle(function() {
		jQuery(".infoArea .arro").addClass("active");
		jQuery(".info").stop().animate({
			height: '70'
		  }, 250);	
	},
	function()
	{
		jQuery(".infoArea .arro").removeClass("active");
		jQuery(".info").stop().animate({
			height: '0'
		  }, 250);
	});


	
// About filter 

//jQuery(".about_inner").stop().animate({	height: '0'}, 40);
//
//	jQuery(".about_btn").click(function() {
//	//	jQuery(".gallery_sec").fadeOut('slow');
//	//	jQuery(".footer").fadeOut('slow');
//		jQuery(".about_inner").stop().animate({
//			height: $(window).height()
//		  }, 400);
//	});
//
//// Work filter 
//	jQuery(".work_btn").click(function() {
//	//	jQuery(".footer").fadeIn('slow');
//	//	jQuery(".gallery_sec").fadeIn('slow');
//		jQuery(".about_inner").stop().animate({
//			height: '0'
//		  }, 400);
//	});
});

function setCookie(c_name,value,exdays)
{
	var exdate=new Date();
	exdate.setDate(exdate.getDate() + exdays);
	var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
	document.cookie=c_name + "=" + c_value;
}

function getCookie(c_name){
	var i,x,y,ARRcookies=document.cookie.split(";");
	for (i=0;i<ARRcookies.length;i++){
	  x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
	  y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
	  x=x.replace(/^\s+|\s+$/g,"");
	  if (x==c_name){
			return unescape(y);
		}
	  }
}

var status = "close";
function checkCookie()
{
	var status=getCookie("status");
	if (status=="open"){
		jQuery(".nav .arro").addClass("active");
		jQuery(".nav").stop().animate({
			height: '100'
		  }, 250);
		  setCookie("status","open",365);
	}
}

