/* Advansys miscellaneous javascript website specific functions */

function EmbedFlash(swf, height, width, loop){
// Main Flash animation - XHTML 1.0 compliant workaround for IE and Firefox (write as javascript rather then embed HTML))
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" id="main01" width="'+width+'" height="'+height+'">');
document.write('<param name="movie" value="'+swf+'"/>');
document.write('<param name="quality" value="high"/>');
document.write('<param name="base" value="/"/>');
document.write('<param name="loop" value="'+loop+'"/>');
document.write('<embed type="application/x-shockwave-flash" src="'+swf+'" width="'+width+'" height="'+height+'"></embed>');
document.write('</object>');	
}
function ShowMap(MapURL,PostCode){
window.open(MapURL+'&pc='+PostCode,'map','width=700, height=500, scrollbars=yes, location=no, status=yes');
}

function CheckEmail(address) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(address)){
	return (true)
	}
	return (false)
}

function ValidateCallback(form){
if (form.name.value=='') {alert('Please fill in your name'); form.name.focus(); return false}
if (form.phone.value=='') {alert('Please fill in your contact telephone number'); form.phone.focus(); return false}
if (form.email.value=='') {alert('Please fill in your email address'); form.email.focus(); return false}
if (!CheckEmail(form.email.value)) {alert('Invalid email address'); form.email.focus(); return false}
if (form.subject.value=='') {alert('Please enter a subject'); form.subject.focus(); return false}
if (form.enquiry.value=='') {alert('Please enter enquiry details'); form.enquiry.focus(); return false}
if (form.captcha.value=='') {alert('Please enter the security code'); form.captcha.focus(); return false}
}
