function company_info(jobId)
{
	document.getElementById('e_'+jobId).style.display = "inline"
	document.getElementById('j_'+jobId).style.display = "none"
}

function job_application(jobId)
{
	document.getElementById('j_'+jobId).style.display = "inline"
	document.getElementById('e_'+jobId).style.display = "none"
}

function details_collapse(jobId)
{
	document.getElementById('j_'+jobId).style.display = "none"
}

function edetails_collapse(jobId)
{
	document.getElementById('e_'+jobId).style.display = "none"
}

function selectAll(totRows)
{
	var theForm = document.frmApplicant;
	for(i=0;i<=totRows;i++) 
	{
		if(!theForm.elements[i].checked)
		{
			theForm.elements[i].checked=true;
			theForm.selAll.checked=true;
		} 
		else
		{ 
			theForm.elements[i].checked=false; 
			theForm.selAll.checked=false;
		}
	} 
}
function validateChoice1(prop1, prop2, prop3, msg) {
 if (document.getElementById(prop1).value=="ALL") {
	document.getElementById(prop2).disabled=true
	document.getElementById(prop3).disabled=true
	alert(msg)
 } else {
	document.getElementById(prop2).disabled=false
	document.getElementById(prop3).disabled=false
 }
}

function validateChoice2(prop1, prop2, msg) {
 if (document.getElementById(prop2).value=="-") {
    alert(msg)
    document.getElementById(prop2).focus()
 }
}

function getDisable(prop1, prop2)
{
 document.getElementById(prop1).disabled=true
 document.getElementById(prop2).disabled=true
}

function getFocus(prop1, prop2)
{
 document.getElementById(prop1).disabled=false
 document.getElementById(prop2).disabled=false
 document.getElementById(prop1).focus()
}
function stateSelection(cntrlName)
  {
	  var out = ''
	  out += "<select name="+cntrlName+" id="+cntrlName+" onblur=\"validateChoice1('sFirst', 'sSecond', 'sThird', 'If you select ALL JOBS in Malaysia as your work location, it automatically includes jobs found in every state. You do not need to select the state again as your alternative option(s).')\">"
	  out += "<option value=\"-\" selected=\"selected\">***** Select Malaysia State *****</option>"
	  out += "<option value=\"JOHOR\">Johor</option>"
	  out += "<option value=\"KEDAH\">Kedah</option>"
	  out += "<option value=\"KUALA LUMPUR\">Kuala Lumpur</option>"
	  out += "<option value=\"KELANTAN\">Kelantan</option>"
	  out += "<option value=\"MELAKA\">Melaka</option>"
	  out += "<option value=\"NEGERI SEMBILAN\">Negeri Sembilan</option>"
	  out += "<option value=\"PENANG\">Pulau Pinang</option>"
	  out += "<option value=\"PAHANG\">Pahang</option>"
	  out += "<option value=\"PERAK\">Perak</option>"
	  out += "<option value=\"PERLIS\">Perlis</option>"
	  out += "<option value=\"SABAH\">Sabah</option>"
	  out += "<option value=\"SELANGOR\">Selangor</option>"
	  out += "<option value=\"SERAWAK\">Sarawak</option>"
	  out += "<option value=\"TERENGGANU\">Terengganu</option>"
	  out += "<option value=\"LABUAN\">Labuan</option>"
	  out += "</select>"
	  document.getElementById(cntrlName).innerHTML = out
  }
function Print() {
document.body.offsetHeight;
window.print();
}

function miniContact() 
{
	document.getElementById("contact").style.display = "inline"
	document.getElementById("sContact").innerHTML = '<a href="javascript:minicollapse();">Close</a>'
}
function minicollapse() 
{
	document.getElementById("contact").style.display = "none"
	document.getElementById("sContact").innerHTML = '<a href="javascript:miniContact();">Suggest</a>'
}
function emailVal(str)
{
	var testresults
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(str)) {
		testresults=true
		document.getElementById('email_f').innerHTML = ''
	}else{
	document.getElementById('email_f').innerHTML = '<font color="Red">Email address is not valid</font>'
	testresults=false
	}
	return (testresults)
}
function trim(str)
{
   return str.replace(/^\s+|\s+$/g,'');
}

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}
function integerVal(str)
{
	if(!isInteger(str))	
	alert("Please input integer!")
}
function pwdCheck(str){
	if(str.length < 6) {
		document.getElementById('pass_f').innerHTML = '<font color="Red">Password must not less than 6 character</font>'
	} else {
		document.getElementById('pass_f').innerHTML = ''
	}
}
function empField(str, loc){
	if(str == '') {
		loc.innerHTML = '<font color="Red">This field should not be empty</font>'
	}else{
		loc.innerHTML = ''
	}
	
}

