function requireInput( id){
	var obj = document.getElementById(id);
	if (document.getElementById(id).value == ''){
		return false;
	}else{
		return true;
	}
}
function emailInput(id){
	regex=/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
	return regex.test(document.getElementById(id).value);
}
function numericInput(id){
	regex=/^(\d|-)?(\d|,)*\.?\d*$/;
	return regex.test(document.getElementById(id).value);
}

function showMsg(final_msg){

	if (final_msg != ''){
		jQuery('.message').show();
		jQuery('.message').html('<div class="message_error"><ul>'+final_msg+'</ul></div>');
		jQuery('.message').fadeOut(15000);
		return false;
	}else{
		return true;
	}
}


function validateURL2(value) {
	var v = new RegExp();
	v.compile("^[A-Za-z]+://[A-Za-z0-9-]+\.[A-Za-z0-9]+");
	if (!v.test(value)) {
		return false;
	}else{
		return true;
	}
}

function contactFormValidation(){
	final_msg = '';
	if(!requireInput('name')){
		final_msg = final_msg + '<li>We are expecting your name.</li>';
	}
	if(!requireInput('email')){
		final_msg = final_msg + '<li>It would be great, if you could share you contact email address.</li>';
	}else {
		if(!emailInput('email')){
			final_msg = final_msg + '<li>We were expecting some valid email address.</li>';
		}
	}
	if(!requireInput('comment')){
		final_msg = final_msg + '<li>Your comments are valuable to us, please don\'t forget to enter it.</li>';
	}
	return showMsg(final_msg);
}
