/* <![CDATA[ */
	jQuery.noConflict();
	
	jQuery(document).ready(function($){	
        $('#globalnav ul').superfish({
        	delay: 200,
        	speed: 'fast',
        	autoArrows: false
        }); 

		$("#sidebar h3 a").click(function () {
			var itemlist = $(this).parents("li:first");
			itemlist.toggleClass("side-switch");
			itemlist.find("ul").slideToggle("fast");
			return false;
			
        });
		
		$('.hp-element').hover(
		  function () {
			$(this).stop().fadeTo("fast", 0.8);
		  },
		  function () {
			$(this).stop().fadeTo("fast", 1)
		  }
		);		
		
		$('#pre-video').click(function() {
			$('.coda-slider-wrapper').fadeOut(500, function () {
				$('#video').html('<iframe src="http://player.vimeo.com/video/12084163?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff&amp;autoplay=1" width="643" height="346" frameborder="0"></iframe>');
				$('#video').fadeIn(500);
          	});
		});		
			
		$(".post-image").hover(
		  function () {
			$(this).stop().fadeTo("fast", 0.4);
		  },
		  function () {
			$(this).stop().fadeTo("fast", 1)
		  }
		);
		
		$("#show-other-post h3").hover(
		  function () {
			$(this).stop().fadeTo("fast", 0.6);
		  },
		  function () {
			$(this).stop().fadeTo("fast", 1)
		  }
		);
		
		$(".portfolio-back h3").hover(
		  function () {
			$(this).stop().fadeTo("fast", 0.6);
		  },
		  function () {
			$(this).stop().fadeTo("fast", 1)
		  }
		);
		
		$("#share li").hover(
		  function () {
			$(this).stop().fadeTo("fast", 0.6);
		  },
		  function () {
			$(this).stop().fadeTo("fast", 1)
		  }
		);
	  
		$('#show-other-post h3').click(function() {
		 $("#show-other-post").fadeOut(500, function () {
            $("#other-post").fadeIn(800);
          });
          return false;
		});
		
		
	});

function printCopyrightYears(startYear) {
	if(!startYear)
		var startYear=2009
	var d=new Date(); 
	yr=d.getFullYear();
	if (yr!=startYear) {
		document.write(startYear+"-"+yr);
	} else {
		document.write(startYear);
	}	
}

clearDefault = function(obj) {
		if(obj.defaultValue == obj.value) obj.value = ''; 
}

restoreDefault = function(obj) {
		if(obj.value == '') obj.value = obj.defaultValue;
}



function optformValidate(form) {
	var error = '';
	var filter = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	var objEmail = form.opt_email;
	
	if(form.opt_name.value == '' || form.opt_name.value == form.opt_name.defaultValue) {
		error += "Please enter your name\n";
		form.opt_name.value = '';
		form.opt_name.focus();
		return false;
	}
	if(objEmail.value == '' || objEmail.value == objEmail.defaultValue) {
		error += "Please enter your email\n";
		objEmail.value= '';
		objEmail.focus();
		return false;
		
	} else if(!filter.test(objEmail.value)) {
		error += "Please enter a valid email\n";
		objEmail.value = '';
		objEmail.focus();
	}
	
	if(error != '') {
		alert(error);
		return false;	
	} else {
		return true;
	}
}
/* ]]> */
