
/*function countIndustries(){
    var chk_length=document.frm_register.co_industry.length;
    var count=0;
    var hdn_ind='';
    for(var i=0;i<chk_length;i++){
        if(document.frm_register.co_industry[i].checked==true){
            var count=count+1;
            hdn_ind+=document.frm_register.co_industry[i].value+',';
        }
        if(count>5){
            //alert("You can not choose more than five industry.");industries_field label
            document.frm_register.co_industry[i].checked=false;
            document.getElementById('co_industry_error').innerHTML='You can not select more than five industries.';
            document.getElementById('co_industry_error').style.display='block';
            return false;
        }
        else{
            document.getElementById('co_industry_error').style.display='none';
        }
            document.getElementById('selectcount').innerHTML='Select '+count+' out of 5';
            document.getElementById('hdn_ind').value=hdn_ind;
    }
}*/
function countIndustries(error_msg){
    //var chk_length=document.frm_register.co_industry.length;
    var count=0;
    var hdn_ind='';
    for(var i=1;i<=81;i++){
        if(document.getElementById('co_industry_'+i).checked==true){
            var count=count+1;
            hdn_ind+=document.getElementById('co_industry_'+i).value+',';
        }
        if(count>5){
            //alert("You can not choose more than five industry.");industries_field label
            document.getElementById('co_industry_'+i).checked=false;
            document.getElementById('co_industry_error').innerHTML=error_msg;
            document.getElementById('co_industry_error').style.display='block';
            return false;
        }
        else{
            document.getElementById('co_industry_error').style.display='none';
        }
            document.getElementById('selectcount').innerHTML='Select '+count+' out of 5';
            document.getElementById('hdn_ind').value=hdn_ind.substr(0,(hdn_ind.length)-1);
    }
}
/*function countIndustries(obj){
        //var chk_length=document.frm_register.co_industry.length;
        var selectcount = document.getElementById('selectcount');
        var numberChecked = parseInt(selectcount.innerHTML);
        var hdn_ind='';
        numberChecked = (obj.checked) ? ++numberChecked : --numberChecked;
        if(numberChecked > 5){
            document.getElementById('co_industry_error').innerHTML='You can not select more than five industries.';
            document.getElementById('co_industry_error').style.display='block';
            obj.checked = false;
            numberChecked--;
        }
        else{
            document.getElementById('co_industry_error').innerHTML='Please select atleast one industry and atmost five industries.';
            document.getElementById('co_industry_error').style.display='none';
        }
        selectcount.innerHTML = numberChecked;
        numberChecked = 0;
    } */

function confirmDelete(msg) {
    var getConfirm=confirm(msg);
    return getConfirm;
}
function addMoreStep() {
    var startValue=parseInt(document.getElementById('next_step').value);
    if(!startValue || startValue<6){
        startValue=6;
    }
    var nextCountValue=parseInt(document.getElementById('step_count').value)+1;
    var htmlValue='';
    for (var i=startValue;i<=nextCountValue;i++) {
        var levelValue='';
        if(document.getElementById('hiring_level_'+i)) {
            levelValue=document.getElementById('hiring_level_'+i).value; 
        }
        var htmlValue = htmlValue+"<div class='common_row'><div class='left_column'>Hiring Step "+i+":</div><div class='right_column'><input type='text' class='job_create_input' id='hiring_level_"+i+"' name='hiring_level_"+i+"' value='"+levelValue+"'/></div></div>";
    }
    document.getElementById('more_step_div').innerHTML=htmlValue;
    document.getElementById('step_count').value=nextCountValue;
}
function goDashBoard(siteUrl) {
window.location=siteUrl+"employer/dashboard";
}
function isValidUrl(url) {
    var pattern = new RegExp(/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i);
    return pattern.test(url);
}
function isValidEmailAddress(emailAddress) {
    var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
    return pattern.test(emailAddress);
}
function isValidDigit(digit) {
    var pattern = new RegExp(/^\d+$/);
    return pattern.test(digit);
}
function isValidAlpha(string) {
    var pattern = new RegExp(/^[a-zA-Z ]+$/);
    return pattern.test(string);
}
function moveToPage(siteUrl,page) { 
window.location=siteUrl+page;
}
function popUpLoad(url){
    testwindow= window.open (url, "mywindow","menubar=0,resizable=0,location=1,status=1,scrollbars=1,width=500,height=300");
    testwindow.moveTo(0,0);
}
