/***********************************************
* Form fields Validation Script
***********************************************/

function ValidateForm(f){

      with(f){
         if (isEmpty(_1_Name.value)) {
            alert("Please enter your Name");
            _1_Name.focus();
            return false;
         }

         if (isEmpty(_2_Email_From.value)) {
            alert("Please enter your Email Address");
            _2_Email_From.focus();
            return false;
         }

         if ( !isEmail(_2_Email_From.value) ) {
            alert("Please enter a valid Email Address.");
            _2_Email_From.focus();
            return false;
         }

         if (!isEmpty(_3_Phone.value)) {
	         if (!IsNumber(_3_Phone.value, true)) {
            	alert("Please enter only numbers for your Phone");
            	_3_Phone.focus();
            	return false;
         	}
         }
         if (!isEmpty(_4_Fax.value)) {
         if (!IsNumber(_4_Fax.value, true)) {
            	alert("Please enter only numbers for your Fax");
            	_4_Fax.focus();
            	return false;
         	}
         }
         if (isEmpty(_5_Enquiries.value)) {
            alert("Please enter your Enquiry");
            _5_Enquiries.focus();
            return false;
         }
   	}
   return true;
 }


/***********************************************
* Calling external link instead of target="_blank"
***********************************************/


function externalLinks() { 

if (!document.getElementsByTagName) return; 

var anchors = document.getElementsByTagName("a"); 
for (var i=0; i<anchors.length; i++) { 
var anchor = anchors[i]; 
var relvalue = anchor.getAttribute("rel");

if (anchor.getAttribute("href")) {
var external = /external/;
var relvalue = anchor.getAttribute("rel");
if (external.test(relvalue)) { anchor.target = "_blank"; }
} 
}
} 
window.onload = externalLinks;


/***********************************************
* Popup Pic Script
***********************************************/

function PopupPic() {
 if (arguments[1] == null || arguments[1].length == 0 || arguments[2] == null || arguments[2].length == 0) {
  window.open( "popup.asp?" + arguments[0], "", "resizable=1,HEIGHT=200,WIDTH=200"); 
 }
 else {
  window.open( "popup.asp?" + arguments[0], "", "resizable=1,HEIGHT=" + arguments[2] + ",WIDTH=" + arguments[1] + ""); 
 }
} 
