﻿function address() {
	document.write("<div id='address'>"+
	"<address>Copyright © 2005 Kardashian Printing Services</address>"+
	"<address>Yerevanian Street - Industrial city - Bouchrieh - Lebanon</address>"+
	"<address>Tel/Fax: 961-1-484970</address>"+
	"</div>");
}

function checkForm(form) {
	for (var i = 0; i < form.elements.length; i++) {
		if (form.elements[i].value == "") {
			alert("Fill out ALL fields.");
			return false;
		}
	}
	return true;
}

function clearFields(form) {
	form.name.value = "";
	form.email.value = "";
	form.company.value = "";
	return false;
}

function echeck(str) {
	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length;
	var ldot=str.indexOf(dot);
	if (str.indexOf(at)==-1){
	   alert("Invalid E-mail. Please enter a valid email");
	   return false;
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   alert("Invalid E-mail. Please enter a valid email");
	   return false;
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		alert("Invalid E-mail. Please enter a valid email");
		return false;
	}
	if (str.indexOf(at,(lat+1))!=-1){
		alert("Invalid E-mail. Please enter a valid email");
		return false;
	}
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		alert("Invalid E-mail. Please enter a valid email");
		return false;
	}
	if (str.indexOf(dot,(lat+2))==-1){
		alert("Invalid E-mail. Please enter a valid email");
		return false;
	}
	if (str.indexOf(" ")!=-1){
		alert("Invalid E-mail. Please enter a valid email");
		return false;
	}
	 return true;
}

function ValidateForm(form){
	if ((form.email.value==null)||(form.email.value=="")||(form.name.value==null)||(form.name.value=="")||(form.company.value==null)||(form.company.value=="")){
		alert("Please Fill All Fields");
		return false;
	}
	if (echeck(form.email.value)==false){
		form.email.value="";
		form.email.focus();
		return false;
	}
	return true;
}

function pwCheck(form) {
	if (!checkForm(form)) {
		return false;
	}
	if (form.Newpw.value == form.Confpw.value){
		return true;
	}
	else {
		alert("The new password does not match the confirmed password.");
		return false;
	}
}
