//--------------
$.fn.check_email_existing = function() {
	//-------
	var eml  = $(this).val();
	var fn   = $("#fvl_name").val();
	var info = $("#ymuwe");
	var fv_s = $("#fvl_send");
	//-------
	info.data('message',{
		'yi':info.html(),
		'check':"Please wait a few seconds while we check your email address.",
		'result':"A link to download Video Surgeon<br>will appear on the next page."
	});
	info.html(info.data('message').check)
		.css('font-size','24px');
	fv_s.hide();
	//-------
	$.ajax({
		type: "POST",
		url: "/engine/validation/email_check/low/yi/",
		data: { 'email':eml },
		dataType: 'json',
		complete: alert(info.data('message').check),
		success: function(data) {
			//-------
			info.html(info.data('message').yi)
				.css('font-size','9pt');
			fv_s.show();
			//-------
			var num = data.errors.length;
			if(num == 0) {
				$("#form1").submit();
				return true;
			} else {
				msg = "The email you entered appears to be incorrect.  Please review your email address and either fix it, or if you confirm it is correct, please submit again.";
				alert(msg);
			}	
		}
	});
	//-------
}
//--------------
var fvideo_arr = new Array();
fvideo_arr['yi'] = '<embed id="VS-musthave_controller.swf" height="400" width="375" quality="best" bgcolor="#FFFFFF" type="application/x-shockwave-flash" flashvars="csConfigFile=/video/VS-musthave_config.xml&csColor=FFFFFF" name="VS5_controller.swf" src="/video/VS-musthave_controller.swf"/>';
fvideo_arr['er'] = '<embed id="VS5_controller.swf" height="400" width="375" quality="best" bgcolor="#FFFFFF" type="application/x-shockwave-flash" flashvars="csConfigFile=/video/VS5_config.xml&csColor=FFFFFF" name="VS5_controller.swf" src="/video/VS5_controller.swf"/>';
fvideo_arr['san'] = '<embed id="VS6_controller.swf" height="400" width="375" quality="best" bgcolor="#FFFFFF" flashvars="csConfigFile=/video/VS6_config.xml&csColor=FFFFFF" name="VS6_controller.swf" src="/video/VS6_controller.swf" type="application/x-shockwave-flash"/>';
//--------------
function fvideo_go(i) {
	$("#fvideo_"+i).html(fvideo_arr[i]);
}
//--------------
$(document).ready(function() {
	//--------------
	setTimeout ( "fvideo_go('yi')",1500);
	setTimeout ( "fvideo_go('er')",5500);
	setTimeout ( "fvideo_go('san')",12500);
	//--------------
	$("#fvl_send").click(function() {
		frmValidate();
		$("#fvl_email").check_email_existing();
		return false;
	});
	//--------------
	// --- JS INSERT BEGIN
	// --- JS INSERT END
});

function frmValidate() {
	if (document.form1.fname.value==""){
		alert("Please Enter First Name...! ");
		document.form1.fname.focus();
		return false;
	}
	if(document.form1.email.value!="") {
		if(document.form1.email.value.indexOf("@")==-1 ||
			document.form1.email.value.indexOf(".")==-1 ||
			document.form1.email.value.indexOf("")==-1 ||
			document.form1.email.value.length < 6) {
				alert("Sorry, the e-Mail Address is not valid.");
				document.form1.email.focus();
				return false;
		}
	} else {
		alert("Please Enter E-Mail Address.");
		document.form1.email.focus();
		return false;
	}
}
function MM_openBrWindow(theURL,winName,features) {
	window.open(theURL,winName,features);
}
