<!--//--><![CDATA[//><!--
// JavaScript Document

function ActivateFlash()
{
   var objects = document.getElementsByTagName("object");
   for (var i = 0; i < objects.length; i++)
   {
      objects[i].outerHTML = objects[i].outerHTML;
   } 
} 





function doSearch(){
	sObj = document.getElementById("SI");
	ax = sObj.defaultValue;
	searchSTR = sObj.value;
	location.href = "http://localhost/Search_Results/?lnkCk=SIMPLE_SEARCH&statID="+statID+"&SI=" + searchSTR;
}

function doSearchA(){
	//sObj = eval("document.form1.SI");
	sObj = document.getElementById("SI2");
	ax = sObj.defaultValue;
	searchSTR = sObj.value;
		dT = document.advanced_s.DOC_TYPE[document.advanced_s.DOC_TYPE.selectedIndex].value;
	location.href = "http://localhost/Search_Results/Advanced_Search/?AS=1&lnkCk=ADVANCED_SEARCH&statID="+statID+"&SI=" + searchSTR + "&DT=" + dT;
}

function whichLink(obj){
	
	//alert(obj.href +  "\n\n" + obj.className);
	
	if(obj.className.match("B_D")){
		window.open(obj.href,"EXT_DOC","");
	return false;
	}
	
	if(obj.className.match("extDoc")){
		window.open(obj.href,"EXT_DOC","");
	return false;
	}
	
	if(obj.className.match("gfTicket")){
	window.open(obj.href,"GF_TICKETS","width=795,height=740,scrollbars=yes,status=yes,resizable=yes");
	return false;
	}
	
	if(obj.className.match("BD_MAP")){
	window.open(obj.href,"BD_MAP","width=500,height=400,scrollbars=n0,status=no,resizable=no");
	return false;
	}
	
	
	theLink = obj.className.split(" ");
	linkClicked = ((obj.search=="")?"\?":"\&") + "lnkCk=";
	linkClicked += theLink[theLink.length-1];
	
	if(obj.className.match("skipNav")){
		if(location.href.indexOf("#ART_CONTENT")>-1){
			location.href = location.href;
		}
		else
		{
			location.href = location.href + "#ART_CONTENT";
		}
	}
	
	else if(obj.className.match("IntLink"))
	{
		intLink = obj.toString();
		intLink = intLink.substr(intLink.indexOf("#"));
		if(location.href.indexOf("#")>-1){
		 	temLoc = location.href.toString();
			temLoc = temLoc.substring(0,location.href.indexOf("#"));
		 	location.href = temLoc +  intLink;
		}
		else
		{
			location.href = location.href.toString() + intLink;
			//alert (location.href.toString() + intLink);
		}
	}
	else
	{
		location.href = obj.href + linkClicked + "&statID="+statID;
	}
	return false;
}


function getChildren(obj)
{
	if(obj.id=="") return;
	if (!document.getElementById(obj.id)) return;
	divTree = document.getElementById(obj.id);
	//if(divTree.hasChildNodes()) alert("You bet ya");
	for(x=0;x<divTree.childNodes.length;x++)
	{
		if(divTree.childNodes[x].children == Object){
			getChildren(divTree.childNodes[x]);
		}
		else
		{
				if(divTree.childNodes[x].id!="" && divTree.childNodes[x].id!="cont"){
				
				//alert (divTree.childNodes[x].parentNode.getElementsByTagName("a").id + " end of tree");
				links = divTree.childNodes[x].parentNode.getElementsByTagName("a");
			
				for(o=0;o<links.length;o++){
					temLinkID = divTree.childNodes[x].id+"_"+(o+1);
					//if(!links[o].className.match("TOGGLE")){
						
						links[o].className = (links[o].className)?links[o].className + " "+temLinkID:temLinkID;
						
						//if(!links[o].href.match("http://www.cla.org.uk"))
						HN = location.hostname;
						if(!links[o].href.match(HN))
							{
								links[o].className = "extDoc " + links[o].className;
							}
						
						links[o].onclick = function(){
						return whichLink(this);}
					//}
				}
			}
		}
	}
}

function killPageLink()
{
	links=	document.getElementsByTagName("a");
	for(i=0;i<links.length;i++)
	{
		temLocation = location.href.replace(/(\?|\&)*lnkCk(.*)*/,"");
		if(links[i]==temLocation){
			links[i].className += " TNLL";
			links[i].parentElement.innerHTML = '<span class="'+links[i].className+'">'+links[i].parentElement.innerText+'</span>';
		}
	}
}





function ini()
{

	//siteSearch = document.getElementById("formS");
	//siteSearch.onsubmit = function(){
		//doSearch();
	//}
	//var divs = document.getElementsByTagName("div");
	//for(y=0;y<divs.length;y++) getChildren(divs[y]);
	//killPageLink();
	setLinks();
	sfHover;
	ActivateFlash();
	/*var divs = document.getElementsByTagName("a");
	//for(y=0;y<divs.length;y++) getParentID(divs[y],divs[y]);
	for(y=0;y<divs.length;y++) {
		if(!divs.href.match("http://www.cla.org.uk")) divs.className = "extDoc " + divs.className;
		divs.onclick = function(){return whichLink(this);}
	}*/
	//getParentID(divs[y],divs[y]);
}

