
var security_code;
function fixedSize(valudx)
{
	security_code=valudx;
}

function ajax()

	{

		var ddr;

		var browser = navigator.appName;

		if(browser == "Microsoft Internet Explorer")

			ddr  = new ActiveXObject("Microsoft.XMLHTTP");

		else

			ddr  = new XMLHttpRequest();

		return ddr;

	}

	

	var Oj  = ajax();

	var Oj1  = ajax();

	

		function emailvalid()

	{

	//		alert("asdasd"+Oj.responseText);

			if(Oj.readyState==4)

			{

				if(Oj.responseText==0)

				{	document.getElementById('chk_email').innerHTML = ''; return true;		}

				else if(Oj.responseText==1)

				{	document.getElementById('chk_email').innerHTML = 'email id already exists'; return false;		}

				//			alert(Oj.responseText);

			}

	}

	

function creeventfrm(form)

{

	

	var eventname =form.eventname.value;

	var eventorganizer =form.eventorganizer.value;

	var email=form.email.value;

}

function  mail_form(form)
{
	
var email=form.email.value;
 var career=form.career.value;
 
var address=form.address.value;

	if(career=="")
{

 inlineMsg('career','Please Enter Your career Details.',2);	

 return false;
}

 
if(email=="")
{

inlineMsg('email','Please Enter Your Email.',2);	
	return false;
}
var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

     if(!email.match(emailRegex)) 

	{

        inlineMsg('email','You have entered an invalid Email.',2);

		return false;

    }
	

	
 
if(address=="")
{
inlineMsg('address','Please Enter Your Address.',2);	

 return false;
	
}



}

function Validate_form(form)
{
	
var Email=form.txtEmail.value;

var name=form.txtFname.value;
var lname=form.txtLname.value;

var city=form.txtCity.value;
var state=form.txtState.value;

var Cno=form.txtTel.value;
var university=form.selUniversity.value;
var course=form.selcourse.value;
if(Email=="")
{

inlineMsg('txtEmail','Please Enter Your Email.',2);	
	return false;
}
var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

     if(!Email.match(emailRegex)) 

	{

        inlineMsg('txtEmail','You have entered an invalid Email.',2);

		return false;

    }
	
	
	
	if(name=="")
{

 inlineMsg('txtFname','Please Enter Your Name.',2);	

 return false;
}

if(lname=="")
{
	inlineMsg('txtLname','Please Enter Your Name.',2);	

 return false;
	
}


if(city=="")
{
inlineMsg('txtCity','Please Enter Your city.',2);	

 return false;	
	
	
}

if(state=="")
{
inlineMsg('txtState','Please Enter Your State.',2);	

 return false;	
	
}
if(Cno=="")
{
	
inlineMsg('txtTel','Please Enter Your Contact number.',2);	

 return false;	
	
}

if(isNaN(Cno))
{

inlineMsg('txtTel','Please Enter Your Valid Contact number.',2);
return false;
}

if(university=="")
{

inlineMsg('selUniversity','Please select your university.',2);
return false;
	
}

if(course=="")
{

inlineMsg('txtcourse','Please Select Your course.',2);
return false;
	
	
}

var vcode1=document.getElementById("txtVCode1").value;
	if(vcode1=="")
	{					
		inlineMsg('txtVCode1','Please Enter verification code.',2);
		document.getElementById('txtVCode1').focus();						
		return false;
	}
	else if(vcode1!=security_code)
	{	    	
		inlineMsg('txtVCode1','Verification code valid.',2);
		document.getElementById('txtVCode1').focus();
		return false;
	}
	else
	{
		document.getElementById('v_code').innerHTML = "";
	}
	


}


function enquiry_form(form)
{
	
var email=form.email.value;

var name=form.name.value;
 

var city=form.city.value;
var country=form.country.value;

var phone=form.phone.value;
var add=form.add.value;
 
 if(name=="")
{

 inlineMsg('name','Please Enter Your Name.',2);	

 return false;
}

	if(add=="")
{

inlineMsg('add','Please enter your address.',2);
return false;
	
}
	

if(city=="")
{
inlineMsg('city','Please Enter Your city.',2);	

 return false;	
	
	
}

if(country=="")
{
inlineMsg('country','Please Enter Your country.',2);	

 return false;	
	
}
if(phone=="")
{
	
inlineMsg('phone','Please Enter Your Contact number.',2);	

 return false;	
	
}

if(isNaN(phone))
{

inlineMsg('phone','Please Enter Your Valid Contact number.',2);
return false;
}
if(email=="")
{

inlineMsg('email','Please Enter Your Email.',2);	
	return false;
}
var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

     if(!email.match(emailRegex)) 

	{

        inlineMsg('email','You have entered an invalid Email.',2);

		return false;

    }
	
	

}


