function isBlank(s){
	if (s==null) return true;
   	    for(var i = 0; i < s.length; i++) {
	        var c = s.charAt(i);
    	    if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
   	}
   	return true;
}

function sendmail() {

/*	if (document.contactus.name.value == ""){ document.contactus.name.value == "NAME" };
	if (document.contactus.email.value == ""){ document.contactus.email.value == "EMAIL" };
	if (document.contactus.number.value == ""){ document.contactus.number.value == "CONTACT NUMBER" };
	if (document.contactus.message.value == ""){ document.contactus.message.value == "MESSAGE" };
*/	
	if(document.contactus.name.value == "NAME" || document.contactus.name.value == ""){
		alert("Please enter your name");
		document.contactus.name.focus();
		return false;
	}
	if(document.contactus.email.value == "EMAIL" && document.contactus.number.value == "CONTACT NUMBER"){
		alert("Please enter your email address or a contact number");
		document.contactus.email.focus();
		return false;
	}
	if(document.contactus.email.value != "EMAIL" && document.contactus.email.value != '' ){
		if(isValidEmail(document.contactus.email.value)){
			alert("Please enter a valid email address 1");
			document.contactus.email.focus();
			return false;
		}
	}
/*	if(document.contactus.message.value == "MESSAGE"){
		alert("Please enter your message");
		document.contactus.message.focus();
		return false;
	}

	if(isBlank(document.contactus.name.value)) {
		alert("Please enter your name");
		document.contactus.name.focus();
		return false;
	}

*/
	document.contactus.action="contact.php";
}


function isValidEmail(checkString) {

//	        var emailFormat = /^[a-zA-Z0-9_\.]+\@{1}([a-zA-Z0-9]+\.){1,3}[a-zA-Z]{2,4}$/;
//		regExpEmail= new RegExp(emailFormat);
//		if(regExpEmail.test(checkString)==false)
//		{
//			return true;
//		}		
//		return false;

		var flag = 1;

		var txt = checkString;
		var pos = txt.indexOf('.')

		var pos1= txt.indexOf('@')

		var len = txt.length;

		if(pos1 == 0 || pos==0 || pos1 == -1 || pos==(pos1-1))
		{
			return true;
		}
		else
		{
			var txt1 = txt.substring(0,pos1)
			for(i=0 ; i< txt1.length ; i++)
			{
				var ch = txt1.charAt(i)
				if( ch <= '9' && ch >= '0')
					flag = 0
				else if(ch <= 'z'&& ch >= 'a')
					flag = 0
				else if(ch <= 'Z' && ch >= 'A')
					flag=0
				else if(ch == '.')
					flag=0
				else if(ch == '_')
					flag=0
				else if(ch == '-')
					flag=0
				else
					flag=1;	

				if(flag == 1)
				{
					return true;
				}
			}

			var txt2 = txt.substring(pos1+1,len)
			pos2 = txt2.indexOf('.')
			if(pos2 == -1 || pos2 == 0 || pos2== (txt2.length-1))
			{
				return true;
			}
			else
			{
				var txt3 = txt2.substring(0,pos2)
				flag=1
				for(i=0 ; i< txt3.length ; i++)
				{
					var ch = txt3.charAt(i)
					if( ch <= '9' && ch >= '0')
						flag = 0
					else if(ch <= 'z'&& ch >= 'a')
						flag = 0
					else if(ch <= 'Z' && ch >= 'A')
						flag=0
					else if(ch == '_')
						flag=0
					else if(ch == '-')
						flag=0
					else
						flag=1;	

					if(flag == 1)
					{
						return true;
					}
				}

				var txt4 = txt2.substring(pos2+1,txt2.length)
				if (txt4.indexOf('.') == -1 && txt4.length >3)
				{
					return true;
				}
				flag=1
				for(i=0 ; i< txt4.length ; i++)
				{
					var ch = txt4.charAt(i)
					if( ch <= '9' && ch >= '0')
						flag = 0
					else if(ch <= 'z'&& ch >= 'a')
						flag = 0
					else if(ch <= 'Z' && ch >= 'A')
						flag=0
					else if(ch == '-')
						flag=0
					else if(ch == '.')
					{
						flag=0
						if( i == (txt4.length - 1))
						flag=1;	
					}
					else
						flag=1;	

					if(flag == 1)
					{
						return true;
					}
				}

			}
		}
	
	}

function show(id) { 

	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	} else { 
		if (document.layers) {	
			document.id.display = 'block';
		} else {
			document.all.id.style.display = 'block';
		}
	}
}
function hide(id) { 

	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display == "none";
	} else { 
		if (document.layers) {	
			document.id.display == "none";
		} else {
			document.all.id.style.visibility == "none";
		}
	}
}