// JavaScript Document
function login_validation()
{
	
	if(document.form1.textfield.value == '')
	{
		alert("Enter Login name");
		return false;
	}
	if(document.form1.textfield2.value == '')
	{
		alert("Enter Password");
		return false;
	}

return true;
	
}

function forgot_validation()
{
	 if(document.forgot_pass.email.value == '' )
    {
        alert('Enter Email');
        document.forgot_pass.email.focus();
        return false;
    }
    if(isValidEmail(document.forgot_pass.email.value) == false)
    {
			alert('Enter Correct Email');
            document.forgot_pass.email.focus();
            return false;
    }   
	
	function isValidEmail(str)
    {
        return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
    }
return true;
}


function checkvalid_user()
{
   if( !(document.userprofile.checkbox_c.checked ) )
    {
        alert('Please accept terms and conditions');
        document.userprofile.checkbox_c.focus();
        return false;
    }
}


function password_validation()
{
	 if(document.change_pass.old_pass.value == '' )
    {
        alert('Enter Old Password');
        document.change_pass.old_pass.focus();
        return false;
    }
	
	if(document.change_pass.password1.value == '' )
    {
        alert('Enter New Password');
        document.change_pass.password1.focus();
        return false;
    }
   
   if(document.change_pass.password2.value == '' )
    {
        alert('Retype Password');
        document.change_pass.password2.focus();
        return false;
    }
	
	if( (document.change_pass.password2.value)!= (document.change_pass.password1.value)  )
    {
        alert('Enter Correct Password');
        document.change_pass.password2.focus();
        return false;
    }
}


function checkvalid1()
{
    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;
     }
    
	 if(document.candidateprofile.first.value == '')
    {
        alert('Enter First Name');
		document.candidateprofile.first.focus();
        return false;
    }
  
    if(document.candidateprofile.last.value == '')
    {
       alert('Enter Last Name');
        document.candidateprofile.last.focus();
        return false;
    }
	
	if(document.candidateprofile.email.value == '' )
    {
        alert('Enter Email');
        document.candidateprofile.email.focus();
        return false;
    }
    if(isValidEmail(document.candidateprofile.email.value) == false)
    {
			alert('Enter Correct Email');
            document.candidateprofile.email.focus();
            return false;
    }    
   
 	if(document.candidateprofile.zip.value == '' )
    {
       	alert('Enter Zipcode');
        document.candidateprofile.zip.focus();
        return false;
    }    
	if(IsNumeric(document.candidateprofile.zip.value) == false)
    {
            alert('Enter Valid Zipcode');
            document.candidateprofile.zip.focus();
            return false;
    }
	
	if(document.candidateprofile.state.value == '' )
    {
      	alert('Enter State');
        document.candidateprofile.state.focus();
        return false;
    }  
	
	if(document.candidateprofile.selectbox.value == 'My Group' )
	{
		if(document.candidateprofile.mygroup.value == '' )
    	{
       		alert('Enter Group Name');
        	document.candidateprofile.mygroup.focus();
        	return false;
		}
    }
	
	if(document.candidateprofile.election.value == '' )
    {
       	alert('Enter Election Date');
        document.candidateprofile.election.focus();
        return false;
    }
	
	if(document.candidateprofile.position.value == '' )
    {
       	alert('Enter Position');
        document.candidateprofile.position.focus();
        return false;
    }
      
	if( !(document.candidateprofile.checkbox_c.checked ) )
    {
        alert('Please accept terms and conditions');
        document.candidateprofile.checkbox_c.focus();
        return false;
    }
   
   function isValidEmail(str)
    {
        return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
    }
    
}

function check_upoad()
{
    if(document.frmupload.title.value == '' )
    {
        alert('Enter Title For Video');
        document.frmupload.title.focus();
        return false;
    }
   
    if(document.frmupload.disc.value == '')
    {
        alert('Enter Description For Video');
		document.frmupload.disc.focus();
        return false;
    }
  
    if(document.frmupload.tags.value == '')
    {
       alert('Enter Tag For Video');
        document.frmupload.tags.focus();
        return false;
    }
    
	if(document.getElementById("catselect").value == '' )
    {
        alert('Please Select the Category');
        document.getElementById("catselect").focus();
        return false;
    }
   
   if(document.frmupload.file_upload.value == '' )
    {
        alert('Please Upload Video');
        document.frmupload.file_upload.focus();
        return false;
    }
	
	if( !(document.frmupload.checkbox.checked ) )
    {
        alert('Please accept terms and conditions');
        document.frmupload.checkbox.focus();
        return false;
    }
	
   
 }