function valid_rating(form)

{ 





	

	var rat=form.ratcount.value;



	 var recomm=form.radiochk.value

	var comments=form.comments.value;

	

	

	 if(rat=="")

	 {

		inlineMsg('RateMsg','You must rate this Strategy.',2);

		return false;

	 }



	 

 if(recomm=="")

	 {

	inlineMsg('radio','You must choose recommended.',2);

	return false;	 

	 }

	 

	 if(comments=="")

	 {

		inlineMsg('comments','You must enter your comments.',2);

		return false;

	 }	 

}



function validate_register(form)

{

	

var fname=form.fname.value;

var lname=form.lname.value;

var email=form.email.value;

var country=form.country.value;

var city=form.city.value;

var state=form.state.value;

var zipcode=form.zipcode.value;

var company=form.company.value;

var jobtitle=form.jobtitle.value;

var industry=form.industry.value;

var username=form.username.value;

var password=form.password.value;

var confirmpwd=form.confirmpwd.value;

var sec_code=form.sec_code.value;



if(fname=="")

	{

		inlineMsg('fname','You must Enter First name.',2);  

		return false;

	}	

	if(lname=="")

	{

		inlineMsg('lname','You must Enter Last name.',2);  

		return false;

	}

	if(email=="")

	{

		inlineMsg('email','You must Enter Email.',2);  

		return false;

	}

	var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

     if(!email.match(emailRegex)) 

	{

        inlineMsg('email','You have entered an invalid Email.',2);

		return false;

    }

	if(email!="")

	{

	document.getElementById('chk_email').innerHTML = 'Please Wait';

	{	

			Oj.open('get','emailcheck.php?eid='+document.getElementById('email').value);

			Oj.onreadystatechange=emailvalid;

			Oj.send('');

		}	

		

	}

	if(city=="")

	{

		inlineMsg('city','You must Enter City.',2);  

		return false;

	}

	if(state=="")

	{

		inlineMsg('email','You must Enter State.',2);  

		return false;

	}

	

	if(zipcode=="")

	{

		inlineMsg('zipcode','You must Enter Zipcode.',2);  

		return false;

	}

	if(company=="")

	{

		inlineMsg('company','You must Enter company.',2);  

		return false;

		

	}

	if(jobtitle=="")

	{

		inlineMsg('jobtitle','You must Enter jobtitle.',2);  

		return false;

		

	}

	if(industry=="")

	{

		inlineMsg('industry','You must Enter industry.',2);  

		return false;

		

	}

	if(username=="")

	{

		inlineMsg('username','You must Enter username.',2);  

		return false;

		

	}

	if(password=="")

	{

		inlineMsg('password','You must Enter password.',2);  

		return false;

		

	}

	if(confirmpwd=="")

	{

		inlineMsg('confirmpwd','You must Enter confirm password.',2);  

		return false;

		

	}

	if(!password.match(confirmpwd))

	{

		inlineMsg('confirmpwd','password and confirm password not same.',2);

		return false;

    }

	if(sec_code=="")

	{

		inlineMsg('sec_code','You must Enter security code.',2);  

		return false;

		

	}

}







// form validation function for employer registration //

