/***********************************************
* 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;


/***********************************************
* Random Images Script
***********************************************/

<!-- Begin
// Set up the image files to be used.
var theImages = new Array() // do not change this
// To add more image files, continue with the
// pattern below, adding to the array.

theImages[0] = 'images/core/inner-pic1.jpg'
theImages[1] = 'images/core/inner-pic2.jpg'
theImages[2] = 'images/core/inner-pic3.jpg'
theImages[3] = 'images/core/inner-pic4.jpg'

// do not edit anything below this line

var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
document.write('<img src="'+theImages[whichImage]+'">');
}

//  End -->


/***********************************************
* 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] + ""); 
 }
} 


/***********************************************
* Popup URL Script
***********************************************/


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

<!--a href="default.asp" onclick="MM_openBrWindow(this.href,'','width=800,height=800,menubar=yes,scrollbars=yes,location=0,statusbar=0,toolbar=1,resizable=0'); return false;"-->


/***********************************************
* ShowandHide Script
***********************************************/

//<!--
function viewinfo(id) {
	box = document.getElementById(id);
	if(box.className == "visible") {
		box.className = "hidden";
	} else {
		box.className = "visible";
	}
}
//-->

/***********************************************
* Cycle
***********************************************/

$(document).ready(function() {

	$('#large-banner-image').cycle({
		fx: 'fade',
		delay:  5000
	});
	
	$('#small-banner-image').cycle({
		fx: 'fade',
		delay:  -1000
	});
});

