navinfo = navigator.userAgent.split(' ');
var ie7 =  navinfo[3]=='7.0;' ? true : false;
if(ie7){
document.write('<link rel="stylesheet" type="text/css" href="style/ifIe7.css" />');
}

	function isValidEmail(email) {

	    if(email==null){
            return false;
	    }
	    if (email.length<5) {
            return false;
	    }
	    if(!isValidChars(email)){
	        return false;
	    }
	    if(email.indexOf("@") < 1){
	        return false;
	    }else if(email.lastIndexOf(".") <= email.indexOf("@")) {
	        return false;
	    }else if(email.indexOf("@") == email.length) {
	        return false;
	    }else if(email.indexOf("..") >=0) {
			return false;
	    }else if(email.indexOf(".") == email.length){
			return false;
	    }
	    return true;
	}

	function isValidChars(email) {
	  var valid = true;
	  var chars = "abcdefghijklmnopqrstuvwxyz0123456789@.-_";
	  for (var i=0; i < email.length; i++) {
	    var letter = email.charAt(i).toLowerCase();
	    if (chars.indexOf(letter) != -1)
	      continue;
	    valid = false;
	    break;
	  }
	  return valid;
	}
	
	function sendNewsLetterForm(){
		frm = document.getElementById('newsLetterForm');
		fld = document.getElementById('umail');
		
		if(!isValidEmail(fld.value)){
			alert('Please enter valid E.Mail address.');
			fld.focus();
			return false;
		}
		alert("Thank you for join to our maillist!");
		frm.submit();
		return true;
	}
	
	function sendContactForm(){
		frm	= document.getElementById('contactForm');
		fn	= document.getElementById('fname');
		ln	= document.getElementById('company');
		cm	= document.getElementById('email');
		um	= document.getElementById('message');
		
		if(fn.value == ''){
			alert('Please enter your first name.');
			fn.focus();
			return false; 
		}
		
		if(ln.value == ''){
			alert('Please enter your last name.');
			ln.focus();
			return false; 
		}
		
		if(!isValidEmail(cm.value)){
			alert('Please enter valid E.Mail address.');
			cm.focus();
			return false;
		}	  
	
		if(um.value == ''){
			alert('Please enter your message.');
			um.focus();
			return false; 
		}
		
		if(um.length > 255){
			alert('Message use to be 255 characters max.');
			um.focus();
			return false; 
		}	
		
		alert("Thank you for your inquiry.\nNipendo's representative will contact you soon.");
		frm.submit();
		return true;
	}

	
	