// JavaScript Document


 $(document).ready(function() {
   // put all your jQuery goodness in here.
   $('.nav li').mouseenter(function() {   

        var ctrlshow = this.id+ " ul";
	    $('#'+ctrlshow).show();
	
	});
	
	$('.nav li').mouseleave(function() {   

        $('.nav ul').hide();
     
	});
	
	//Preload iamge
     var preload_image = new Image(25,25); 
     preload_image.src="../images/roll-bg.png"; 	
 });

function lightBox(id) {
	
	var windowWidth = 800;
	var windowHeight = 800;
	
	if(navigator.appName == "Microsoft Internet Explorer") {
		windowWidth = document.body.offsetWidth;
		windowHeight = windowHeight + document.body.offsetHeight;
	}
	else {
		windowWidth = window.innerWidth;
		windowHeight = window.innerHeight;	
	}
	
	xPos = windowWidth - 580;
	xPos = xPos / 2;
	yPos = windowHeight - 478;
	yPos = xPos / 2;
	
	xPos += "px";
	yPos += "px";
	
	var width = windowWidth + "px";
	var height = windowHeight + "px";
	
	var bkgrdDiv = document.createElement("div");
	bkgrdDiv.setAttribute("id", "bkgrdDiv");
	bkgrdDiv.style.backgroundColor = "#000000";
	bkgrdDiv.style.width = width;
	bkgrdDiv.style.height = "1200px";
	bkgrdDiv.style.position = "absolute";
	bkgrdDiv.style.top = "0";
	bkgrdDiv.style.left = "0";
	bkgrdDiv.style.opacity = "0.5";
	bkgrdDiv.style.filter = "alpha(opacity=50)";
	bkgrdDiv.style.zIndex = "45";
	
	var newDiv = document.createElement("div");
	newDiv.setAttribute("id", "videoDiv");
	newDiv.style.backgroundColor = "white";
	newDiv.style.width = "600px";
	newDiv.style.height = "478px";
	newDiv.style.position = "absolute";
	newDiv.style.top = yPos;
	newDiv.style.left = xPos;
	newDiv.style.opacity = "1";
	newDiv.style.filter = "alpha(opacity=100)";
	newDiv.style.zIndex = "50";
	
	
	newDiv.innerHTML = "<iframe id='frame' src='player.html?id="+id+"' scrolling='yes' frameborder='0' style='width:600px; height: 446px;overflow: visible'></iframe><div style='background-color: #ccc; display='block'; width: 480px;'><p style='font-size: 10px; font-weight: bold; margin: 0 20px; padding: 10px 0;'><a href='' onclick='removeLightBox(); return false' style='color: #000;'>X CLOSE</a></p></div>";
	
	
	var pageBody = document.getElementsByTagName("body");
	pageBody[0].appendChild(bkgrdDiv);
	pageBody[0].appendChild(newDiv);
	
}

function removeLightBox() {
	var pageBody = document.getElementsByTagName("body");
	var bkgrdDiv = document.getElementById("bkgrdDiv");
	var videoDiv = document.getElementById("videoDiv");
	
	pageBody[0].removeChild(bkgrdDiv);
	pageBody[0].removeChild(videoDiv);
}


//Function for Form Validation 
function ValidateForm() {
if(document.form1.fn.value=="First Name" || document.form1.fn.value=="" || document.form1.fn.value=="0")
{
alert(" Please write First Name");
document.form1.fn.focus();
return false;
}

if(document.form1.ln.value=="Last Name" || document.form1.ln.value=="" || document.form1.ln.value=="0")
{
alert(" Please write Last Name");
document.form1.ln.focus();
return false;
}


if( document.form1.em.value=="Email" || document.form1.em.value=="" || document.form1.em.value=="0")
{
alert(" Please fill Email");
document.form1.em.focus();
return false;
}

if(  document.form1.em.value=="Email" || document.form1.em.value.indexOf("@") == -1 || document.form1.em.value.indexOf(".") == -1 || document.form1.em.value.indexOf(" ")!=-1)
{
alert("Invalid Email ID");
document.form1.em.focus();
return false;
}
}
//Function for Form Validation  End