$(document).ready(function() {
	
	//alert($("form#validatedform").attr("action"));
	
	var v_no; // as global
	
	if ($("form#validatedform").attr("action") != null && $("form#validatedform").attr("action").search('/emailfunction.php')) {
		v_no = Math.random();
		v_no = v_no * 9999;
		v_no = Math.ceil(v_no);
		//alert(v_no);
		
		var $verify = 'V.code = '+ v_no +'<br /> <input id="jqverify" type="text" name="jqverfy"> Must type above V.code<br /><br />';
		
		$("form#validatedform input[@type=submit]").before($verify);
	}
	
	$("form#validatedform").submit(function() {
		//alert($("#jqverify").val() + " &" + v_no);
		$(".warnvcode").remove();
		if ($("#jqverify").val()!= v_no) {
			$("#jqverify").css("background-color","red");
			$("#jqverify").val("");
			//alert("Wrong V.code or you did not type V.code");
			$("form#validatedform input[@type=submit]").before('<b class="warnvcode" style="color:red;">V.code field is required or you did not type correct number<br /></b>');
			return false;
		}
	});
	
});