function popup(path,width,height,target) {
    if (target=="") target="_blank";
    features = "width=" + width + ", height=" + height + ", scrollbars=1 status=yes resizable=yes";
    window_handle = window.open(path,target,features);
    window_handle.focus();  
};


function isemail(myemail)   {
   Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
   if (Filtro.test(myemail)) return true;
   else return false;
}

function showImg(img,imgWidth,imgHeight,target) {
    if (String(target)=="undefined") target="_blank";
    if (String(imgWidth)=="undefined") imgWidth=640;
    if (String(imgHeight)=="undefined") imgHeight=480;
    path = "showImg.asp?img="+img;
    features = "width=" + imgWidth + ", height=" + imgHeight + ", scrollbars=no status=no resizable=no";
    window_handle = window.open(path,target,features);
    window_handle.focus();    
};


function checkRegistrationForm(){
 	document.formPage.fName.style.backgroundColor="#FFFFFF";
	document.formPage.fSurname.style.backgroundColor="#FFFFFF";
	document.formPage.fEmail.style.backgroundColor="#FFFFFF";
	document.formPage.fUid.style.backgroundColor="#FFFFFF";
	document.formPage.fPwd1.style.backgroundColor="#FFFFFF";
	
	var error = "";

	if(document.formPage.fUid.value == "") { 
		error += "\n- Specify your Username";
		document.formPage.fUid.style.backgroundColor="#FFCC00"; document.formPage.fUid.focus();
	}
	else if(document.formPage.fUid.value.length < 8) { 
		error += "\n- Username must be 8 characters or more";
		document.formPage.fUid.style.backgroundColor="#FFCC00"; document.formPage.fUid.focus();
	}

	if(document.formPage.fPwd1.value == "") { 
		error += "\n- Specify your Password";
		document.formPage.fPwd1.style.backgroundColor="#FFCC00"; document.formPage.fPwd1.focus();
	}
	else if(document.formPage.fPwd1.value.length < 8) { 
		error += "\n- Password must be 8 characters or more";
		document.formPage.fPwd1.style.backgroundColor="#FFCC00"; document.formPage.fPwd1.focus();
	}

	if(document.formPage.fPwd1.value != document.formPage.fPwd2.value ) { 
		error += "\n- Passwords doesn't match";
		document.formPage.fPwd1.style.backgroundColor="#FFCC00"; document.formPage.fPwd1.focus();
		document.formPage.fPwd2.style.backgroundColor="#FFCC00"; 
	}

	if(document.formPage.fEmail.value == "") { 
		error += "\n- Specify your email address";
		document.formPage.fEmail.style.backgroundColor="#FFCC00"; document.formPage.fEmail.focus();
	}
	else if (!isemail(document.formPage.fEmail.value)){
		error += "\n- Email is incorrect"
		document.formPage.fEmail.style.backgroundColor="#FFCC00"; 
		document.formPage.fEmail.focus();
	}

	if(document.formPage.fSurname.value == "") { 
		error += "\n- Specify your surname";
		document.formPage.fSurname.style.backgroundColor="#FFCC00"; document.formPage.fSurname.focus();
	}

	if(document.formPage.fName.value == "") { 
		error += "\n- Specify your Name";
		document.formPage.fName.style.backgroundColor="#FFCC00"; document.formPage.fName.focus();
	}
 
	if (error != "") {
		alert(error);
		return;
	}
		
	document.formPage.submit();
}


