// JavaScript Document
function imgOpen(targObj){
document.getElementById("bigImage").src = targObj;
//var mywin = window.open(targObj, 'myPopupWindow', 'toolbar=no,location=no,width=370,height=270s,status=no, menubar=no, resizable=yes, scrollbars=no');
}
function formValidator(){
	// Make quick references to our fields
	var name = document.getElementById('name');
	var email = document.getElementById('email');
	var comment= document.getElementById('comments');
	
	// Check each input in the order that it appears in the form!
	if(isAlphabet(name)){
		if(emailValidator(email, "Please enter a valid email address")){
		     if(commentValidator(comment, "Please enter your comments")){
							return true;
			}
		}
	}
	return false;
}

function isAlphabet(elem){
	
	var alphaExp = /^[\sa-zA-Z]+$/;
	if(elem.value.match(alphaExp)){
		return true;
	}else if(elem.value == ''){
	alert("Please enter your name");
		elem.focus();
		return false;
	}else{
		alert("Numbers and Special characters are not allowed in name");
		elem.focus();
		return false;
	}
}

function emailValidator(elem, helperMsg){
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}


function commentValidator(elem, helperMsg){
	
	if(elem.value ==''){
       alert(helperMsg);
		elem.focus();
		return false;
	}else{
		return true;
	}
}


