// JavaScript Document

<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function test() { 

  switch(document.getElementById('whois').options[document.getElementById('whois').selectedIndex].value) {
	  	
		
	  
		//individual
		case 'individual':
	  	$('#formContact').hide();
	  	$('#formPosition').hide();
		break;
		//under18s
		case 'under18s':
	  	$('#formContact').hide();
	  	$('#formPosition').hide();
		break;
		//business
		case 'business':
	  	$('#formContact').show();
		$("label > span").html("Business name"); 
	  	$('#formPosition').show();
		break;
		//organisation
		case 'organisation':
	  	$('#formContact').show();
		$("label > span").html("Organisation name");
	  	$('#formPosition').show();
		break;
		//Community
		case 'community':
	  	$('#formContact').show();
		$("label > span").html("Group name"); 
	  	$('#formPosition').show();
		break;
		//Community
		case 'school':
	  	$('#formContact').show();
		$("label > span").html("School/College/University"); 
	  	$('#formPosition').show();
		break;
		//healthcare
		case 'health':
	  	$('#formContact').show();
		$("label > span").html("Organisation"); 
	  	$('#formPosition').show();
		break;
		//local
		case 'local':
	  	$('#formContact').show();
		$("label > span").html("Public Sector"); 
	  	$('#formPosition').show();
		break;
		//councillor
		case 'councillor':
	  	$('#formContact').show();
		$("label > span").html("Local Authority/Council"); 
	  	$('#formPosition').show();
		break;
		//MP
		case 'mp':
	  	$('#formContact').hide();
	  	$('#formPosition').hide();
		break;
  }
}
		
function testCounty() { 
  switch(document.getElementById('county').options[document.getElementById('county').selectedIndex].value) {
		case'outside':
	  	$('#formCountry').show();
		break;
		default:
	  	$('#formCountry').hide();

	}
}


var c=0
var t
var divNum=0

function timedCount(){
		c=c+1;
		if (c%6==0) {
					divNum=(Math.floor(Math.random()*5))+1;
					switch(divNum)
						{
						case 1: 
								$('#news1').fadeIn(1000);
								$('#news2').fadeOut(1000);
								$('#news3').fadeOut(1000);
								$('#news4').fadeOut(1000);
								$('#news5').fadeOut(1000);
								break;					
						case 2: 
								$('#news1').fadeOut(1000);
								$('#news2').fadeIn(1000);
								$('#news3').fadeOut(1000);
								$('#news4').fadeOut(1000);
								$('#news5').fadeOut(1000);
								break;							
						case 3: 
								$('#news1').fadeOut(1000);
								$('#news2').fadeOut(1000);
								$('#news3').fadeIn(1000);
								$('#news4').fadeOut(1000);
								$('#news5').fadeOut(1000);
								break;					
								break;					
						case 4: 
								$('#news1').fadeOut(1000);
								$('#news2').fadeOut(1000);
								$('#news3').fadeOut(1000);
								$('#news4').fadeIn(1000);
								$('#news5').fadeOut(1000);
								break;							
						case 5: 
								$('#news1').fadeOut(1000);
								$('#news2').fadeOut(1000);
								$('#news3').fadeOut(1000);
								$('#news4').fadeOut(1000);
								$('#news5').fadeIn(1000);
								break;								
						default: 
								$('#news1').fadeIn(1000);
								$('#news2').fadeOut(1000);
								$('#news3').fadeOut(1000);
								$('#news4').fadeOut(1000);
								$('#news5').fadeOut(1000);
								break;							
						};
					};
		t=setTimeout("timedCount()",1000);
		
		}

function stopCount() {
				clearTimeout(t);
			}


document.onload = timedCount();

// ALAX scripts

function callAHAH(url, pageElement, callMessage) {
	
		
	 var myRand = parseInt(Math.random()*9999999999999999);
	 var modURL = url + "&rand=" + myRand; 
	 
	document.getElementById(pageElement).innerHTML = callMessage;
	try {
     req = new XMLHttpRequest(); /* e.g. Firefox */
     } catch(e) {
       try {
       req = new ActiveXObject("Msxml2.XMLHTTP");
       /* some versions IE */
       } catch (e) {
         try {
         req = new ActiveXObject("Microsoft.XMLHTTP");
         /* some versions IE */
         } catch (E) {
          req = false;
         }
       }
     }
	 req.onreadystatechange = function() {responseAHAH(pageElement);};
     req.open("GET",modURL,true);
     req.send(null);
  }
  
 function callAHAHnp(url, pageElement, callMessage) {
	 var myRand = parseInt(Math.random()*9999999999999999);
	 var modURL = url + "?rand=" + myRand; 
	
	document.getElementById(pageElement).innerHTML = callMessage;
     try {
     req = new XMLHttpRequest(); /* e.g. Firefox */
     } catch(e) {
       try {
       req = new ActiveXObject("Msxml2.XMLHTTP");
       /* some versions IE */
       } catch (e) {
         try {
         req = new ActiveXObject("Microsoft.XMLHTTP");
         /* some versions IE */
         } catch (E) {
          req = false;
         }
       }
     }
	 req.onreadystatechange = function() {responseAHAH(pageElement);};
     req.open("GET",modURL,true);
     req.send(null);
  } 
  
  
function responseAHAH(pageElement) {
   var output = '';
   if(req.readyState == 4) {
      if(req.status == 200) {
         output = req.responseText;
         document.getElementById(pageElement).innerHTML = output;
         }
		 else {
		 output = req.statusText
         document.getElementById(pageElement).innerHTML = '<a href=\"javascript:;\" onclick=\"hide(\'' + pageElement + '\');\" class=\"nochange\">X</a><p class=\"choose\"><strong>Error: </strong>' + output + '.</p>';
		 }
      }
  }


//-->

