function isValidForm() {
	var form=document.contact, msg="", 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 runSlideShow(){
    if (document.all){
     document.images.SlideShow0.style.filter="blendTrans(duration=2)"
     document.images.SlideShow0.style.filter="blendTrans(duration=crossFadeDuration)"
     document.images.SlideShow0.filters.blendTrans.Apply()      

     document.images.SlideShow1.style.filter="blendTrans(duration=2)"
     document.images.SlideShow1.style.filter="blendTrans(duration=crossFadeDuration)"
     document.images.SlideShow1.filters.blendTrans.Apply()      
	}
	
	imageID = tot%2

 	if (imageID == 0) document.images.SlideShow0.src = preLoad[j].src
	if (imageID == 1) document.images.SlideShow1.src = preLoad[j].src

    if (document.all){
     document.images.SlideShow0.filters.blendTrans.Play()
     document.images.SlideShow1.filters.blendTrans.Play()
    }

    j = j + 1
	tot = tot + 1
    if (j > (p-1)) j=0
	
	if (tot <= 2) t = setTimeout('runSlideShow()', 0.1)
	if (tot > 2) t = setTimeout('runSlideShow()', slideShowSpeed)
}

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();
}


