function SetCookie() {
	var c_name = "videodisplay";
	var value = "1";
	document.cookie = c_name+ "=" +value;
}
var Player;
function videoinitialize() {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	Player = (isIE) ? window['nectar_intro'] : document['nectar_intro'];
}
function stopVideo() {
	if(navigator.appName.indexOf("Microsoft") != -1) {
		if(Player)
			Player.stopVideo();
	}
}
function playVideo() {
	if(navigator.appName.indexOf("Microsoft") != -1) {
		Player.playVideo();
	}
}
// JavaScript Document
function Playvideo(val) {
	$(document).ready(function() {
		var id = '#dialog';
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		if(val == 0) {
			//transition effect		
			$('#mask').fadeIn(10);	
			$('#mask').fadeTo("slow",10.8);
		}
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
		
		//Set the popup window to center
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
		//transition effect
		if(val == 0) {
			$(id).fadeIn(2000);
		} else {
			$(id).hide();
		}
		
		//if close button is clicked
		$('.skip').click(function (e) {
			videoinitialize();
			//Cancel the link behavior
			$("#container").show();
			e.preventDefault();
			SetCookie();
			$("#dialog").fadeOut(300, function() {});
			$("#mask").fadeOut(300, function() {});
			stopVideo();
		});
	});
}
$(document).ready(function(){
	$('#youtubeicon').hover(function () {
		$("#youtube").fadeIn(1000, function() {});
	});
	$('#youtubeicon').mouseleave(function () {
		$("#youtube").fadeOut(0, function() {});
	});
	$('#tweeter_link').hover(function () {
		$("#tweeter").fadeIn(1000, function() {});
	});
	$('#tweeter_link').mouseleave(function () {
		$("#tweeter").fadeOut(0, function() {});
	});
	$('#fb_link').hover(function () {
		$("#fb").fadeIn(1000, function() {});
	});
	$('#fb_link').mouseleave(function () {
		$("#fb").fadeOut(0, function() {});
	});
	$('#feed_link').hover(function () {
		$("#feed").fadeIn(1000, function() {});
	});
	$('#feed_link').mouseleave(function () {
		$("#feed").fadeOut(0, function() {});
	});
});
jQuery.noConflict();
