function confirm_del(id) {
	var del = confirm("Are you sure you to delete?", "Yes", "No");

	if (del) {
		window.location = "member.php?id=" + id;
	}
}

function showPic (picName) {
	window.location = "member.php?pic=" + picName;
}

function ChangeRowColor(tableRow, highLight) {
	if (highLight)
	{
		tableRow.style.backgroundColor = '#3CB371';
	}
	else {
		tableRow.style.backgroundColor = '#FFF';
	}
}

function MM_openBrWindow(theURL,winName,features) {
	window.open(theURL,winName,features);
}

$(function() {

	$("#regSubmit").click(function () {
		var sl1 = $("#sL1").val();
		var sl2 = $("#sL2").val();
		var sl3 = $("#sL3").val();
		var sl4 = $("#sL4").val();
		var sl5 = $("#sL5").val();

		$("#loader").hide();

		if (sl1 == 5 && sl2 == 3 && sl3 == 1 && sl4 == 4 && sl5 == 2) {
			$("#link").fancybox({
				'centerOnScroll': true
			});

			$("#link").trigger("click");
		}
		else {
			alert("ตอบผิดจ้า, ลองอีกทีนะ!");
		}
	});

	$("#submitBt").click(function() {
		$("#regisFrm").submit();
	});

	$("#regisFrm").validate({
		rules: {
			Name: "required",
			Nick: "required",
			Tele: {required: true},
			Email: {required: true, email: true},
			pName: "required",
			pNick: "required",
			pTele: {required: true},
			pEmail: {required: true, email: true},
			pic: {required: true, accept: "jpg"}
		},
		messages: {
			Name: "*",
			Nick: "*",
			Tele: {required: "*"},
			Email: "*",
			pName: "*",
			pNick: "*",
			pTele: {required: "*"},
			pEmail: "*",
			pic: {required: $("#errPic").css({'display' : 'block'}), accept: $("#errPic").css({'display' : 'block'})}
		},
		invalidHandler: function(form, validator) {
			$("#errTxt").css({'display' : 'block'})
		}
	});
});