
 
function login_action() {
    $("#alert_text").html("&nbsp;");
    productAction();
    if( /http/.test( $("#login_form").attr("action") ) ) return true; 
    var bdialog = new Boxy("<div><p>Please select a Product!</p></div>", { title: "Select Product", modal: true, closeable: true });
    return false;
}
function productAction() {
   var prod = $("#myproduct").val();
   var newaction = (prod == "Home By Design") ? "https://www.homebydesign.com/cgi-bin/login.pl" :
         (prod == "Your Home and Lifestyle") ? "https://www.yourhomeandlifestyle.com/cgi-bin/login.pl" :
         (prod == "iConnect") ? "https://www.iconnect.bydesignpublishing.com/cgi-bin/login.pl" : "#";
   $("#login_form").attr("action",newaction);
}
function checkforgot() {
    $("#alert_text").html("&nbsp;");
    
    var aid = $("#agentid").val();
    aid = aid.replace(/^\s*/,"");
    aid = aid.replace(/\s*$/,"");
    if(aid == "") {
	$("#alert_text").html("* Agent ID is Required");
        return false;
    }
    var aem = $("#agentemail").val();
    aem = aem.replace(/^\s*/,"");
    aem = aem.replace(/\s*$/,"");
    if(aem == "") {
	$("#alert_text").html("* Email Address is Required");
        return false;
    }
    if( /\D/.test( aid ) ) {
        $("#alert_text").html("* Agent ID is not valid");
        return false;
    }
    var bprod = $("#myproduct").val();
    if( /Select/.test( bprod ) ) {
        $("#alert_text").html("* Product is Required");
        return false;
    }
    $.post("/cgi-bin/forgotpw/forgotpw.pl", $("#pw_form").serialize(),
	    function(data){
       $("#alert_text").html(data);
  } );


    return false;
}

