// JavaScript Document

function verify(form)
{
  if(document.getElementById('title').value == "")
  {
    alert("Please Enter Video title.");
	document.getElementById('title').focus();
	return false
  }
  if(document.getElementById('description').value == "")
  {
    alert("Please Enter The Description.");
	document.getElementById('description').focus();
	return false
  }
  if(document.getElementById('keywords').value == "")
  {
    alert("Please Enter The Tags.");
	document.getElementById('keywords').focus();
	return false
  }
  
  if(document.getElementById('chkagree').checked == false)
  {
    alert("Please Agree to the Terms of Use to Proceed.");
	document.getElementById('chkagree').focus();
	return false
  }
}

/* TECHNOKRAFST : START  VALIDATION FOR CONTACT US FORM */
function validate_contact_form(f)
{
   var elements = f.elements.length;
  var str  = "##############################################\n\n";
      str += "Following Errors were Encountered while Processing\n\n";
  for(var i=0;i<elements;i++)
   {
	   if(f.elements[i].value=="")
	   {
		   str += "Please Fill In The "+ f.elements[i].name + "\n\n"; 
	   }
   }
   if(f.EmailAddress.value != "") {
   if (echeck(f.EmailAddress.value)==false){
		str +="Please Fill In The Valid E-mail ID\n";
	}
   }
   str  += "##############################################\n\n";
   alert(str);
   return false;
}

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;					
	}

/* TECHNOKRAFST : START  VALIDATION FOR CONTACT US FORM */


function UncheckTextradio()
{
	if(document.getElementById('chktext').checked)
       {
		 document.getElementById('chktext').checked = false;
	   }
	 
}
function UncheckDropradio()
{
	if(document.getElementById('chkdrop').checked)
       {
		 document.getElementById('chkdrop').checked = false;
	   }
	 
}

function func_onchange(){
	
    document.frmHeader.submit();
  }
  
function tag_tks(id,tname)
{
  alert('in');
  document.frmtag.action = 'http://www.myjizztube.com/live/video_tks.php'; 
  document.frmtag.id.value = id;
  document.frmtag.tag_name.value = tname;
  document.frmtag.submit();
}  