	function setCookie(c_name,value,expiredays){
		var exdate=new Date();
		exdate.setDate(exdate.getDate()+expiredays);
		document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : "; expires="+exdate.toGMTString())+ "; path=/";
	}
	function getCookie(c_name){
		if (document.cookie.length>0){
		  c_start=document.cookie.indexOf(c_name + "=");
		  if (c_start!=-1){ 
			c_start=c_start + c_name.length+1; 
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
			} 
		  }
			return false;
	}
	$(document).ready(function(){
		$.youtubin();
		if(!getCookie("newsletter")){
			$('#header_message').fadeIn();
		}
		$('img.thumb').animate({ opacity: "-=.5", border: '1px solid #BB9F70' }, 0);
		$('img.thumb').hover(function(){$(this).animate({opacity: "+=.5"}, 500);},function(){$(this).animate({opacity: "-=.5"}, 500);});
	});
	$(function() {  
		$("#submit_email").click(function() { 
			var email = $("input#email").val();  
			$.post("/submitemail",{email:email},function(data){
				if(data.result == 1){
					setCookie("newsletter","1",9999);
					$('#header_message').fadeOut();
				}
				$.jGrowl(data.text);
			}, "json");
			return false;
		});
		$(".close_header_message").click(function() {
			setCookie("newsletter","1",9999);
			$('#header_message').fadeOut();
		});
	});
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-23655140-3']);
  _gaq.push(['_trackPageview']);
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
