//	builds the divs which are used for covering other divs
//  in the cms picker.  only works in ie. - so only use it there...
	function doDivs() {
		var count;
		var browserName = navigator.appName;
		if (browserName == "Microsoft Internet Explorer") {
			count = document.all.item("divNum").value;
			//alert(count);
			for (i = 0; i<count; i++) {
				var str = "filterc" + i;
				var str2 = str + "end";
				var str3 = str + "begin";
				//alert(str);
				if (document.getElementById(str)) {
					var y = document.getElementById(str2).offsetTop;
					var z = document.getElementById(str3).offsetTop;	
					//alert (document.all.item(str2).offsetTop);
					//alert (document.all.item(str3).offsetTop);
					//alert( y - (z + 3));
					document.getElementById(str).style.height =  y - (z + 3);
				}
			}	
		}
		else {
			if (document.getElementById("filterc0")) {
					document.getElementById('filterc0').style.width = "20%"
					document.getElementById('filterc0').style.height = document.getElementById('filterc0end').offsetTop + "px";												
			}
			if (document.getElementById("filter100")) {
					document.getElementById('filter100').style.height = document.getElementById('filter100end').offsetTop + "px";												
			}			
		}		
	}	

//	builds the divs which are used for covering other divs
//  in repeater pages.  Different because no 0 for side bar to worry about,
//	and divNum is calculated in stylesheet, so we need to add one to it for this
//  only works in ie. - so only use it there...
	function doRepeaterDivs() {
		var count;
        if (document.getElementById("divNum")) {	
			count = document.getElementById("divNum").value;
			count++;
			for (i = 1; i<count; i++) {
				var str = "filter" + i;
				var str2 = str + "end";
				var str3 = str + "button";
				if (document.getElementById(str)) {
					document.getElementById(str).style.height =  document.getElementById(str2).offsetTop  + "px";
				//    alert(document.getElementById(str).style.height);
				//alert(navigator.appName);
					    document.getElementById(str).style.width = "12%";

				}				
			}					
		}
	}		
		
		
function hider() {
	var browserName = navigator.appName;  
	if (browserName == "Microsoft Internet Explorer") {
		document.all.item("filter").style.top = 0;
		document.all.item("filter").style.height =  document.all.item("filterend").offsetTop;				
	}	
	else {
		if (document.getElementById("filter")) {
				document.getElementById('filter').style.height = document.getElementById('filterend').offsetTop + "px";									
		}
	}
}

// used to cover up the navigation panel		
function filter() {
	var browserName = navigator.appName;  
	if (browserName == "Microsoft Internet Explorer") {
		document.all.item("filter").style.top = 300;
		document.all.item("filter").style.height =  document.all.item("filterend").offsetTop;				
	}	
	else {
		if (document.getElementById("filter")) {
				document.getElementById('filter').style.height = document.getElementById('filterend').offsetTop + "px";									
		}
	}
}


// in case I change this...
	function Publish() 
	{
		if(confirm('Warning:\nClicking on the ok button will publish this page. \n\nClick cancel if you do wish to do so.')) 
		{
			return true;
		}
		else
		{
			alert("Operation Cancelled");
			return false;
		}
	}

// posts forward for the cms
	function postforward() {
		
	}

// standard popup window
function popme(target) {
	window.open(target, '_blank', 'menubar=0,location=0,height=500,resizable=1,scrollbars=1,status=0,toolbar=0,width=700');
}

//	a simple onmouseover function
	function changeColor(elm, strColor) {
		elm.style.color = strColor;
	}

	function TextAreaMaxLength(s, e) {
		var str = s.id + "AllowedLength";
		var i = document.Form1.elements[str].value;
		
		if(e.Value.length <= i) {
			e.IsValid = true;
		}
		else {
			e.IsValid = false;
		}
	}
	
	
	function ybPostBack(eventTarget, eventArgument) {
		var theform = document.Form1;
		theform.__EVENTTARGET.value = eventTarget;
		theform.__EVENTARGUMENT.value = eventArgument;
		theform.pg.value = eventArgument;
		theform.submit();
	}	
	
// THE FUNCTIONS BELOW ARE ALL CUSTOMISATION DEPENDENT 
// THEY NEED TO CHANGE NOT JUST FROM INSTANCE TO INSTANCE, BUT
// WHENEVER THERE IS A DESIGN CHANGE...	
	
	function changeAltSite(elm) {
		elm.style.color = "#ff995B";
	}
	function revertSite(elm) {
		elm.style.color = "#ffffff";
	}	
	
	function changeAltCMS(elm) {
		elm.style.color = "#ff995B";
	}	
		
	function revertCMS(elm) {
		elm.style.color = "#ffffff";
	}

// for t and c template
	function readDownload(myHref) 
	{
		if(confirm('Warning:\nBy clicking the ok button, you are confirming your agreement to the terms and conditions set out on this page. \n\nClick cancel if you do not agree.')) 
		{
			window.open( myHref,"_blank");	
			return true;
		}
		else
		{
			alert("Operation Cancelled");
			return false;
		}
	}