<?php
header("Expires: Thu, 31 Dec 2020 20:00:00 GMT");
header('Content-type: text/javascript');
?>
	function addbookmark(a) 	{	
		/*	add a bookmark	*/
		if (document.all) {
	   	   window.external.AddFavorite(window.location.href,a);	
	   	   alert(a +"  added to Favorites") ;
		}
    }   
  		
	function clickp(path, obj) {
		/*	direct to next location	*/
		var sw=",width=" +screen.width*0.65;
		var sh=",height=" +screen.height*0.65;
		var left=",left=" +screen.width*0.02;
		var top=",top=" +screen.height*0.10;
		var params='"';
		var target = window.location.host +"/" ; 
		newWindow=window.open(path +obj +".jpg","Pictures","toolbar=no,location=no, scrollbars=yes, resizable=no, directories=no, menubar=yes, copyhistory=no, status=no" +sw +sh +left +top +params) ;
	}

    function countchars(maximum,ID) {
	 	var max = maximum
	  	var myvalue = document.getElementById(ID).value ;
	  	var mylength = myvalue.length +1;
	  	if (mylength > max) {
	  	     myvalue = myvalue.substring(0,max) ;
			 document.getElementById(ID).value = myvalue;
  		  	 return "\n You have reached the maximum character limit of " +max ;
	 	 }
		return mylength; 
	}
	   
	function getById(value) { 
		var a=document.getElementById(value)
		if( a != "" && a != null) {
			e = document.getElementById(value)			/* input required value */
			return e.value
		} else {
			return ""
		}
	}
	 
	function getcookie(dough) {
		var a = null
		var c_start=document.cookie.indexOf(dough+"=");
		if (c_start != -1) {
			c_start=c_start + dough.length +1; 
    		c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
  			a =  unescape(document.cookie.substring(c_start,c_end))
		}	
		return a
	}
 
    function GetXmlHttpObject() {
		var xmlHttp=null;
		try {  
  			xmlHttp=new XMLHttpRequest();	// Firefox, Opera 8.0+, Safari
  		}
		catch (e) {
  			try {							// Internet Explorer
    			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    		}
  			catch (e) {
 				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    		}
  		}
		return xmlHttp;
	}

	
	function issuealert(reply) { 
		if ( reply != "" ) {
			reply1 = "\nPlease correct the following errors found on the form.\n" + reply
			alert (reply1)
			return false
	}
	return true	
	}

	function issueconfirm(question) { 
		if (confirm(question+"\n")) { 
			return true 						
		} else {
			return false 						/* not today */
		}
	}
	
	function loadWindow(target){
		var sw=",width=460";
		var sh=",height=650";
		var left=",left=" +screen.width*0.02;
		var top=",top=" +screen.height*0.25;
		var params='"';
		newWindow=window.open(target +"","HelpWindow","toolbar=no,location=no, scrollbars=yes, resizable=no, directories=no, menubar=yes, copyhistory=no, status=no" +sw +sh +left +top +params) ;
	}
	
	function m1(max,ID,XID) {
		result = countchars(max,ID) 
		if (result.len > 1) {
			if (result.substr(0,2) == "\n") { 
				result = max ;
 				issuealert(result);
			}
		}
		document.getElementById(XID).value = max - result;
		result = ""
	}

	function mouseover(me,all){
		document.getElementById(me).style.color='black';
		document.getElementById(me).style.textDecoration="underline"
		r0(all);
	}

	function mouseout(me){
		document.getElementById(me).style.color='blue';
		document.getElementById(me).style.textDecoration="underline"
	}
	
	function clickn(obj) {
		/*	direct to next location	*/
		window.location = obj  ;
	}

	function r0(object1){ 				/*	cursor change */
		object1.className='hand';
	}

	function r1(object1,bc,fc){ 		/*	rollover and rollout	*/
		document.getElementById(object1).style.background = bc;
		document.getElementById(object1).style.color = fc;
	}

	function r2(object){ 
		/*	rollover and rollout	*/
		document.getElementById(object).style.border="thin solid #0000FF";
	}
	function r3(object){ 
		/*	rollover and rollout	*/
		document.getElementById(object).style.border="thin solid #FFFFFF";
	}

	function setCookie(c_name,invalue,expiredays) {
		if (invalue.substr(0,1) == "|") {
			value = invalue.substr(1)
		} else {
			value = getById(invalue)					/* input value */
		}
		var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);
		document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
	}

    imagecount=0									/* preset counter for images */
	function  rotate(target) {
		/*	rotate pictures in frame	*/
		  if (colcount != 0) {
			  colcount++;  
			  if (colcount > 4) {colcount = 1} 
		  }  

		  if (document.images) {
		  	 imagecount++;
			 if (imagecount > imageno) {imagecount = 1}
			 var q =target +  imagename1 +imagecount +".jpg"; 
			 var r =target +  imagename2 +imagecount +".gif"; 
		     if (colcount == 0) {
		     	document.pictures.src =target +  imagename1 +imagecount +".jpg";
			 } else {
		     	if (colcount == 1) {document.pictures1.src =target +  imagename1 +imagecount +".jpg";} 
		     	if (colcount == 2) {document.pictures2.src =target +  imagename2 +imagecount +".gif";} 
		     	if (colcount == 3) {document.pictures3.src =target +  imagename1 +imagecount +".jpg";} 
		     	if (colcount == 4) {document.pictures4.src =target +  imagename2 +imagecount +".gif";} 
		  	 }
		  }
		  setTimeout("rotate('"+target +"')",5000)
    }

	function t1(elem) {
		var k = document.getElementById(elem).style;
		k.display = "inline";
	}
	function t2(elem) {
		var k = document.getElementById(elem).style;
		k.display = "none";
	}

	function validemail(email) { 
		message = ""						/* message buffer */
		t1 = 0								/* error found */

		if (email =="" ) {					/* IS mail null */
			message += ( "\n * Enter a valid email address")
			t1 = 1 
		}

    	if ( t1 == 0 ) {					/* bypass if no email */
	  		invalidchars = "/:,;"				/* invalid char in email check */
	  		for ( i=0; i<invalidchars.length; i++ ) {
				notval = invalidchars.charAt(i)
				if (email.indexOf(notval,0) > -1 ) {
					message += ( "\n * " + notval + " is not a valid character in an email address \n")
				}
	  		}
							/* @ found flag */
	  		symbolcheck1 = "@"				/* check that one @ exists */
	  		atposition1 = email.indexOf(symbolcheck1,1)
	  		if ( atposition1 == -1 ) {
				message +=  (  "\n * " + email + " is not valid as it does not have a '@' symbol ")
				t1 = 1
	  		}
	  		if (email.indexOf(symbolcheck1, atposition1+1) > -1 ) {
				message +=  ( "\n * " + email + " is not valid as it has two '@' symbols in it ")
	  		}

	  		if ( t1 == 0 ) {		/* only do if @ has been found */
	    		symbolcheck2 = "."		/* check that one . exists  after @ */
				atposition2 = email.indexOf(symbolcheck2,1)
				if ( atposition2 == -1 ) {
		   			message += ( "\n * " + email + " is not valid as it does not have a '.' ")
				} else {
					x = email.length -1 ;
					if ( atposition2 == x ) {
			   			message += ("\n * " + email + " must have suffix after '.' ")
					}
				}
	  		} 
    	}						/* end of no mail bypass */
		return message	
	}
	
