//This function use for validating password
function mValidatePassword(){
	frm=document.frmPassword;
	 if(Trim(frm.txtOldPassword.value)==""){
			alert("Please Enter Old Password");
			frm.txtOldPassword.focus()
			return false
	 }
	 if(Trim(frm.txtNewPassword.value)==""){
			alert("Please Enter New Password");
			frm.txtNewPassword.focus()
			return false
	 }
	if(frm.txtNewPassword.value.length < 6){
			alert("Password length at least 6 character");
			frm.txtNewPassword.focus()
			return false
	 }
	 if(Trim(frm.txtConPassword.value)==""){
			alert("Please Enter Confirm Password");
			frm.txtConPassword.focus()
			return false
	 }
	 if(Trim(frm.txtNewPassword.value)!=Trim(frm.txtConPassword.value)){
			alert("Password Missmatch");
			frm.txtConPassword.focus()
			return false
	 }
}

function mValidateLogin(){
	
	
	frm=document.frmLogin;
	 if(Trim(frm.txtUserName.value)==""){
		alert("Please Enter Username");
		frm.txtUserName.focus()
		return false
	 }
	 if(Trim(frm.txtPassword.value)==""){
		alert("Please Enter  Password");
		frm.txtPassword.focus()
		return false
	 }
}

	function frmDemoValidate(){
		frmName=document.frmRegister;
		if(Trim(frmName.mTxtUserName.value)==""){
			alert("Please Enter User Name");
			frmName.mTxtUserName.focus();
			return false;
		}
		if(Trim(frmName.mTxtPassword.value)==""){
			alert("Please Enter Password");
			frmName.mTxtPassword.focus();
			return false;
		}
		if(Trim(frmName.mTxtEmail.value)==""){
			alert("Please Enter Email Address");
			frmName.mTxtEmail.focus();
			return false;
		}
		if(Trim(frmName.mTxtDomainName.value)==""){
			alert("Please Enter Domain Name");
			frmName.mTxtDomainName.focus();
			return false;
		}
	}

function showForgot(){
	document.getElementById("forPass").style.display="block"
}



function loginValidate(){


	var frmLogin;
	if(Trim(document.frmLogin.TxtUserName.value)=="enter@youremail.com"){
		alert("Please Enter User Name");
		document.frmLogin.TxtUserName.focus();
		return false;
	}
	if(ValidateEmail(document.frmLogin.TxtUserName)==false){
			document.frmLogin.focus()
			return false;
	}

	

	if(Trim(document.frmLogin.TxtPassword.value)==""){
		alert("Please Enter Password");
		document.frmLogin.TxtPassword.focus();
		return false;
	}
	document.frmLogin.action="?q=user_mUserInfoz&action=checkLogin";
	document.frmLogin.submit();

}
function GroupValidate(){


	var mygroup;
	if(Trim(document.mygroup.Textgroupname.value)=="Name of Project"){
		alert("Please Enter Name of Project");
		document.mygroup.Textgroupname.focus();
		return false;
	}
	if(document.mygroup.Textgroupname.value.length >= 11)  
	{  
		alert("Name of the project Length Must Not Exceed 10 Characters")  
		document.mygroup.Textgroupname.focus();
		return false;
	}  

	if(Trim(document.mygroup.TextTypeOfUsage.value)=="Type of Usage"){
		alert("Please Enter Type of Usage");
		document.mygroup.TextTypeOfUsage.focus();
		return false;
	}
	document.mygroup.action="?q=divisions_mycastingroom&action=addgroup";
	document.mygroup.submit();

}
function SendEmailValidate()
	{


	if(Trim(document.mysendemail.Textsendmaildesc.value)=="Write Your Query About Model?"){
			alert("Please Write Your Query About Model");
			document.mysendemail.Textsendmaildesc.focus()
			return false;
	}

	document.mysendemail.action="?q=divisions_mycastingroom&mode=EmailSend";
	document.mysendemail.submit();

}

function SendEmailmycastingroomValidate()
	{


	if(Trim(document.mysendemail.Textsendmaildesc.value)=="Write Your Query About Model?"){
			alert("Please Write Your Query About Model");
			document.mysendemail.Textsendmaildesc.focus()
			return false;
	}
	
	document.mysendemail.action="?q=divisions_mycastingroomgroup&mode=EmailSend";
	document.mysendemail.submit();

}

//this function will show the content within the <div> tag
function toggleDiv(divName,id)
{

	if(id=='0'){
					
						alert("Please Add Some Talent & Create You Group");
						return false;
					
					}else{
  thisDiv = document.getElementById(divName);
  if (thisDiv)
  {
    if (thisDiv.style.display == "none") {
      thisDiv.style.display = "block";
    }
  }
  else {
    alert("Error: Could not locate div with id: " + divName);
  }

					}
}



