<!--

var intShowingLayer = 1;
var objLoop = setInterval(rotateNews,10000);					
				

// Java Document
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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) {
	if ((obj=MM_findObj(args[i]))!=null) {
		v=args[i+2];
		if (obj.style) { 
			obj=obj.style; 
			v=(v=='show')?'block':(v=='hide')?'none':v; 
		}
		obj.display=v; 
	}
  }
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function trim(inputString) 
{
   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
}

function notValidEmail(pString){
var dotpos=pString.indexOf('.');
var atpos=pString.indexOf('@');
	if(atpos == -1 || (pString=="") || (pString==" ") || (pString.length < 6)){
		return true;
	}
	else if(dotpos + 1 == atpos){
		return true;
	}
	else{
		var emailterm=pString.substring(atpos, (pString.length));
		if(emailterm.indexOf('.')==-1 || emailterm.length < 2){
			return true;}
		else return false;
	}

}

function popwindow(theURL,winName) 
{ //v2.0
  var midScreenWidth = (screen.availWidth)/2; // find the mid width
  var midScreenHeight = (screen.availHeight)/2; // find the mid height
  var l = midScreenWidth - 245; // position left
  var t = midScreenHeight - 210; // position top
  var winFeatures = ("width=490,height=420,left="+l+",top="+t+",scrollbars=1,resizable=1");
  window.open(theURL,winName, winFeatures);
}

function restrictLengthWithDisplay(pElem,pLength,pDisplayElem)
{
	if (pElem.value.length > pLength) 
	{
      pElem.value = pElem.value.substring(0,pLength);
      charleft = 0;
    }
    else 
	{
      charleft = pLength - pElem.value.length;
    } 
	pDisplayElem.value = charleft;
}

function validEnquiry(frm)
{
	// if(trim(frm.title.value)=="")
	// {
		// alert("Please enter your job title");
		// frm.title.focus();
		// return false;
	// }
	if(trim(frm.surname.value)=="")
	{
		alert("Please enter your surname");
		frm.surname.focus();
		return false;
	}
	if(trim(frm.firstname.value)=="")
	{
		alert("Please enter your first name");
		frm.firstname.focus();
		return false;
	}  
	// if(trim(frm.address.value)=="")
	// {
		// alert("Please enter your address");
		// frm.address.focus();
		// return false;
	// } 
	// if(trim(frm.postcode.value)=="")
	// {
		// alert("Please enter your Post Code");
		// frm.postcode.focus();
		// return false;
	// } 
	if(notValidEmail(frm.email.value))
	{
		alert("Please enter a valid email address");
		frm.email.focus();
		return false;
	}
	if(frm.enquiry.selectedIndex == 0)
	{
		alert("Please select the Nature of Enquiry");
		frm.enquiry.focus();
		return false;
	}
	if(trim(frm.message.value)=="")
	{
		alert("Please enter your message");
		frm.message.focus();
		return false;
	}	
	return true;

}
function rotateNews()
{
	var intDivLoop = 6;						
	var layer;
	var indexOn = intShowingLayer + 1;
	var indexOff = intShowingLayer;
	if(indexOn > intDivLoop)
	{
		indexOn = 1;
	}
	intShowingLayer = indexOn;
	window.status = intShowingLayer;
	layer = document.getElementById('latestNews'+indexOff);
	if (layer == null) {
	}
	else {
		layer.style.display = 'none';
		layer = document.getElementById('latestNews'+indexOn);
		layer.style.display = '';
	}
}


//-->