function popup(url,width,height,name){
		if (width == null) width = 400;
		if (height == null) height = 425;
		if (name == null) name = "details";
		var props = "toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes,titlebar=no,menubar=no,width="+width+",height="+height;
		w = window.open(url, name, props);
		if (w) {
		w.focus();
		}
}

var state = 'none';

function showhide(layer_ref) {

if (state == 'block') {
state = 'none';
}
else {
state = 'block';
}
if (document.all) { //IS IE 4 or 5 (or 6 beta)
eval( "document.all." + layer_ref + ".style.display = state");
}
if (document.layers) { //IS NETSCAPE 4 or below
document.layers[layer_ref].display = state;
}
if (document.getElementById &&!document.all) {
hza = document.getElementById(layer_ref);
hza.style.display = state;
}
}


function validate(obj){
	if(obj.username.value == ""){
		alert("please specify your firstname");
		obj.username.focus();
		return false;
	}
	if(obj.password.value == ""){
		alert("please specify your password");
		obj.password.focus();
		return false;
	}
	if(obj.password2.value == ""){
		alert("please specify your password2");
		obj.password2.focus();
		return false;
	}
	if(obj.id_card.value == ""){
		alert("please specify your id card");
		obj.id_card.focus();
		return false;
	}
	if(obj.title.value == ""){
		alert("please specify your title");
		obj.title.focus();
		return false;
	}
	if(obj.fname.value == ""){
		alert("please specify your first name");
		obj.fname.focus();
		return false;
	}
	if(obj.lname.value == ""){
		alert("please specify your last name");
		obj.lname.focus();
		return false;
	}
	if(obj.birthDay.value == "" || obj.birthMonth.value == ""  || obj.birthYear.value == "" ){
		alert("please specify your birthday");
		obj.birthDay.focus();
		return false;
	}
	if(obj.address.value == ""){
		alert("please specify your address");
		obj.address.focus();
		return false;
	}
	if(obj.province.value == ""){
		alert("please specify your province");
		obj.province.focus();
		return false;
	}
	if(obj.post_code.value == ""){
		alert("please specify your post_code");
		obj.post_code.focus();
		return false;
	}
	if(obj.mobilephone.value == ""){
		alert("please specify your mobilephone");
		obj.mobilephone.focus();
		return false;
	}
	var chks = document.getElementsByName('favorite_car[]');
	var hasChecked = false;
	for (var i = 0; i < chks.length; i++)
	{
	if (chks[i].checked)
	{
	hasChecked = true;
	break;
	}
	}
	if (!hasChecked)
	{
	alert("Please select at least one.");
	chks[0].focus();
	return false;
	}

	return true;
}

function validateContactus(obj){
	if(obj.title.value == ""){
		alert("please specify your Topic");
		obj.title.focus();
		return false;
	}
	if(obj.content.value == ""){
		alert("please specify your Message");
		obj.content.focus();
		return false;
	}
	if(obj.branchid.value == ""){
		alert("please specify your branch");
		obj.branchid.focus();
		return false;
	}
	if(obj.contactor_name.value == ""){
		alert("please specify your name");
		obj.contactor_name.focus();
		return false;
	}
	if(obj.email.value == ""){
		alert("please specify your email");
		obj.email.focus();
		return false;
	}
	if(obj.email.value.indexOf("@") == -1 || obj.email.value.indexOf(".") == -1){
		alert("please specify your email in the right format");
		obj.email.focus();
		return false;
	}	
	return true;
}

function validateResume(obj){
	if(obj.name.value == ""){
		alert("please specify your name");
		obj.name.focus();
		return false;
	}
	if(obj.sex.value == ""){
		alert("please specify your sex");
		obj.sex.focus();
		return false;
	}
	if(obj.age.value == ""){
		alert("please specify your age");
		obj.age.focus();
		return false;
	}
	if(obj.address.value == ""){
		alert("please specify your address");
		obj.address.focus();
		return false;
	}
	if(obj.telephone.value == ""){
		alert("please specify your telephone");
		obj.telephone.focus();
		return false;
	}
	if(obj.email.value == ""){
		alert("please specify your email");
		obj.email.focus();
		return false;
	}
	if(!IsEmail(obj.email.value)){
		alert("please specify your email in the right format");
		obj.email.focus();
		return false;
	}
	if(obj.email.value.indexOf("@") == -1 || obj.email.value.indexOf(".") == -1){
		alert("please specify your email in the right format");
		obj.email.focus();
		return false;
	}	
	if(obj.experience.value == ""){
		alert("please specify your experience");
		obj.experience.focus();
		return false;
	}
	if(obj.education.value == ""){
		alert("please specify your education");
		obj.education.focus();
		return false;
	}
	if(obj.institue.value == ""){
		alert("please specify your institue");
		obj.institue.focus();
		return false;
	}
	if(obj.major.value == ""){
		alert("please specify your major");
		obj.major.focus();
		return false;
	}
	if(obj.gpa.value == ""){
		alert("please specify your gpa");
		obj.gpa.focus();
		return false;
	}
	return true;
}

function validateEletter(obj){
	if(obj.email.value == ""){
		alert("please specify your email");
		obj.email.focus();
		return false;
	}
	if(obj.email.value.indexOf("@") == -1 || obj.email.value.indexOf(".") == -1){
		alert("please specify your email in the right format");
		obj.email.focus();
		return false;
	}	
	return true;
}