//this function will hide the content within the <div> tag
function toggleDiv2(divName)
{
  thisDiv = document.getElementById(divName);
  if (thisDiv)
  {
    if (thisDiv.style.display == "block") {
      thisDiv.style.display = "none";
    }
  }
  else {
    alert("Error: Could not locate div with id: " + divName);
  }
}

		function profileEditValidate()
		{
		
		var myform;
		if(Trim(document.myform.firstname.value)=="")
		{
		alert("Please Enter First Name");
		document.myform.firstname.focus()
		return false;
		}
		if(Trim(document.myform.lastname.value)=="")
		{
		alert("Please Enter Last Name");
		document.myform.lastname.focus()
		return false;
		}

	if(Trim(document.myform.dob.value)=="")
		{
		alert("Please Enter Date Of Birth");
		document.myform.dob.focus()
		return false;
		}

		if(Trim(document.myform.dob.value)=="")
		{
		alert("Please Enter Date Of Birth");
		document.myform.dob.focus()
		return false;
		}

		if(Trim(document.myform.email.value)=="")
		{
		alert("Please Enter Email Address");
		document.myform.email.focus()
		return false;
		}
		
		if(ValidateEmail(document.myform.email)==false){
		document.myform.focus()
		return false;
		}
		if(Trim(document.myform.companyname.value)=="")
		{
		alert("Please Enter Company Name");
		document.myform.companyname.focus()
		return false;
		}
		
		if(Trim(document.myform.street.value)=="")
		{
		alert("Please Enter Streets Address");
		document.myform.street.focus()
		return false;
		}


		if(Trim(document.myform.city.value)=="")
		{
		alert("Please Enter city");
		document.myform.city.focus()
		return false;
		}

		if(Trim(document.myform.state.value)=="")
		{
		alert("Please Enter state");
		document.myform.state.focus()
		return false;
		}

		if(document.getElementById("postcode").value=="")
		{
		alert("please enter post code");
		document.getElementById("postcode").focus();
		document.getElementById("postcode")=='';
		return false;
		}
		if(!(IsNumeric(document.getElementById('postcode').value)))
		{
		alert("Post code number should have only numbers.");
		document.getElementById("postcode").focus();
		return false;
		}
		if(document.getElementById("telephone").value=="")
		{
		alert("please enter Telephone number");
		document.getElementById("telephone").focus();
		document.getElementById("telephone")=='';
		return false;
		}
		if(!(IsNumeric(document.getElementById('telephone').value)))
		{
		alert("Telephone number should have only numbers.");
		document.getElementById("telephone").focus();
		return false;
		}


		
		document.myform.action="?q=user_editprofilesubmit";
		document.myform.submit();

		}



		
function IsNumeric(sText)
	{
	   var ValidChars = "0123456789-";
	   var IsNumber=true;
	   var Char;
 
	   for (i = 0; i < sText.length && IsNumber == true; i++) 
       { 
      		Char = sText.charAt(i); 
		    if (ValidChars.indexOf(Char) == -1) 
         	{
		         IsNumber = false;
            }
      }
		   return IsNumber;
    }


	
	
	//function DeleteTalents(mVarUserId='',mTempId='',TID='',DID='')
	function DeleteTalents(id,mTempId,TID,DID)
	{
	 
      
		if(id=='')
		{

			alert("Please Login to proceed further");
			return false;
		}
	
		
			else if(confirm("Are you sure you want to delete?"))
			{

	location.href="?q=divisions_division&mode=Delete&id="+mTempId+"&tid="+TID+"&Cat="+DID;

			}
			

		
		
	}

function DeleteMyGroup(CID,GID)
	{
	
      
		 if(confirm("Are you sure you want to delete this group?"))
			{

	location.href="?q=divisions_mycastingroom&mode=DeleteGroup&cltid="+CID+"&grpid="+GID;

			}
			

		
		
	}


