// Java Document
function openApp()
{
window.open('apply/application.php', name, 'toolbars=no, width=800, resize=yes, scrollbars=yes')
}
function checkForm()
	{
	
	
	if(document.enquiry.name.value=="")
			{
			alert("Please enter your name");
			document.enquiry.name.focus();
			document.enquiry.name.select();
			return false;
			}
if(document.enquiry.email.value=="")
			{
			alert("Please enter your email address");
		document.enquiry.email.focus();
			document.enquiry.email.select();
			return false;
			}
if(document.enquiry.telephone.value=="")
		{
	alert("Please enter your telephone number");
			document.enquiry.telephone.focus();
	document.enquiry.telephone.select();
		return false;
		}
			
		

	
			
			
	}
function checkApplication()
	{
	
	
	if(document.apply.name.value=="")
			{
			alert("Please enter your name");
			document.apply.name.focus();
			document.apply.name.select();
			return false;
			}
if(document.apply.email.value=="")
			{
			alert("Please enter your email address");
			document.apply.email.focus();
			document.apply.email.select();
			return false;
			}
if(document.apply.telephone.value=="")
		{
	alert("Please enter your telephone number");
			document.apply.telephone.focus();
	document.apply.telephone.select();
		return false;
		}
			
	if(document.apply.project.value=="")
		{
	alert("Please enter the name of your project");
			document.apply.project.focus();
	document.apply.project.select();
		return false;
		}	

		if(document.apply.address.value=="")
		{
	alert("Please enter your address");
			document.apply.address.focus();
	document.apply.address.select();
		return false;
		}	
	if(document.apply.postcode.value=="")
		{
	alert("Please enter your postocde");
			document.apply.postcode.focus();
	document.apply.postocde.select();
		return false;
		}	
	if(document.apply.background.value=="")
		{
	alert("Please enter enter some background information about your project");
			document.apply.background.focus();
	document.apply.background.select();
		return false;
		}	
	if(document.apply.reason.value=="")
		{
	alert("Please enter your goals and aims for your website");
			document.apply.reason.focus();
	document.apply.reason.select();
		return false;

}
 return true;


}
		
function checkNews()
	{
	
	
	if(document.newsletter.name.value=="Name")
			{
			alert("Please enter your name");
			document.enquiry.name.focus();
			document.enquiry.name.select();
			return false;
			}
if(document.newsletter.email.value=="Email Address")
			{
			alert("Please enter your email address");
		document.enquiry.email.focus();
			document.enquiry.email.select();
			return false;
			}

			
		

	
			
			
	}		



function checkrequired(which){
var pass=true
if (document.images){
for (i=0;i<which.length;i++){
var tempobj=which.elements[i]
if (tempobj.name.substring(0,3)=="req"){
if (((tempobj.type=="text"||tempobj.type=="textarea")&&tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&tempobj.selectedIndex==-1)){
pass=false
break
}
}
}
}
if (!pass){
alert("Please complete any fields left empty, then submit again.")
return false
}
else
return true
}
// StyleSwitcher functions written by Paul Sowden
// http://www.alistapart.com/stories/alternate/
function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);







			
			
			
			