rgnld=function(o){ //detect region (landing)
	if(o.value!='')document.getElementById('frmregion').submit();
}

frmclr=function(f){
	if(confirm('Are your sure you want to clear the form?'))document.getElementById(f).reset();
}

isemail=function(id){
	var v=document.getElementById(id).value;
	if(v.indexOf('@')==-1||v.indexOf('.')==-1)return false;
	return true;
}

frmmailussbmt=function(){
	var o=document.getElementById('txtname');
	if(o.value==''){
		alert('Please supply your name');
		o.focus();
		return;
	}
	o=document.getElementById('txtsurname');
	if(o.value==''){
		alert('Please supply your surname');
		o.focus();
		return;
	}
	o=document.getElementById('txtcontactnumber');
	if(o.value==''){
		alert('Please supply a contact number');
		o.focus();
		return;
	}
	o=document.getElementById('txtemail');
	if(o.value==''||!isemail('txtemail')){
		alert('Please supply a valid email address');
		o.focus();
		return;
	}
	o=document.getElementById('txtmessage');
	if(o.value==''){
		alert('You haven\'t typed a message');
		o.focus();
		return;
	}
	document.getElementById('frmmailus').submit();
}

var img=new Array('');
imgprld=function(){//image preload
	var prepath='/img/';
	var idx;
	if(document.images){
		for(var i=0;i<arguments.length;i++){
			idx=img.length;
			img[idx]=new Image();
			img[idx].src=prepath+arguments[i];
		}
	}
}

init=function(){
	imgprld('home/hdr.jpg','products/hdr.jpg','articles/hdr.jpg','agents/hdr.jpg','faq/hdr.jpg');
}

if(window.addEventListener){//attach onload standards compliant
	window.addEventListener('load',init,true);
}else{//attach onload IE
	window.attachEvent('onload',init);
}
