/*<![CDATA[*/
		   
//======= Window on load ==========//

$(window).load(function () {
						 
// --> Start Cycle
	// Add 'scrollVert' functionality for scroll boxe
	(function($) {

		$.fn.cycle.transitions.scrollVert = function($cont, $slides, opts) {
		    $cont.css('overflow','hidden');
		    opts.before.push(function(curr, next, opts, fwd) {
		        $(this).show();
		        var currH = curr.offsetHeight, nextH = next.offsetHeight;
		        opts.cssBefore = fwd ? { top: -nextH } : { top: nextH };
		        opts.animIn.top = 0;
		        opts.animOut.top = fwd ? currH : -currH;
		        $slides.not(curr).css(opts.cssBefore);
		    });
		    opts.cssFirst = { top: 0 };
		    opts.cssAfter = { display: 'none' }
		};

	})(jQuery);
	
	// Init HP Text cycle
	$('#hp-slider ul#slider-text').cycle({ 
	    fx: 'scrollVert',
		speed: 850,
		rev: true,
		sync:1,
		timeout: 2000
		//next:   '#scroll-speacial-offers ol li.next', 
	    //prev:   '#scroll-speacial-offers ol li.previous'
	});

// --> Init HP Image cycle
	$("#hp-slider ul#slider-images").cycle({ 
		fx:     'fade', 
		speed:  850, 
		timeout: 3000, 
		sync:1
	});

	
	// Init HP Text cycle
	$('#slider ul#slider-text').cycle({ 
	    fx: 'scrollVert',
		speed: 850,
		rev: true,
		sync:1,
		timeout: 3000
		//next:   '#scroll-speacial-offers ol li.next', 
	    //prev:   '#scroll-speacial-offers ol li.previous'
	});

// --> Init HP Image cycle
	$("#slider ul#slider-images").cycle({ 
		fx:     'fade', 
		speed:  850, 
		timeout: 3000, 
		sync:1
	});

// --> Start Print page
	$('a.download').popupWindow({ 
		centerScreen:1,
		height:300, 
		width:300
	}); 

	// --> Project Page Gallery init
	$('#photos').galleryView({
		panel_width: 595,
		panel_height: 365,
		frame_width: 100,
		frame_height: 70,
		
		//overlay_height: 50,
		//overlay_opacity: 0.7,
		overlay_height: 0,
		overlay_opacity: 0,
		
		overlay_text_color: 'white',
		caption_text_color: '#222',
		background_color: '#BCBDC1',
		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==========//
/*]]>*/