function vaild_profile(form) {

	 

   var country=form.selCountry.value;

   var zipcode=form.txtZipcode.value;

   var pass=form.txtPassword.value;

   var passlength=form.txtPassword.value.length;

   var repass=form.txtRepassword.value;

   var passlength1=form.txtRepassword.value.length;

   

   var employee=form.txtEmployeestatus.value;

   var company=form.txtCompany.value;

   var title=form.txtTitle.value;

   var industry=form.selIndustry.value;

   

	var nameRegex = /^[a-z]+(([\-][a-z ])?[a-z]*)*$/;

	var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

	var passRegex=/^(\w(\s)?)+$/;

	var cityRegex=/^([A-z]+)$/;

	

    if(country=="")

	{

		inlineMsg('selCountry','You must select country.',2);  

		return false;

	}

	if(zipcode=="")

	{

		inlineMsg('txtZipcode','You must enter postal code.',2);

		return false;

	}

	if(pass=="")

	{

		inlineMsg('txtPassword','You must enter your Password.',2);

		return false;

	}

	if(!pass.match(passRegex))

	{

		inlineMsg('txtPassword','You have entered an invalid Password.',2);

		return false;

    }

	if(passlength<6)

	{

		inlineMsg('txtPassword','Password Should be maximum 6 characters',2);

		return false;

	}

	if(repass=="")

	{

		inlineMsg('txtRepassword','You must enter re-type password.',2);

		return false;

	}

	if(!repass.match(passRegex))

	{

		inlineMsg('txtRepassword','You have entered an invalid Password.',2);

		return false;

    }

	if(passlength1<6)

	{

		inlineMsg('txtRepassword','Re-type password Should be maximum 6 characters',2);

		return false;

	}

	if(!pass.match(repass))

	{

		inlineMsg('txtRepassword','Re-type password does not match password',2);

		return false;

	}

	if(employee=="")

	{

		inlineMsg('txtEmployeestatus','You must enter employee status.',2);

		return false;

	}

	if(company=="")

	{

		inlineMsg('txtCompany','You must enter company name.',2);

		return false;

	}

	if(title=="")

	{

		inlineMsg('txtTitle','You must enter title.',2);

		return false;

	}

	 if(industry=="")

	{

		inlineMsg('selIndustry','You must select industry.',2);

		return false;

	}

}



//Validate Login Form



function validate_login(form)

{

   var email=form.txtEmailid.value;

   var pass=form.txtPassword.value;

   var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

   if(email=="")

	{

		inlineMsg('txtEmailid','You must enter your Email.',2);

		return false;

	}

	if(!email.match(emailRegex)) 

	{

        inlineMsg('txtEmailid','You have entered an invalid Email.',2);

		return false;

    }

	if(pass=="")

	{

		inlineMsg('txtPassword','You must enter your Password.',2);

		return false;

	}

}



//Validate Forgot Password



function validate_fpassword(form)

{

   var email=form.txtEmail.value;

   var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

   if(email=="")

	{

		inlineMsg('txtEmail','You must enter your Email.',2);

		return false;

	}

	if(!email.match(emailRegex)) 

	{

        inlineMsg('txtEmail','You have entered an invalid Email.',2);

		return false;

    }

}



// Validate Contactus Form



function validate_contact(form)

{

   var name=form.txtName.value;

   var email=form.txtEmail.value;

   var subject=form.txtSubject.value;

   var message=form.txtMessage.value;

   

   var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

   

    if(name=="")

	{

		inlineMsg('txtName','You must enter your fullname.',2);

		return false;

	}

   if(email=="")

	{

		inlineMsg('txtEmail','You must enter your Email.',2);

		return false;

	}

	if(!email.match(emailRegex)) 

	{

        inlineMsg('txtEmail','You have entered an invalid Email.',2);

		return false;

    }

	if(subject=="")

	{

		inlineMsg('txtSubject','You must enter subject.',2);

		return false;

	}

	if(message=="")

	{

		inlineMsg('txtMessage','You must enter your message.',2);

		return false;

	}	



}



//Validate the JobSeeker Login



function validate_seekerlogin(form)

{

   var fname=form.txtFirstname.value;

   var lname=form.txtLastname.value;

   var pass=form.txtPassword1.value;

   var passlength=form.txtPassword1.value.length;

   var employer=form.txtEmployer.value;

   var position=form.txtPosition.value;

   var qualifi=form.selQualification.value;

   var technical=form.txtTechnical.value;

   var admin=form.txtAdmin.value;

   var management=form.txtManagement.value;

   var salary=form.selSalary.value;

   

   var passRegex=/^(\w(\s)?)+$/;

	

   if(fname=="")

	{

		inlineMsg('txtFirstname','You must enter your firstname.',2);

		return false;

	}	

	if(lname=="")

	{

		inlineMsg('txtLastname','You must enter your lastname.',2);

		return false;

	}

	if(pass=="")

	{

		inlineMsg('txtPassword1','You must enter your password.',2);

		return false;

	}

	if(!pass.match(passRegex))

	{

		inlineMsg('txtPassword1','You have entered an invalid Password.',2);

		return false;

    }

	if(passlength<6)

	{

		inlineMsg('txtPassword1','Password Should be maximum 6 characters',2);

		return false;

	}

	if(employer=="")

	{

		inlineMsg('txtEmployer','You must enter your employer.',2);

		return false;

	}	

	if(position=="")

	{

		inlineMsg('txtPosition','You must enter your position.',2);

		return false;

	}	

	if(qualifi=="")

	{

		inlineMsg('selQualification','You must select your qualification.',2);

		return false;

	}	

	if(technical=="")

	{

		inlineMsg('txtTechnical','You must enter your technical skills.',2);

		return false;

	}	

	if(admin=="")

	{

		inlineMsg('txtAdmin','You must enter your administration skills.',2);

		return false;

	}	

	if(management=="")

	{

		inlineMsg('txtManagement','You must enter your management skills.',2);

		return false;

	}

	if(salary=="")

	{

		inlineMsg('selSalary','You must select salary.',2);

		return false;

	}

}