function checkChangePassword(){
 	document.formPage.oldPassword.style.backgroundColor="#FFFFFF";
	document.formPage.newPassword1.style.backgroundColor="#FFFFFF";
	document.formPage.newPassword2.style.backgroundColor="#FFFFFF";
	
	var error = "";

	if(document.formPage.newPassword1.value == "") { 
		error += "\n- Specify your new password";
		document.formPage.newPassword1.style.backgroundColor="#FFCC00"; document.formPage.newPassword1.focus();
	}
	else if(document.formPage.newPassword1.value.length < 8) { 
		error += "\n- Password must be 8 characters or more";
		document.formPage.newPassword1.style.backgroundColor="#FFCC00"; document.formPage.newPassword1.focus();
	}

	if(document.formPage.newPassword1.value != document.formPage.newPassword2.value ) { 
		error += "\n- Passwords doesn't match";
		document.formPage.newPassword1.style.backgroundColor="#FFCC00"; document.formPage.newPassword1.focus();
		document.formPage.newPassword2.style.backgroundColor="#FFCC00"; 
	}

	if(document.formPage.oldPassword.value == "") { 
		error += "\n- Specify your old Password";
		document.formPage.oldPassword.style.backgroundColor="#FFCC00"; document.formPage.oldPassword.focus();
	}
	if (error != "") {
		alert(error);
		return;
	}
		
	document.formPage.submit();
}


function submitAbstract(){
 	document.formPage.title.style.backgroundColor="#FFFFFF";
	document.formPage.content.style.backgroundColor="#FFFFFF";
	document.formPage.keywords.style.backgroundColor="#FFFFFF";
	
	var error = "";

	if(document.formPage.keywords.value == "") { 
		error = "All fields are required";
		document.formPage.keywords.style.backgroundColor="#FFCC00"; document.formPage.keywords.focus();
	}
	if(document.formPage.content.value == "") { 
		error = "All fields are required";
		document.formPage.content.style.backgroundColor="#FFCC00"; document.formPage.content.focus();
	}
	if(document.formPage.title.value == "") { 
		error = "All fields are required";
		document.formPage.title.style.backgroundColor="#FFCC00"; document.formPage.title.focus();
	}
	
	if (error != "") {
		alert(error);
		return;
	}
		
	document.formPage.submit();
}


function submitAbstractAuthor(){
 	document.formPage.name.style.backgroundColor="#FFFFFF";
	document.formPage.surname.style.backgroundColor="#FFFFFF";
	document.formPage.affiliation.style.backgroundColor="#FFFFFF";
 	document.formPage.address.style.backgroundColor="#FFFFFF";
 	document.formPage.email.style.backgroundColor="#FFFFFF";
 	document.formPage.tel.style.backgroundColor="#FFFFFF";
	document.formPage.fax.style.backgroundColor="#FFFFFF";	
	
	var error = "";

	if(document.formPage.fax.value == "") { 
		error = "All fields are required";
		document.formPage.fax.style.backgroundColor="#FFCC00"; document.formPage.fax.focus();
	}
	if(document.formPage.tel.value == "") { 
		error = "All fields are required";
		document.formPage.tel.style.backgroundColor="#FFCC00"; document.formPage.tel.focus();
	}
		if(document.formPage.email.value == "") { 
		error = "All fields are required";
		document.formPage.email.style.backgroundColor="#FFCC00"; document.formPage.email.focus();
	}
	if(document.formPage.address.value == "") { 
		error = "All fields are required";
		document.formPage.address.style.backgroundColor="#FFCC00"; document.formPage.address.focus();
	}
	if(document.formPage.affiliation.value == "") { 
		error = "All fields are required";
		document.formPage.affiliation.style.backgroundColor="#FFCC00"; document.formPage.affiliation.focus();
	}
	if(document.formPage.surname.value == "") { 
		error = "All fields are required";
		document.formPage.surname.style.backgroundColor="#FFCC00"; document.formPage.surname.focus();
	}
	if(document.formPage.name.value == "") { 
		error = "All fields are required";
		document.formPage.name.style.backgroundColor="#FFCC00"; document.formPage.name.focus();
	}
	
	if (error != "") {
		alert(error);
		return;
	}
		
	document.formPage.submit();
}


function submitAbstractAddAuthor(flag){
	if (flag == 0) document.formPage.step.value = 4;
	if (flag == 1) document.formPage.step.value = 2;
		
	document.formPage.submit();
}