function applicant_status_tabs(obj) {

	var tab = new Array();

	tab[0] = document.getElementById('active_applicants_tab');
	tab[1] = document.getElementById('unsuccessful_applicants_tab');
	tab[2] = document.getElementById('hired_applicants_tab');
	tab[3] = document.getElementById('manager_tab');
	tab[4] = document.getElementById('report_tab');
	//alert(obj.id);
	for ( i=0 ; i < tab.length ; i++) {
	
		if(tab[i].id == obj.id) {
			tab[i].style.backgroundColor='#FFFFFF';
			tab[i].style.borderColor='#999999 #999999 #FFFFFF #999999';
		} else {
			tab[i].style.backgroundColor='#F1F1F1';
			tab[i].style.borderColor='#999999';
		}
	}
}

function applicant_dashboard_tabs(obj) {

	var tab = new Array();
	
	tab[0] = document.getElementById('requirements_tab');
	tab[1] = document.getElementById('my_status_tab');
	tab[2] = document.getElementById('correspondence_tab');
	tab[3] = document.getElementById('profile_tab');
	//alert(obj.id);
	for ( i=0 ; i < tab.length ; i++) {
	
		if(tab[i].id == obj.id) {
			tab[i].style.backgroundColor='#FFFFFF';
			tab[i].style.borderColor='#999999 #999999 #FFFFFF #999999';
		} else {
			tab[i].style.backgroundColor='#F1F1F1';
			tab[i].style.borderColor='#999999';
		}
	}
}

function admin_sub_tabs(obj) {
	var tab = new Array();
	
	tab[0] = document.getElementById('admin_edit_profile_tab');
	tab[1] = document.getElementById('admin_create_new_admin_tab');
	tab[2] = document.getElementById('admin_edit_exam_tab');
	tab[3] = document.getElementById('admin_edit_email_tab');
	tab[4] = document.getElementById('admin_edit_requirement');
	tab[5] = document.getElementById('admin_edit_configurations');
	//alert(obj.id);
	for ( i=0 ; i < tab.length ; i++) {
	
		if(tab[i].id == obj.id) {
			tab[i].style.textDecoration='underline';
		} else {
			tab[i].style.textDecoration='none';
		}
	}
}

function confirm_passwords(passwd1,passwd2) {
	password1 = document.getElementById(passwd1).value;
	password2 = document.getElementById(passwd2).value;
	
	if(password1 != password2) {
		alert("Passwords do not match. Please type again.");
		return false;
	} else {
		return true;
	}
}


function popup_status_legend(page,height,width) {
	window.open (page,"Status Legend","status=0,toolbar=0, resizable=0, height=" + height + ", width=" + width + ", location=0");
}

function toggle_show_hide_div(obj,height) {

	if(document.getElementById(obj).style.visibility == 'hidden') {
		document.getElementById(obj).style.visibility = 'visible';
		document.getElementById(obj).style.height = height+'px';
	} else {
		document.getElementById(obj).style.visibility = 'hidden'
		document.getElementById(obj).style.height = '0px';
	}
}

function toggle_enable_disable_medical_related_transcription(obj, is_disabled) {
	
	element = document.getElementById(obj);
	element.disabled = is_disabled;
	
}

function toggle_enable_disable_medical_related_transcription2(obj, is_disabled) {
	//alert("ryanqqqqqqqqqqqqq");
	//alert(obj);
	//element2 = document.getElementById(obj);
	//element.disabled = is_disabled;
	//alert(document.f_application.f_stenotype.length);
	for (i=0; i < document.f_application.f_stenotype.length; i++) 
		document.f_application.f_stenotype[i].disabled = is_disabled;
		//alert("ryan");
	
}


function toggle_enable_disable_submit_button_application_page(obj, alertmsg, page) {
	
	broadband = getRadioCheckedValue( document.getElementsByName('f_broadband') );
	windows = getRadioCheckedValue( document.getElementsByName('f_windows') );
	availability = getRadioCheckedValue( document.getElementsByName('f_availability') );
	pc_compatible = getRadioCheckedValue( document.getElementsByName('f_pc') );
	contact = getRadioCheckedValue( document.getElementsByName('f_availability_contact') );
	
	if(obj.value == 'N')
	{
		
		if( alertmsg != null) 
		{
			alert( alertmsg ); 
		}
		
		if( (broadband != 'Y') && (windows != 'Y') && (availability != 'Y') && (pc_compatible != 'Y') && (contact != 'Y') ) 
		{
			document.getElementById("f_next_page").disabled=true; 
			document.getElementById("submit_status").innerHTML = "<b>You cannot continue with this application as you are not willing to comply with our compulsory requirements. We encourage you to re-apply once you can meet all compulsory requirements.</b>";
			if (page != null)
			{
				document.getElementById("f_previous_page").disabled=true;	
			}
		} 
		else if( (broadband == 'Y') && (windows == 'Y') && (availability == 'Y') && (pc_compatible == 'Y') && (contact == 'Y') ) 
		{
			document.getElementById("f_next_page").disabled=false;
			document.getElementById("submit_status").innerHTML="";
			if (page != null)
			{
				document.getElementById("f_previous_page").disabled=false;	
			}
		} 
		else 
		{
			document.getElementById("f_next_page").disabled=true; 
			document.getElementById("submit_status").innerHTML = "<b>You cannot continue with this application as you are not willing to comply with our compulsory requirements. We encourage you to re-apply once you can meet all compulsory requirements.</b>";
			if (page != null)
			{
				document.getElementById("f_previous_page").disabled=true;	
			}
		}
		
	}
	else
	{
		document.getElementById("f_next_page").disabled=false;
		document.getElementById("submit_status").innerHTML="";
		if (page != null)
		{
			document.getElementById("f_previous_page").disabled=false;	
		}
	}
}

function getRadioCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

function report_tabs(obj) {

	var tab = new Array();

	tab[0] = document.getElementById('experience_report_tab');
	tab[1] = document.getElementById('contractor_details_report_tab');
	tab[2] = document.getElementById('quality_assurance_exam_report_tab');
	//alert(obj.id);
	for ( i=0 ; i < tab.length ; i++) {
	
		if(tab[i].id == obj.id) {
			tab[i].style.backgroundColor='#FFFFFF';
			tab[i].style.borderColor='#999999 #999999 #FFFFFF #999999';
		} else {
			tab[i].style.backgroundColor='#F1F1F1';
			tab[i].style.borderColor='#999999';
		}
	}
}

