/***********************************************
* 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 URL Script
***********************************************/


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


/***********************************************
* ShowandHide Script
***********************************************/

//<!--
function viewinfo(id) {
	box = document.getElementById(id);
	box.className = "visible";

	//Now hide all other divs that are visible
	var oDivs = document.getElementsByTagName("div")

	for (var i=0; i<oDivs.length; i++)
		if (oDivs[i].className=="visible" && oDivs[i].id != id)
			oDivs[i].className = "hidden";
}
//-->


/***********************************************
* Image Preloader
***********************************************/

//<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

MM_preloadImages('images/core/bg.jpg','images/core/bg-container.jpg','images/core/logo.jpg','images/core/bg-footer.jpg','images/core/bg-gallery.jpg')

//-->


