	function Is() 
	{
   		var agent = navigator.userAgent.toLowerCase();
   		this.major = parseInt(navigator.appVersion);
   		this.minor = parseFloat(navigator.appVersion);

   		this.ns = ((agent.indexOf('mozilla') != -1) && 	
    		(agent.indexOf('spoofer') == -1) && 
    		(agent.indexOf('compatible') == -1) && 
    		(agent.indexOf('opera') == -1) && 
    		(agent.indexOf('webtv') == -1));

   		this.ns2 = (this.ns && (this.major == 2));
   		this.ns3 = (this.ns && (this.major == 3));
   		this.ns4 = (this.ns && (this.major == 4));
   		this.ns6 = (this.ns && (this.major >= 5));
   		this.ie = (agent.indexOf("msie") != -1);
   		this.ie3 = (this.ie && (this.major < 4));
   		this.ie4 = (this.ie && (this.major == 4));
   		if(this.ie4 && (agent.indexOf("msie 5.0") != -1))
   		{
      		this.ie4=false;
      		this.ie5=true;
   		}

   		this.ieX = (this.ie && !this.ie3 && !this.ie4);
	}
	
	var is = new Is();
	var Reqd;
	var eMai;

	function WriteLayer(id,text) 
	{
   		var DOM = (document.getElementById) ? true:false;	
   		var divID;

   		if (is.ns4) divID = document.layers[id];
   		else if (is.ie4) divID = document.all[id];
   		else if (DOM) divID = document.getElementById(id);

   		if (is.ns4) 
   		{
      		divID.document.open();
      		divID.document.write(text);
      		divID.document.close();
   		}
   		else if (DOM ||is.ie4) 
   		{
      		divID.innerHTML = text;						
   		}
	}
	
	function SetLayerVisibility(id,visibility)
	{
   		if (is.ieX||is.ns6)
   		{
        	this.obj = document.getElementById(id).style;
        	this.obj.visibility = visibility;
   		}
   		else if(is.ie4)
   		{
        	this.obj = document.all[id].style;
        	this.obj.visibility = visibility;
   		}
   		else if(is.ns4)
   		{
        	this.obj = document.layers[id];
        	return this.obj;
   		}
	}
	
	function trim(s)
	{
   		while (s.substring(0,1) == ' ')
   		{
      		s = s.substring(1,s.length);
   		}
   		while (s.substring(s.length-1,s.length) == ' ')
   		{
      		s = s.substring(0,s.length-1);
   		}
   		return s;
	}
	
	function CheckEmail(eMai)
	{
    	eMai=trim(eMai);
    	var ok = "1234567890abcdefghijklmnopqrstuvwxyz[].\@-_ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    	for(h=0; h < eMai.length ;h++)
    	{
        	if(ok.indexOf(eMai.charAt(h))<0)
        	{
            	return (false);
        	}
    	}
    	var re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
    	var re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,4})(\]?)$/;
    	if (!eMai.match(re) && eMai.match(re_two))
    	{
        	return -1;
    	}
	}
	
	function isReady()
	{
   		var bFieldsFilled=true;
   
    	if (document.form.name.value == "")
    	{
        	SetLayerVisibility("name_label","hidden");
        	SetLayerVisibility("name_error","visible");

        	if( bFieldsFilled)
        	{
           		document.form.name.focus();
           		bFieldsFilled=false;
        	}
    	}
    	else
    	{
        	SetLayerVisibility("name_label","visible");
        	SetLayerVisibility("name_error","hidden");
    	}

    	if (document.form.email.value == "")
    	{
        	SetLayerVisibility("email_label","hidden");
        	SetLayerVisibility("email_error","visible");

        	if( bFieldsFilled)
        	{
           		document.form.email.focus();
           		bFieldsFilled=false;
        	}
    	}
    	else
    	{
        	SetLayerVisibility("email_label","visible");
        	SetLayerVisibility("email_error","hidden");
    	}

    	if (document.form.url.value == "")
    	{
        	SetLayerVisibility("url_label","hidden");
        	SetLayerVisibility("url_error","visible");

        	if( bFieldsFilled)
        	{
           		document.form.url.focus();
           		bFieldsFilled=false;
        	}
    	}
    	else
    	{
        	SetLayerVisibility("url_label","visible");
        	SetLayerVisibility("url_error","hidden");
    	}

    	if (document.form.heading.value == "")
    	{
        	SetLayerVisibility("heading_label","hidden");
        	SetLayerVisibility("heading_error","visible");

        	if( bFieldsFilled)
        	{
           		document.form.heading.focus();
           		bFieldsFilled=false;
        	}
    	}
    	else
    	{
        	SetLayerVisibility("heading_label","visible");
        	SetLayerVisibility("heading_error","hidden");
    	}

    	if (document.form.desc.value == "")
    	{
        	SetLayerVisibility("desc_label","hidden");
        	SetLayerVisibility("desc_error","visible");

        	if( bFieldsFilled)
        	{
           		document.form.desc.focus();
           		bFieldsFilled=false;
        	}
    	}
    	else
    	{
        	SetLayerVisibility("desc_label","visible");
        	SetLayerVisibility("desc_error","hidden");
    	}

    	if (document.form.backlink.value == "")
    	{
        	SetLayerVisibility("backlink_label","hidden");
        	SetLayerVisibility("backlink_error","visible");

        	if( bFieldsFilled)
        	{
           		document.form.backlink.focus();
           		bFieldsFilled=false;
        	}
    	}
    	else
    	{
        	SetLayerVisibility("backlink_label","visible");
        	SetLayerVisibility("backlink_error","hidden");
    	}

    	Reqd='*'; 

    	eMai=document.form.email.value;
      
    	if(eMai.length && !CheckEmail(eMai))
    	{
        	WriteLayer("email_label","<td align=left><font color='red'><b>The eMail address<br>is not valid.<br>Please correct it.</b></font></td>");

        	document.form.email.style.background = "#ff0000";
        	if( bFieldsFilled)
        	{
           		document.form.email.focus();
           		bFieldsFilled=false;
        	}
    	}
    	else
    	{
        	var Bl="email_label";
        	var str="<td><b>E-mail Address"+Reqd+"</b></td>";      
        	WriteLayer(Bl,str);
        	document.form.email.style.background = "#ffffff";
    	}

   		if(!bFieldsFilled)
   		{
      		var str='<b><FONT size="3" face="Verdana, Arial, Helvetica, sans-serif" color="red">';
          	str +='This Form cannot be submitted until the missing';
          	str +='fields (labelled below in red) have been filled in.</FONT></b>';
      		WriteLayer("MissingFields",str);
      		SetLayerVisibility("MissingFields","visible");
   		}
   		else
   		{
      		SetLayerVisibility("MissingFields","hidden");
   		}
   		return bFieldsFilled;
	}
			
	function SubmitData(){
   		var flag;

   		flag = isReady();

   		if (!flag)
   		{
			return false;
   		}   
   		document.form.target="_self";
   		document.form.submit();
	}
	