function check_special_char_whitout_at(str) {
    var regex=/[\!\#\$\%\^\&\*\+\`\/\[\]\'\"\\]+/g;
    return regex.test(str);
}
//检查EMAIL
function check_email(str) {
    var regex=/[_a-zA-Z\d\-\.]+@[_a-zA-Z\d\-]+(\.[_a-zA-Z\d\-]+)+$/;
    return regex.test(str);
}

function _Function_SendMail() {
    var select = jQuery("#Function_Select option:selected").text();
    if (select=="Please select...") {
        alert ("Please select Function");
        return;
    }
    
    var email = jQuery("#Function_Email").val();
    
    if((check_special_char_whitout_at(email)) || (!check_email(email))){
        alert("Please enter a valid EMAIL address");
        return;
    }

    jQuery.ajax({
        type:"GET",
        url:"function.php?act=function_sendmail",
        data: "select="+select+"&mail="+email,
        dataType:"json",
        success:function(object){
            if (object.msg=="1") {
                alert ("Submit Successfully");
                location.href="starcandidates.html";
            }
        }
    });
}

function _Industry_SendMail() {
    var select = jQuery("#Industry_Select option:selected").text();
    if (select=="Please select...") {
        alert ("Please select Industry");
        return;
    }
    
    var email = jQuery("#Industry_Email").val();
    
    if((check_special_char_whitout_at(email)) || (!check_email(email))){
        alert("Please enter a valid EMAIL address");
        return;
    }
    
    jQuery.ajax({
        type:"GET",
        url:"function.php?act=industry_sendmail",
        data: "select="+select+"&mail="+email,
        dataType:"json",
        success:function(object){
            if (object.msg=="1") {
                alert ("Submit Successfully");
                location.href="hotjobs.html";
            }
        }
    });
}

function _Function_GetReport() {
    var select = jQuery("#Function_GetReport_Select option:selected").text();
    if (select=="Please select...") {
        alert ("Please select Function");
        return;
    }
    
    var email = jQuery("#Function_GetReport_Email").val();
    
    if((check_special_char_whitout_at(email)) || (!check_email(email))){
        alert("Please enter a valid EMAIL address");
        return;
    }
    
    jQuery.ajax({
        type:"GET",
        url:"function.php?act=function_getreport",
        data: "select="+select+"&mail="+email,
        dataType:"json",
        success:function(object){
            if (object.msg=="1") {
                alert ("Submit Successfully");
                jQuery("#Function_GetReport_Email").val("");
            }
        }
    });
}

function _Function_Profiles() {
    var select = jQuery("#Function_Profiles_Select option:selected").text();
    if (select=="Please select...") {
        alert ("Please select Function");
        return;
    }
    
    var email = jQuery("#Function_Profiles_Email").val();
    
    if((check_special_char_whitout_at(email)) || (!check_email(email))){
        alert("Please enter a valid EMAIL address");
        return;
    }
    
    jQuery.ajax({
        type:"GET",
        url:"function.php?act=function_profiles",
        data: "select="+select+"&mail="+email,
        dataType:"json",
        success:function(object){
            if (object.msg=="1") {
                alert ("Submit Successfully");
                jQuery("#Function_Profiles_Email").val("");
            }
        }
    });
}

function _Candidate() {
    var select = jQuery("#Candidate_Select option:selected").text();
    if (select=="Please select...") {
        alert ("Please select Industry");
        return;
    }
    
    var email = jQuery("#Candidate_Email").val();
    
    if((check_special_char_whitout_at(email)) || (!check_email(email))){
        alert("Please enter a valid EMAIL address");
        return;
    }
    
    jQuery.ajax({
        type:"GET",
        url:"function.php?act=candidate",
        data: "select="+select+"&mail="+email,
        dataType:"json",
        success:function(object){
            if (object.msg=="1") {
                alert ("Submit Successfully");
                jQuery("#Candidate_Email").val("");
            }
        }
    });
}

function _Resume_Upload() {
  if ((jQuery("#oText").val())!="") {
    if(confirm('Submit '+(jQuery("#oText").val().substring(jQuery("#oText").val().lastIndexOf("\\")+1))+' ?')) {
       jQuery("#Resume_Form").submit();
    }
  }
}