function ClientsRegistrationValidate(mVar)
		{
	
	
			/*if(document.myform.firstname.value=="" && document.myform.firstname.value!="Enter Firstname"){
			alert("Please Enter First Name");
			document.myform.firstname.focus();
			return false;
			}*/
if(document.myform.email.value=='Enter Email')
			{
			alert("Please Enter Email Address");
			document.myform.email.focus()
			return false;
			}

			if(ValidateEmail(document.myform.email)==false){
			document.myform.focus()
			return false;
			}

			if(document.myform.verifyemail.value=='Verify Email Address')
			{
			alert("Please Enter Verify Email Address");
			document.myform.verifyemail.focus()
			return false;
			}

			if(ValidateEmail(document.myform.verifyemail)==false){
			document.myform.focus()
			return false;
			}
				
		 if(Trim(document.myform.email.value)!=Trim(document.myform.verifyemail.value)){
			alert("Email Missmatch");
			document.myform.focus()
			return false;
		 }
		
	if(document.myform.firstname.value=="Enter Firstname"){
			alert("Please Enter First Name");
			document.myform.firstname.focus();
			return false;
			}
			
if(document.myform.lastname.value=="Enter Lastname"){
			alert("Please Enter Last Name");
			document.myform.lastname.focus();
			return false;
			}
		
if(document.myform.companyname.value=="Enter Company Name"){
			alert("Please Enter Company Name");
			document.myform.companyname.focus();
			return false;
			}

			
			
if(document.myform.city.value=="Enter City"){
			alert("Please Enter City");
			document.myform.city.focus();
			return false;
			}
			
if(document.myform.postcode.value=="Enter Zip Code"){
			alert("Please Enter Zip Country");
			document.myform.postcode.focus();
			return false;
			}
			

if(document.myform.state.value=="Enter State"){
			alert("Please Enter State");
			document.myform.state.focus();
			return false;
			}
			

if(document.myform.country.value=="Enter Country"){
			alert("Please Enter Country");
			document.myform.country.focus();
			return false;
			}

			if(document.myform.phoneorfaxno.value=="Phone Or Fax No"){
			alert("Please Enter Phone Or Fax No");
			document.myform.phoneorfaxno.focus();
			return false;
			}


if(document.myform.cellno.value=="Cell No"){
			alert("Please Enter Cell No");
			document.myform.cellno.focus();
			return false;
			}
if(document.myform.password.value==""){
			alert("Please Enter Password");
			document.myform.password.focus();
			return false;
			}


			if(document.myform.verifypassword.value==""){
			alert("Please Enter Verify password");
			document.myform.verifypassword.focus();
			return false;
			}

		

		  if(document.myform.password.value!=document.myform.verifypassword.value){
			alert("Password Missmatch");
			document.myform.focus()
			return false;
		 }
		
				if(mVar=="Add")
				{
					document.myform.action="?q=user_mUserInfoz&action=register";
					document.myform.submit();
				}else if(mVar=="Edit")
				{
					document.myform.action="?q=user_mUserInfoz&action=edit";
					document.myform.submit();
				}



  
  
		}


    //this function will show the content within the <div> tag
function SendEmailDiv(divName,id,imgid)
{

	
/*
alert(document.forms[0].id.value);
talentid=document.forms[0].id.value;
  */

document.mysendemail.sendmailtalentid.value=id;
document.mysendemail.imgid.value=imgid;
		

		if(id=='0')
		{

			alert("Please Add Some Talent & Create You Group");
			return false;

		}
		else
		{
				thisDiv = document.getElementById(divName);
				if (thisDiv)
				{
					if (thisDiv.style.display == "none") 
					{
						thisDiv.style.display = "block";
					}

			
				}
				else 
				{
					alert("Error: Could not locate div with id: " + divName);
				}

		}
}




	//function DeleteTalents(mVarUserId='',mTempId='',TID='',DID='')
	function DeleteTalentsSearch(id,mTempId,TID,DID)
	{
	 
      
		if(id=='')
		{

			alert("Please Login to proceed further");
			return false;
		}
	
		
			else if(confirm("Are you sure you want to delete?"))
			{

	location.href="?q=divisions_mSearchResult&mode=Delete&id="+mTempId+"&tid="+TID+"&Cat="+DID;

			}
			

		
		
	}


	

function SendGroupEmailDiv(divName,id,cid)
{

/*
alert(document.forms[0].id.value);
talentid=document.forms[0].id.value;
  */

//document.mycastingroom.sendmailtalentid.value=id;

		if(id=='0')
		{

			alert("Please Add Some Talent & Create You Group");
			return false;

		}
		else
		{
				thisDiv = document.getElementById(divName);
				if (thisDiv)
				{
					if (thisDiv.style.display == "none") 
					{
						thisDiv.style.display = "block";
					}

			
				}
				else 
				{
					alert("Error: Could not locate div with id: " + divName);
				}

		}
}


		function SendGroupEmailValidate(gid,cid)
		{

		if(Trim(document.mygroupemail.TextEmailId.value)==""){
		alert("Please Enter Email Address");
		document.mygroupemail.TextEmailId.focus()
		return false;
		}
		if(ValidateEmail(document.mygroupemail.TextEmailId)==false){
		document.mygroupemail.focus()
		return false;
		}

		document.mygroupemail.action="?q=divisions_mycastingroomgroup&mode=GroupEmailSend&GID="+gid+"&CID="+cid;
		document.mygroupemail.submit();

		}
