function quote_init() {
	if (document.getElementById) {
		// this is the way the standards work
		var tFix = document.getElementById("qTitle1").innerHTML = aTitle[0];
		var tFix = document.getElementById("qText1").innerHTML = '&#147;' + aText[0] + '&#148;';
	} else if (document.all) {
		//this is the way  old msie versions work
		var tFix = document.all["qTitle1"].innerHTML = aTitle[0];
		var tFix = document.all["qText1"].innerHTML = '&#147;' + aText[0] + '&#148;';
	} else if (document.layers) {
		//this is the way nn4 woeks
		var tFix = document.layers["qTitle1"].innerHTML = aTitle[0];
		var tFix = document.layers["qText1"].innerHTML = '&#147;' + aText[0] + '&#148;';
	}

	setTimeout("quote_rotate()", qDelay);
}

function quote_rotate() {
	if (startQ > maxQ) startQ = 0;
	if (document.getElementById) {
		// this is the way the standards work
		var tFix = document.getElementById("qTitle1").innerHTML = aTitle[startQ];
		var tFix = document.getElementById("qText1").innerHTML = '&#147;' + aText[startQ] + '&#148;';
	} else if (document.all) {
		//this is the way  old msie versions work
		var tFix = document.all["qTitle1"].innerHTML = aTitle[startQ];
		var tFix = document.all["qText1"].innerHTML = '&#147;' + aText[startQ] + '&#148;';
	} else if (document.layers) {
		//this is the way nn4 woeks
		var tFix = document.layers["qTitle1"].innerHTML = aTitle[startQ];
		var tFix = document.layers["qText1"].innerHTML = '&#147;' + aText[startQ] + '&#148;';
	}

	startQ++;

	setTimeout("quote_rotate()", qDelay);
}

function isValidForm() {
	var form=document.contact;
	var msg="";
	var status=true;	
	if (form.name.value == "") { msg += "\nEmpty Name"; form.name.focus(); status=false; }
	if (form.address.value == "") { msg += "\nNo Address Specified"; form.address.focus(); status=false; }
	if (form.postcode.value == "") { msg += "\nEmpty Post Code"; form.postcode.focus(); status=false; }
	if (form.telephone.value == "") { msg += "\nEmpty Telephone Number"; form.telephone.focus(); status=false; }
	if (form.email.value == "") { msg += "\nEmpty Email Address"; form.email.focus(); status=false; }

	if (status) {
		return true;
	} else {
		if (msg != "") alert ("You need to correct the following before you can proceed:\n" + msg);
		return false;
	}
}

function processForm() {
	var valid = isValidForm();
	if (valid) {
		document.contact.submit();
	}
}

function rand (n) {
  return (Math.floor(Math.random() * n + 1 ));
}

function getKeyPairs(pairList) {
    keypairs = new Object(); 
    numKP = 1; 
    query=pairList;
    while (query.indexOf('&') > -1) { 
     keypairs[numKP] = query.substring(0,query.indexOf('&')); 
     query = query.substring((query.indexOf('&')) + 1); 
     numKP++; 
    } 
    keypairs[numKP] = query; 
}

function extractArray(arrayName) {
	arrayPair = new Object(); 
	numPair = 1; 
	query = arrayName;
	while (query.indexOf('|') > -1) { 
	 arrayPair[numPair] = query.substring(0,query.indexOf('|')); 
	 query = query.substring((query.indexOf('|')) + 1); 
	 numPair++; 
	} 
	arrayPair[numPair] = query; 
}

function makeWindowPhoto(url,width,height) {
	w=window.open(url,'photo','width='+width+',height='+height+',top=0,left=0,resizable=no,status=no,dependant'); 
	if (w.opener == null) w.opener=self;
	w.focus();
}