$(document).ready(function(){
	$.formValidator.initConfig({formid:"VISAregform",onerror:function(msg){alert(msg)}});
	
	$("input:radio[name='salutation']").formValidator({
		onshow:"Please select the salutation.",
		onfocus:"Please select the salutation.",
		oncorrect:" ",
		defaultvalue:[2]
	}).inputValidator({
		min:1,
		max:3,
		onerror:"Please select the salutation."
	});
	
	$("#name").formValidator({
		onshow:"Please fill in full passport name.",
		onfocus:"Can not be empty.",
		oncorrect:" "
	}).inputValidator({
		min:1,
		onerror:"Please fill in passport name."
	});
	
	$("#title").formValidator({
		onshow:"Please fill in job title.",
		onfocus:"Can not be empty.",
		oncorrect:" "
	}).inputValidator({
		min:1,
		onerror:"Please fill in job title."
	});
	
	$("#company").formValidator({
		onshow:"Please fill in company name.",
		onfocus:"Can not be empty.",
		oncorrect:" "
	}).inputValidator({
		min:1,
		onerror:"Please fill in company name."
	});
	
	$("#address").formValidator({
		onshow:"Please fill in address.",
		onfocus:"Can not be empty.",
		oncorrect:" "
	}).inputValidator({
		min:5,
		max:200,
		onerror:"Please fill in detail address."
	});
	
	$("#city").formValidator({
		onshow:"Please fill in city.",
		onfocus:"Can not be empty.",
		oncorrect:" "
	}).inputValidator({
		min:1,
		onerror:"Please fill in city."
	});
	
	$("#postcode").formValidator({
		onshow:"Please fill in postcode.",
		onfocus:"Can not be empty.",
		oncorrect:" "
	}).inputValidator({
		min:1,
		onerror:"Please fill in postcode."
	});
	
	$("#country").formValidator({
		onshow:"Please fill in nationality.",
		onfocus:"Can not be empty.",
		oncorrect:" "
	}).inputValidator({
		min:1,
		onerror:"Please fill in nationality."
	});

	$("#tel").formValidator({
		onshow:"Please fill in telephone.",
		onfocus:"Can not be empty.",
		oncorrect:" "
	}).inputValidator({
		min:6,
		onerror:"Please fill in telephone."
	});
	$("#fax").formValidator({
		onshow:"Please fill in fax.",
		onfocus:"Can not be empty.",
		oncorrect:" "
	}).inputValidator({
		min:6,
		onerror:"Please fill in fax."
	});
	$("#email").formValidator({
		onshow:"Please fill in Email.",
		onfocus:"Can not be empty.",
		oncorrect:" "
	}).inputValidator({
		min:6,
		max:100,
		onerror:"Your Email length of the error."
	}).regexValidator({
		regexp:"^([\\w-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([\\w-]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$",
		onerror:"Your Email format is not correct."
	});
	
	$("#passport").formValidator({
		onshow:"Please fill in your passport no.",
		onfocus:"Can not be empty.",
		oncorrect:" "
	}).inputValidator({
		min:1,
		onerror:"Please fill in your passport no."
	});
	
	$("#edate").formValidator({
		onshow:"Please fill in Exp.date of your passport.",
		onfocus:"Can not be empty.",
		oncorrect:" "
	}).inputValidator({
		min:1,
		onerror:"Please fill in Exp.date of your passport."
	});
	
	$("#birthp").formValidator({
		onshow:"Please fill in Place of Birth.",
		onfocus:"Can not be empty.",
		oncorrect:" "
	}).inputValidator({
		min:1,
		onerror:"Please fill in Place of Birth."
	});
	
	$("#birthd").formValidator({
		onshow:"Please fill in Date of Birth.",
		onfocus:"Can not be empty.",
		oncorrect:" "
	}).inputValidator({
		min:1,
		onerror:"Please fill in Date of Birth."
	});
	
	$("#embassy").formValidator({
		onshow:"Please fill in Chinese Embassy/Consulate of (City) in Your Country.",
		onfocus:"Can not be empty.",
		oncorrect:" "
	}).inputValidator({
		min:1,
		onerror:"Please fill in Chinese Embassy/Consulate of (City) in Your Country."
	});
});