function getParentID(obj,objOrg){
	if((obj.parentNode.id!="")&&(obj.parentNode.id!="goright")&&(obj.parentNode.id!="con2")&&(obj.parentNode.id!="con1")&&(obj.parentNode.id!="")&&(obj.parentNode.id!="con"))
		{
			ttLink = obj.parentNode.getElementsByTagName("a");
			for(i=0;i<ttLink.length;i++)
			{
				if(ttLink[i]==objOrg) {
					temLinkID = obj.parentNode.id + "_" + (i+1);
					objOrg.className = (objOrg.className) ? objOrg.className + " " + temLinkID : temLinkID;
					if(!objOrg.href.match("http://www.cla.org.uk")) objOrg.className = "extDoc " + objOrg.className;
					//if(!objOrg.href.match("http://localhost")) objOrg.className = "extDoc " + objOrg.className;
					objOrg.onclick = function(){return whichLink(this);}
				}
			}
		}
		else
		{
			getParentID(obj.parentNode,objOrg);
		}
}


function valForm() // Validate user form
{
 Err_Msg = "";
 DF = eval('document.form1');
 if(DF.MEMBERSHIP.value==''){alert("Please enter a Membership Type.");DF.MEMBERSHIP.focus()}
 else if(DF.Title.value==''){alert("Please enter your Title.");DF.Title.focus()}
 else if(DF.Forename.value==''){alert("Please enter your Forename.");DF.Forename.focus()}
 else if(DF.Surname.value==''){alert("Please enter your Surname.");DF.Surname.focus()}
 else if(DF.Add1.value==''){alert("Please enter your Address.");DF.Add1.focus()}
 else if(DF.County.value==''){alert("Please enter your County.");DF.County.focus()}
 else if(DF.PostCode.value==''){alert("Please enter your Postcode.");DF.PostCode.focus()}
 else if(DF.Email.value==''){alert("Please enter your email address.");DF.Email.focus()}
 else if((DF.Telephone.value=='') && (DF.Mobile.value=='')){alert("Please enter an additional method of contact.");DF.Telephone.focus()}
 else {DF.submit();}
}

		sfHover = function() {
				var sfEls = document.getElementById("nav").getElementsByTagName("LI");
				for (var i=0; i<sfEls.length; i++) {
						sfEls[i].onmouseover=function() {
								this.className+=" sfhover";
						}
						sfEls[i].onmouseout=function() {
								this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
						}
				}
		}
		
		
		
		
function postRequest(strURL){
var xmlHttp;
if(window.XMLHttpRequest){ // For Mozilla, Safari, ...
var xmlHttp = new XMLHttpRequest();
}
else if(window.ActiveXObject){ // For Internet Explorer
var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlHttp.open('POST', strURL, true);
xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlHttp.onreadystatechange = function(){
	if (xmlHttp.readyState == 4){
		updatepage(xmlHttp.responseText);
	}
}
xmlHttp.send(strURL);
}

function updatepage(str){
	if(str=="true"){
		location.href = location.href;
	}else{
		document.getElementById("wrongDetails").className = "wrongDetails";
	}
}

function call_login(){
	MN = document.getElementById("MN").value;
	PC = document.getElementById("PC").value;
	var url = "ajaxlogin.php?LI=" + MN + "&PW=" +PC ;
	postRequest(url);
	return false;
} 

doSearch = function(){
	//return false;
}

function setLinks(){
	//alert();
	links = document.getElementsByTagName("a");
	//alert();
	HN = location.hostname;
	//alert(links.length);
	for(o=0;o<links.length;o++){
		//alert(links[o].href);
		if(!links[o].href.match(HN))
		{
			links[o].onclick = function(){
			window.open(this.href,"EXT_DOC","");
			return false
			}
		}
		
		if(links[o].className.match("gfTicket"))
		{
			links[o].onclick = function(){
			window.open(this.href,"EXT_DOC","width=780,height=500,scrollbars=yes,resizable=yes");
			return false
			}
		}
		
		
		if(links[o].className.match("B_D") || links[o].className.match("extDoc"))
		{
			links[o].onclick = function(){
			window.open(this.href,"EXT_DOC","width=610,height=430,scrollbars=yes,resizable=yes");
			return false
			}
		}
		
	}
	
}

function setStyle()
{
	if(window.screen.width==800)
		{
			document.write('<link rel="stylesheet" type="text/css" href="nes_site_css_800.css" />');
		}
	else
		{
			document.write('<link rel="stylesheet" type="text/css" href="nes_site_css.css" />')
		}
}


function rarVal(){

	DF = document.RAR;
	
	if(DF.Title.value==""){
		alert("Please enter your title.");
		return false;	
	}
	if(DF.Initial.value==""){
		alert("Please enter your initial.");
		return false;	
	}
	if(DF.Surname.value==""){
		alert("Please enter your surname.");
		return false;	
	}
	if(DF.PostalAddress.value==""){
		alert("Please enter your postal address.");
		return false;	
	}
	
	else if(DF.Email.value==""){
		alert("Please enter your email address.");
		return false;	
	}
	else if(DF.cEmail.value==""){
		alert("Please confirm your email address.");
		return false;	
	}
	
	else if(DF.Email.value!="" && (DF.Email.value == DF.cEmail.value)){
		return true;
	}
	else{
		alert("The Email addresses do not match, please check and try again.");
		return false;
	}

}
//ini = function(){
	//setLinks();
	//sfHover;
//}

//if (window.attachEvent) window.attachEvent("onload", ini);

window.onload = ini;
//--><!]]>
