// JavaScript Document
function popupWindow(url) {
    elementWindow = window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=350,height=370,screenX=0,screenY=0,top=0,left=0');
}
function closeWindow() {
	window.close();
}
function verify(form1) 
	{ 
	  //Verify the user name cannot be empty
	  if (form1.tUsername.value =="")	 
	  {
		alert("The username cannot be empty!");
		form1.tUsername.focus();
		return false;
	  }	
	 
	  if (form1.tPassword.value =="")
	  {
	  	alert("The password cannot be empty!")
		form1.tPassword.focus();
		return false;
	  }	 
	  
	  
	  
	  if (form1.tSpecification.value =="")
	  {
	  	alert("The specification cannot be empty!")
		form1.tPassword.focus();
		return false;
	  }	
	  
	  
	  
	  if (form1.tProvince.value =="")
	  {
	  	alert("The province cannot be empty!")
		form1.tPassword.focus();
		return false;
	  }	
	  
	  
	  
	  if (form1.tCountry.value =="")
	  {
	  	alert("The country cannot be empty!")
		form1.tPassword.focus();
		return false;
	  }	
	  
	  
	  
	  
	  
	  return validateEmail(form1.tEmail);	  
	}
	
function removeVideo(ID) {
	
	var answer = confirm("Are you sure you want to remove this video?");
	if (answer){
		window.location = "removeVideo.php?id="+ID;
	}
	else{
		return false;
	}
	
}
function validateEmail(email) 
{
	 //Verify the email address(must have '@'and '.'and at least 6 in length)
	 if (email.value == "" || 
		  email.value.indexOf('@') == -1 || 
		  email.value.indexOf('.') == -1 || 
		  email.length<6) 
	  { 		
		  alert("Not a valid e-mail address!");
		  email.focus();
		  return false;
	  }		  
		  // Verify successed.	
		  return true;
}
function checkPassword(pass1,pass2)
{
	if (pass1.value =="" || pass2.value =="")	 
	  {
		alert("Both Password and confirm password cannot be empty!");
		if (pass1.value =="" )
			pass1.focus();
		if (pass2.value =="")
			pass2.focus();
		return false;
	  }	
	 
	  if (!(pass1.value ==pass2.value))
	  {
	  	alert("Two passwords did not match! Try again!");
		pass1.focus();
		return false;
	  }
	  return true;
}
	
