subroles=new Array();
subroles[0]=[['0','Choose One']];
subroles[1]=[['0','Choose One'],['1','IT'],['2','Business Development'],['3','Finance'],['4','Human Resources'],['5','Legal'],['6','Marketing'],['7','Operations'],['8','Product'],['9','Recruiter'],['10','R&D'],['11','Sales'],['12','Strategy/Executive Oversight']];
subroles[2]=[['0','Choose One'],['13','Architect'],['14','Development/Software Engineering'],['15','Functional/System Analysis'],['16','Network Administration'],['17','Project Management'],['18','Quality Assurance (QA)'],['19','Security'],['20','Support/Help Desk'],['21','System Administration'],['22','Training'],['23','All IT Areas']];
subroles[3]=[['0','Choose One'],['24','Functional/System Analysis'],['25','Network Administration'],['26','Project Management'],['27','Quality Assurance (QA)'],['28','Security'],['29','Support/Help Desk'],['30','System Administration'],['31','Training'],['32','All IT Areas']];
subroles[4]=[['0','Choose One'],['33','Architect'],['34','Development/Software Engineering']];
subroles[5]=[['0','Choose One'],['35','Business Development'],['36','Finance/Accounting'],['37','Human Resources'],['38','Legal'],['39','Marketing'],['40','Operations'],['41','Product'],['42','Recruiter'],['43','R&D'],['44','Sales'],['45','Strategy']];
subroles[6]=[['0','Choose One'],['46','Business Development'],['47','Finance/Accounting'],['48','Human Resources'],['49','Legal'],['50','Marketing'],['51','Operations'],['52','Product'],['53','Recruiter'],['54','R&D'],['55','Sales'],['56','Strategy']];
subroles[7]=[['0','Choose One'],['57','MIS'],['58','Computer Science'],['59','Business'],['60','Science'],['61','Art'],['62','Other'],['63','MBA'],['64','PHD']];

function populate_subroles(roleid)
{
	if(subroles[roleid]){
		sr=subroles[roleid];
		obj_subrole=$('subrole');
		obj_subrole.selectedIndex=0;
		obj_subrole.options.length=sr.length;
		for(i=0;i<sr.length;i++){
			obj_subrole.options[i].value=sr[i][0];
			obj_subrole.options[i].text=sr[i][1];
		}
	}
}

function sthChecked(list)
{
	var ret=false;
	checkboxlist=document.getElementsByName(list);
	for(i=0;i<checkboxlist.length;i++){
		if(checkboxlist[i].checked){
			ret=true;
			break;
		}
	}
	return ret;
}

function showhide_country_list(show_flag) {
	country = $('country_list');
	link = $('not_uscan');
	use_country = $('use_country');

	if (show_flag) {
		link.style.visibility = 'hidden';
		link.style.display = 'none';
		country.style.visibility = 'visible';
		country.style.display = 'block';
		use_country.value = '1';
	}
	else {
		link.style.visibility = 'visible';
		link.style.display = 'block';
		country.style.visibility = 'hidden';
		country.style.display = 'none';
		use_country.value = '0';
	}
}

function get_verification_code(id) {
	var img_security = $(id);
	var randomnumber=Math.floor(Math.random()*101)+'';
	img_security.src = '/captcha.php?' + randomnumber;
}

var country=0;

function country_postal_check(select)
{
	if($('select_country')){
		country=($('select_country').options[$('select_country').selectedIndex].value);
		if(country==0||country==22){
			$('tr_us_canada').style.display="none";
			$('tr_other').style.display="none";
		}
		else if(country==1){
			$('tr_us_canada').style.display="";
			$('tr_other').style.display="none";
			$('select_city_state').innerHTML='<select name="city_state" id="city_state" disabled><option>Enter valid postal code</option></select>\n';
		}
		else if(country==2){
			$('tr_us_canada').style.display="";
			$('tr_other').style.display="none";
			$('select_city_state').innerHTML='<select name="city_state" id="city_state" disabled><option>Enter valid postal code</option></select>\n';
		}
		else if(country==3){
			$('tr_us_canada').style.display="none";
			$('tr_other').style.display="";
			if(select)
				select='&select='+select;
			else
				select='';
			gethtml('select_state','action=postal&country=3'+select);
		}
		else{
			$('tr_us_canada').style.display="none";
			$('tr_other').style.display="";
			$('select_state').innerHTML='<select name="state" id="state" disabled><option>Not Required</option></select>\n';
		}
	}
	if($('company_zipcode')){
		if(country==1&&$('company_zipcode')&&/^\ *[0-9]{5}\ *$/.test($('company_zipcode').value)||country==2&&/^\ *[A-Z][0-9][A-Z]\ ?[0-9][A-Z][0-9]\ *$/i.test($('company_zipcode').value)){
			if(select)
				select='&select='+select;
			else
				select='';
			gethtml('select_city_state','action=postal&country='+country+'&code='+$('company_zipcode').value+select);
		}
	}
}

function loginchk(id)
{
	gethtml('loginchk','action=loginchk&username='+id);
}
