﻿/* for CFR */

$(document).ready(function(){

	$('#modal_edituser').jqm(); 
	
	$('#modal_edituser2').jqm();
	
	$('#modal_termsuse').jqm();
	
	$('#modal_showUserInfo').jqm();
	
	/* new user validation - cfr_new_user.asp */
	$("#frmCfrNewUser").validate({
		rules: {
			cfr_first_name: { required: true },
			cfr_last_name: { required: true },
			cfr_company_name: { required: true },
			cfr_email: { required: true, email: true },
			cfr_password: { required: true }
		}
	});	
	
	$("#frmCfrLogin").validate({
		rules: {
			cfr_login_email: { required: true, email: true},
			cfr_login_pwd: { required: true }
		}
	});
});	



jQuery.fn.funcTest = function (thisUserId, thisFirstName, thisLastName, thisEmailAdd, thisPhoneNr, thisExtNr, thisCompNa, thisWhere) {
	$('#edit_user_id').val(thisUserId);
	$('#edit_user_fname').val(thisFirstName);	
	$('#edit_user_lname').val(thisLastName);
	$('#edit_user_email').val(thisEmailAdd);
	$('#edit_user_phone').val(thisPhoneNr);
	$('#edit_user_ext').val(thisExtNr);
	$('#edit_user_company').val(thisCompNa);
	
	if (thisWhere == 'admin')
		$('#modal_edituser').jqmShow();
	else
		$('#modal_edituser2').jqmShow();
};


jQuery.fn.funcShowUserInfo = function (thisIndustry, thisInterest) {
	$('#modal_p_industry').html("<span class='bold heading_red'>Market/Industry:</span> " + thisIndustry);
	$('#modal_p_interest').html("<span class='bold heading_red'>Topics of HazMat Interest:</span> " + thisInterest);
	$('#modal_showUserInfo').jqmShow();
};
	

function funcManageUser(ttAction, ttUID) {
	document.getElementById("userID").value = ttUID;
	document.getElementById("whatAction").value = ttAction;
	document.getElementById("manageUser").submit();
}

function funcLogout(tType) {
	document.getElementById("isLogout").value = "yes";
	if (tType == "tbl")
		document.getElementById("cfrTable").submit();
	else
		document.getElementById("cfrResult").submit();
}
