/*<![CDATA[*/
		   
//======= Window on load ==========//

$(window).load(function () {
						 
	// --> init Scrollbars
	$('.scroll-pane').jScrollPane();
	// --> END Scrollbars
	
	// --> Fade images
	$('ul#category li img, ul#partners li.partner img, ul#work li img').hover(function() {
		$(this).fadeTo("slow", 1);
		}, function() {
		$(this).fadeTo("slow", 0.6);
	});
	
	$('ul#category li img, ul#partners li.partner img, ul#work li img').each(function() {
		$(this).fadeTo(0, 0.6);
	});
	// --> END Fade images

	// --> Project Page Gallery init
	$('#photos').galleryView({
		panel_width: 653,
		panel_height: 365,
		frame_width: 100,
		frame_height: 100,
		
		//overlay_height: 50,
		//overlay_opacity: 0.7,
		overlay_height: 0,
		overlay_opacity: 0,
		
		overlay_text_color: 'white',
		caption_text_color: '#222',
		background_color: '#465057',
		border: 'none',
		nav_theme: 'custom',
		easing: 'easeInOutQuad',

		pause_on_hover: true
	});
	// --> END Project Page Gallery
	
	// --> If less then 5 thumbs, remove the arrows
	if($("ul.filmstrip li").length <= 5){
		$('.nav-prev, .nav-next').css({display:"none"});
	}
	// END If
	
	// --> Project Page desc & video toggle
	$('#videoFlash').css({display:"none"});
	$('div.top-link a').bind('click',function(){
		if ($(this).attr("id") == "videoToggle") {
			$("#Desc-Panel").hide("slow");
			$('div#Video-Panel').show("slow",function() {
				so.write("videoFlash");
				$('#videoFlash').css({display:"block"});
			});
			return false;
		}
		if ($(this).attr("id") == "descToggle") {
			$('#videoFlash').html("");
			$('#videoFlash').css({display:"none"});
			$("#Video-Panel").hide("slow");
			$("#Desc-Panel").show("slow");
			return false;
		}
	});
	// --> END Project Page desc & video toggle
	
	// --> Project Page Close buttons
	$("div#dscClose").click(function() {
		$("#Desc-Panel").hide("slow");
	});
	$("div#vidClose").click(function() {
		$('#videoFlash').html("");
		$('#videoFlash').css({display:"none"});
		$("#Video-Panel").hide("slow");
	});
	// --> END Project Page Close buttons
	
});
//=======END Window on load ==========//


//=======Init Jquery (on page load) ==========//

$(function () {
			
/*
$("img.play").hover(
	function () {
		$("img.baloon-play-pause").css({display:"block"});
	}, 
	function () {
		$("img.baloon-play-pause").css({display:"none"});
	}
);
$(".work_b .up").hover(
	function () {
		$("img.baloon-prev").css({display:"block"});
	}, 
	function () {
		$("img.baloon-prev").css({display:"none"});
	}
);
$(".work_b .down").hover(
	function () {
		$("img.baloon-next").css({display:"block"});
	}, 
	function () {
		$("img.baloon-next").css({display:"none"});
	}
);


$("img.play2").hover(
	function () {
		$("img.baloon-play-pause2").css({display:"block"});
	}, 
	function () {
		$("img.baloon-play-pause2").css({display:"none"});
	}
);
$(".work_b .up2").hover(
	function () {
		$("img.baloon-prev2").css({display:"block"});
	}, 
	function () {
		$("img.baloon-prev2").css({display:"none"});
	}
);
$(".work_b .down2").hover(
	function () {
		$("img.baloon-next2").css({display:"block"});
	}, 
	function () {
		$("img.baloon-next2").css({display:"none"});
	}
);
*/


// Init Links with _blank target
function externalLinks() {
	if (!document.getElementsByTagName) return;
		var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
	if (anchor.getAttribute("href") &&
		anchor.getAttribute("rel") == "external")
		anchor.target = "_blank";
	}
}
externalLinks(); 
// END Links with _blank target
});
//=======END Init Jquery (on page load) ==========//

//=======Email Validation==========//
function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   //alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   //alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    //alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    //alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    //alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    //alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    //alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

//=======END Email Validation==========//
/*]]>*/