/*	---------------
	The following are singleScripts origin
*/	
	function checkemail() {
	message = ""						/* message buffer */
	reply = isEmail();
	$status = issuealert(reply)
	return $status
}

function ck1(oldvalue,newvalue,ref,a1) {
	if ( oldvalue != newvalue) {
		document.getElementById(ref).disabled = false
		document.getElementById(a1).style.fontWeight = 'bold'
	} else {
		document.getElementById(ref).disabled = true
		document.getElementById(a1).style.fontWeight = 'normal'
	}
}

function isTerms() {
	result = "" ;
	if (document.getElementById('terms').checked) {
	} else {
		result = "\n* Please confirm your acceptance of the terms and conditions.\n"
	} 
	return result
}

function refresh(oldvalue,newvalue) {
	if (oldvalue != document.getElementById(newvalue).value) {
		alert("Please use 'Refresh' option when changing the Email address.")  ;
		return false
	}
	return true
}

function isSpam(myForm) {
	result = "" ;										
	if (myForm.contact_spam.value != transpam ) {		/* validate */
		result = "\n * Enter the validation code"
	}
	return result	
}
function isEmail() {
	result = "" ;										
	email = getById('email')					/* input email value */
	result = validemail(email)					/* check email address */
	return result	
}
function isEmailCopy() {
	result = "" ;										
	email = getById('email')					/* input email value */
	copyemail = getById('copyemail') ;
	if ( copyemail != email ) {					/* copy the same? */
		result = "\n * Your confirmed email address is not correct "
	}  
	return result	
}
function isComments() {
	result = "" ;										
	if (getById('comments')=="" ) {				/* message area is null */
		result = "\n * Enter your request in the message area "
	} 
	return result	
}
function isName() {
	result = "" ;										
	if (getById('from') =="" ) {				/* sender area is null */
		result = "\n * Enter your name"
	}  
	return result	
}
function isCompany() {
	result = "" ;										
	if (getById('company') =="" ) {				/* sender area is null */
		result = "\n * Enter your Company name"
	}  
	return result	
}
function isTel() {
	result = "" ;										
	if (getById('telephone') =="" ) {				/* sender area is null */
		result = "\n * Enter your Landline Telephone number"
	}  
	return result	
}
function isData(id) {
	result = "" ;										
	if (getById(id)=="" ) {				/* area is null */
		result = "\n * Complete the "+id+" field on the form ";
	} 
	return result	
}
function validinput(myForm) { 
	reply = isSpam(myForm) ;						/* spam */
	reply += isEmail();
	reply += isComments();
	reply += isName();
	return issuealert(reply)
}

function validnewsletter(myForm) { 
	reply = ""									/* message buffer */
	reply += isSpam();
	reply += isEmail();
	reply += isEmailCopy();
	result = ""
	return issuealert(reply)
}
/*	------------- end of singleScripts origin  */