// JScript source code
<!-- // hide from old browsers


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// used  mainly for testing javascript functions are working
function fnAlert(strAlertText)
{
	alert(strAlertText);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// validate add user form
function validate(strFormName) {

	var isErrors;
	var strMessage;
	var strFormName;
	
	isErrors = "false";
	strMessage = "Please complete the following mandatory fields            ";
	strMessage = strMessage + "\n--------------------------------------------------------"

// -----------------------------------------------------
// ////// HTML Email FORM
// -----------------------------------------------------
if (strFormName == "frmEnquiryForm")
{
	// From Name
	if (document.getElementById('frmFromName').value == "") {	
		strMessage = strMessage + "\n - Your Name";		
		isErrors = "true";	
	}
	
	// from email
	if (document.getElementById('frmFromEmail').value == "") {	
		strMessage = strMessage + "\n - Your Email";		
		isErrors = "true";	
	}
	
	// check email address if entered
	// validate email address
	if (document.getElementById('frmFromEmail').value != "") {			
	
		var emailFilter=/^.+@.+\..{2,3}$/;
		var strEmail = document.getElementById('frmFromEmail').value
		
   		if (!(emailFilter.test(strEmail))) {
		
			//strMessage = strMessage + "\n\n--------------------------------------------------------"
        	strMessage = strMessage + "\n - From email address is not valid";
			
			isErrors = "true";
   		}
		// check email for invalid chars
   		var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
   		if (strEmail.match(illegalChars)) {
      	
			strMessage = strMessage + "\n - From email address contains illegal characters";
			
			isErrors = "true";
   		
		}	
		
	}
	
	// enquiry
	if (document.getElementById('frmEnquiry').value == "") {	
		strMessage = strMessage + "\n - Enquiry";		
		isErrors = "true";	
	}
	
} // end if
	
	strMessage = strMessage + "\n--------------------------------------------------------";	
	if (isErrors == "true") {	
		alert(strMessage);
		return false;	
	} 

} // end function

function checkEmail(strng) {
   var error = ""
   var emailFilter=/^.+@.+\..{2,3}$/;
   if (!(emailFilter.test(strng))) { 
               error = "Please enter a valid email address.\n";
   }

   var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
   if (strng.match(illegalChars)) {
      error = "The email address contains illegal characters.\n";
   }
   return error;
} 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function jumpTo(newLoc) {
	newPage = newLoc.options[newLoc.selectedIndex].value
	
	if (newPage != "") {
		window.location.href = newPage
	}
}



////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
var message="Right-click function has been disabled!";
function clickIE4(){
	if (event.button==2){
		alert(message);
		return false;
	}
}

function clickNS4(e){
	if (document.layers||document.getElementById&&!document.all){
		if (e.which==2||e.which==3){
			alert(message);
			return false;
		}
	}
}

	if (document.layers){
		document.captureEvents(Event.MOUSEDOWN);
		document.onmousedown=clickNS4;
	}
	else if (document.all&&!document.getElementById){
		document.onmousedown=clickIE4;
	}

	document.oncontextmenu=new Function("alert(message);return false")

*/




///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////




// -- OPEN WINDOW
function fnOpenWindow(strUrl,intWidth,intHeight) {
	strNewWin = window.open(strUrl, 'pop_window', 'width='+intWidth+',height='+intHeight+',status=1,scrollbars=1,resizable=1');
	strNewWin.focus();
}


// CreateControl
function fnCreateControl(DivID, CLSID, ObjectID,WIDTH, HEIGHT, URL, AUTOSTART)
{
  var d = document.getElementById(DivID);
  d.innerHTML = 
    '<object classid=' + CLSID + ' id=' + ObjectID + 
    ' width=' + WIDTH + ' height=' + HEIGHT +'>
    <param name="URL" value=' + URL + '>
    <param name="autoStart" value=' + AUTOSTART + '/>';
}

// --> 