// START OF MESSAGE SCRIPT //



var MSGTIMER = 20;

var MSGSPEED = 5;

var MSGOFFSET = 3;

var MSGHIDE = 3;



// build out the divs, set attributes and call the fade function //

function inlineMsg(target,string,autohide) {

  var msg;

  

  var msgcontent;

  if(!document.getElementById('msg')) {

    msg = document.createElement('div');

    msg.id = 'msg';

    msgcontent = document.createElement('div');

    msgcontent.id = 'msgcontent';

    document.body.appendChild(msg);

    msg.appendChild(msgcontent);

    msg.style.filter = 'alpha(opacity=0)';

    msg.style.opacity = 0;

    msg.alpha = 0;

  } else {

    msg = document.getElementById('msg');

    msgcontent = document.getElementById('msgcontent');

  }

  msgcontent.innerHTML = string;

  msg.style.display = 'block';

  var msgheight = msg.offsetHeight;

  var targetdiv = document.getElementById(target);

  targetdiv.focus();

  var targetheight = targetdiv.offsetHeight;

  var targetwidth = targetdiv.offsetWidth;

  var topposition = topPosition(targetdiv) - ((msgheight - targetheight) / 2);

  var leftposition = leftPosition(targetdiv) + targetwidth + MSGOFFSET;

  msg.style.top = topposition + 'px';

  msg.style.left = leftposition + 'px';

  clearInterval(msg.timer);

  msg.timer = setInterval("fadeMsg(1)", MSGTIMER);

  if(!autohide) {

    autohide = MSGHIDE;  

  }

  window.setTimeout("hideMsg()", (autohide * 1000));

}



// hide the form alert //

function hideMsg(msg) {

  var msg = document.getElementById('msg');

  if(!msg.timer) {

    msg.timer = setInterval("fadeMsg(0)", MSGTIMER);

  }

}



// face the message box //

function fadeMsg(flag) {

  if(flag == null) {

    flag = 1;

  }

  var msg = document.getElementById('msg');

  var value;

  if(flag == 1) {

    value = msg.alpha + MSGSPEED;

  } else {

    value = msg.alpha - MSGSPEED;

  }

  msg.alpha = value;

  msg.style.opacity = (value / 100);

  msg.style.filter = 'alpha(opacity=' + value + ')';

  if(value >= 99) {

    clearInterval(msg.timer);

    msg.timer = null;

  } else if(value <= 1) {

    msg.style.display = "none";

    clearInterval(msg.timer);

  }

}



// calculate the position of the element in relation to the left of the browser //

function leftPosition(target) {

  var left = 0;

  if(target.offsetParent) {

    while(1) {

      left += target.offsetLeft;

      if(!target.offsetParent) {

        break;

      }

      target = target.offsetParent;

    }

  } else if(target.x) {

    left += target.x;

  }

  return left;

}



// calculate the position of the element in relation to the top of the browser window //

function topPosition(target) {

  var top = 0;

  if(target.offsetParent) {

    while(1) {

      top += target.offsetTop;

      if(!target.offsetParent) {

        break;

      }

      target = target.offsetParent;

    }

  } else if(target.y) {

    top += target.y;

  }

  return top;

}



// preload the arrow //

if(document.images) {

	

  arrow = new Image(7,80); 

  arrow.src = "../images/msg_arrow.gif"; 

}

// JavaScript Document