var url="http://"+document.location.host+"/common/boot.php";

    function sc1(id,obj,server) {
    	document.getElementById(id).src = 'http://'+server+'/images/schedule2.jpg';
    	r0(obj);
    }
    function sc2(id,server) {
    	document.getElementById(id).src = 'http://'+server+'/images/schedule1.jpg';
    }

	function op1(target,screen) {
		newwindow=window.open(target,screen );
		newwindow.focus();
		return false;
	}

	function bfs1() {
		var target= '' ;
		window.open(target);
	}

	function s4a(id) {
		if(document.getElementById(id).value=='') {
			document.getElementById(id).value='';
		}				
	}

	function s4b(id) {
		if(getElementById('price').value=='') {getElementById('price').value='';}
		if(document.getElementById(id).value=='') {document.getElementById(id).value='';}
	}
	
	function i3a(obj) { 
		r1(obj,'transparent','black'); 
	}

	function i3b(id1,id2,id3) { 
		i3a(id1) ;
		i3a(id2) ;
		i3a(id3) ;
	}

	function i3c() { 
		i3a('mh0') ;
		i3a('mh2') ;
		i3a('mh4') ;
		i3a('mh6') ;
	}

	function i4a(id1) { 
		document.getElementById(id1).style.display = 'none' ; 
	}

	function i4b() { 
		i4a('eem') ;
		i4a('seo') ;
		i4a('itm') ;
		i4a('boo') ;
		i3c() ;
	 	b2('mh0') ;
	 	b2('mh2') ;
	 	b2('mh4') ;
	 	b2('mh6') ;
		document.getElementById('mh8').style.visibility= 'visible' ;  
		if (document.getElementById('aa1')) {
			document.getElementById('aa1').style.visibility= 'visible' ;
		}
/*		document.getElementById('aa1').style.visibility= 'visible' ;  */
	}

	function b1(id1) {
		mode = 'thin solid black';  
		mode1 = 'thin solid #AA1133';  
		document.getElementById(id1).style.borderLeft = mode ; 
		document.getElementById(id1).style.borderRight = mode ; 
		document.getElementById(id1).style.borderTop = mode ; 
		document.getElementById(id1).style.borderBottom = mode1 ; 
	}

	function b2(id1) {
		document.getElementById(id1).style.border = 'thin solid transparent' ; 
	}
	function b3(obj) {
		r9(obj,'#2EFEF7');	
	}
	function b4(obj) {
		r9(obj,'white');	
	}
	function b5( thisid, id1, id2, id3,id4 ) {
		i4b(); 
		i3b(id2,id1,id3); 
		r1(thisid,'#AA1133','white'); 
		t1(id4); 
		b1(thisid);
		document.getElementById('mh8').style.visibility= 'hidden' ;  
		if (document.getElementById('aa1')) {
			document.getElementById('aa1').style.visibility= 'hidden' ;
		}
/*		document.getElementById('aa1').style.visibility= 'hidden' ;  */
	}
	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="none"
	}
	
	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 = "block";
	}
	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 isCourse(myForm) {
	result = "" ;
	reply = isSpam(myForm) ;						/* spam */
	reply += isName();
	reply += isCompany();
	reply += isAddress();
	reply += isTown();
	reply += isPostcode();
	reply += isTel();
	reply += isEmail();
	reply += isEmailCopy();
	return issuealert(reply)
}

function isSpam(myForm) {
	result = "" ;										
	if (myForm.contact_spam.value == "" ) {		/* validate */
		result = "\n * Enter the validation code"
		return result;
	}
	if (myForm.contact_spam.value != document.getElementById('spamvalue').value ) {		/* validate */
		result = "\n * The validation code entered is incorrect"
		return result;
	}
	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 Telephone number"
	}  
	return result	
}

function isAddress() {
	result = "" ;										
	if (getById('address1') =="" ) {				/* sender area is null */
		result = "\n * Enter your Address"
	}  
	return result
}
function isTown() {
	result = "" ;										
	if (getById('address2') =="" ) {				/* sender area is null */
		result = "\n * Enter your Town / City"
	}  
	return result
}
function isCounty() {
	result = "" ;										
	if (getById('address3') =="" ) {				/* sender area is null */
		result = "\n * Enter your County"
	}  
	return result
}
function isPostcode() {
	result = "" ;										
	if (getById('postcode') =="" ) {				/* sender area is null */
		result = "\n * Enter your Postcode"
	}  
	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(myForm);
	reply += isEmail();
	reply += isEmailCopy();
	result = ""
	return issuealert(reply)
}
/*	------------- end of singleScripts origin  */


function s4s(e,name) {
	var keynum
	var keychar
	if(window.event) {// IE	
		keynum = e.keyCode
	}
	else if(e.which) {// Netscape/Firefox/Opera
		keynum = e.which
	}
	if (keynum == 13) {s4c(name); }	/* enter detected */
	keychar = String.fromCharCode(keynum)
	return ;
}
function r4(t) {
	var sw = 730 ;
	var sh= 500;
	a = screen.width - sw ;
	a = a / 3 ;
	var left= a;
	var top= screen.height*0.25;
	var target=url +"?a=app&b="+t+"&c=sow" ;
	window.open(target,"Statement of Work","height="+sh +",width="+sw +",left="+left+"top="+top+",scrollbars=yes,status=yes,toolbar=yes,menubar=no,location=no");
}

function r5(t) {
	var sw = 730 ;
	var sh= 500;
	a = screen.width - sw ;
	a = a / 3 ;
	var left= a;
	var top= screen.height*0.25;
	var target=url +"?a=largerImage&i="+t ;
	window.open(target,"Image","height="+sh +",width="+sw +",left="+left+"top="+top+",scrollbars=yes,status=yes,toolbar=yes,menubar=no,location=no");
}

function r6(t) {
	a = t.className ;
	if (t.className.indexOf(' hand') > -1) {
		t.className.replace(' hand','') 
	} else {
		t.className += ' hand';
	}
}
function r7(target) {window.open(target,"_blank") ;}
function r8(t,type) {
	document.getElementById(t.id).src = "http://"+location.host+"/images/"+type+".gif";
	r6(t);
}
function r9(t,colour) {
	document.getElementById(t.id).style.color = colour;
	r6(t);
}
