//////////to login for admin section///////////////////
$(document).ready( function () 
	{
	// Admin login page validation starts here............................
	
	$("#loginadmin").click(function () {
	  
	 var username=$('#username').val();
	 var password=$('#password').val();
	 //alert(username.length);
	 if(username == "") 
	 {
	 //alert("jjsadhfk");
		 var error="Please fill Username.";
	 }
	 else if(password == "")
	 {
		 var error="Please fill the Password";
	 }
	 //alert(error);
	 if(error != "" && error != null)
	 {
	 $('#error-message').html(error);
	 $('#error-message').show("normal");
   	setTimeout(function() {
	 $('#error-message').hide("slow");
   }, 10000);
	 return false;
	 }
	 return true;
	});	


//---------------------------------------------------------------------------------	
	// Contact Form page validation starts here............................
	
	
// JavaScript Document
		//alert("yes");
	$("#contactForm").click(function () {
	 //alert('clicked'); 
	 var rege = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	 var name=$('#name').val();
	 var email=$('#email').val();
	 var description=$('#description').val();
	 //alert(username.length);
	 if(name == "") 
	 {
	 //alert("jjsadhfk");
		 var error="Please enter your name.";
		 $('#name').focus();
	 }
	 else if(email=="")
	 {
		 var error="Please enter your email address";
		 $('#email').focus();
	 }
	 
	else if(rege.test(email)== false)
	{ 
		 var error="Please enter a valid email address";
		 $('#email').focus();
	}
	 else if(description=="")
	 {
		 var error="Please enter your description";
		 $('#description').focus();
	 }
	else if(description.length>300)
	 {
		 var error="Description can not exceed 500 charachters";
		 $('#description').focus();
	 }
	 //alert(error);
	 if(error != "" && error != null)
	 {
	 $('#error-message').html(error);
	 $('#error-message').show("normal");
   	/*setTimeout(function() {
	 $('#error-message').hide("slow");
   }, 10000);*/
	 return false;
	 }
	 return true;
	});	
//---------------------------------------------------------------------------------	
	// Recruit page validation starts here............................
	
	$("#subscribeForm").click(function () {
	var rege = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	 var email=$('#email').val();	
	 if(email=="")
	 {
		 var error="Please enter your email address";
		 $('#email').focus();
	 }
	 else if(rege.test(email)== false)
	{ 
		 var error="Please enter a valid email address";
		 $('#email').focus();
	}
	if(error != "" && error != null)
	 {
	 $('#error-message').html(error);
	 $('#error-message').show("normal");
	 return false;
	 }
	 return true;
	});
	
	//---------------------------------------------------------------------------------	
	// Recruit Form page validation starts here............................
	
	
// JavaScript Document
		//alert("yes");
	$("#recruitForm").click(function () {
	 //alert('clicked'); 
	 var rege = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	 var name=$('#name').val();
	 var company=$('#company').val();
	 var email=$('#email').val();
	 var phone=$('#phone').val();
	 //alert(username.length);
	 if(name == "") 
	 {
		 var error="Please enter your name.";
		 $('#name').focus();
	 }
	 else if(company == "") 
	 {
		 var error="Please enter your company name.";
		 $('#company').focus();
	 }
	 else if(email=="")
	 {
		 var error="Please enter your email address";
		 $('#email').focus();
	 }
	 
	else if(rege.test(email)== false)
	{ 
		 var error="Please enter a valid email address";
		 $('#email').focus();
	}
	 else if(phone=="")
	 {
		 var error="Please enter your phone number";
		 $('#phone').focus();
	 }
	 //alert(error);
	 if(error != "" && error != null)
	 {
	 $('#error-message').html(error);
	 $('#error-message').show("normal");
	 return false;
	 }
	 return true;
	});	
	
	
	
	//---------------------------------------------------------------------------------	
	// School page validation starts here............................
	
	$("#schoolForm").click(function () {
									
	 var school=$('#school_name').val();
	 if(school=="")
	 {
		 var error="Please enter school name";
		 $('#error-message').html(error);
		 $('#error-message').show("normal");
		 $('#school_name').focus();
		 return false;
	 }
	 return true;
	});
	
});

function validateDownload(filename)
{ 
//alert(filename); 
var path ='http://www.myworkster.com/myworkster/resume/';
//var path ='http://192.168.1.11/myworkster/resume/';
//var path ='http://milestonetelecom.com/milestones/custom_images/';
var fullPath = path+filename;
    window.location.href = fullPath;  
}
