function set_tabMenu(divName, tabName, Id, tabCount){
	try {
		var iTab = 1
		while(iTab <= tabCount){
			if(document.getElementById(divName + iTab) != null && document.getElementById('tabMenu_Tab' + iTab) != null){
				document.getElementById(divName + iTab).style.display = 'none';
				document.getElementById(tabName + iTab).className = '';
			}
			iTab++
		}
		document.getElementById(divName + Id).style.display = 'block';
		document.getElementById(tabName + Id).className = 'active';
	}
	catch(e){}
}

function characterCount(elem, maxLen){
	if(!maxLen) maxLen = elem.maxLength
	var txtLength = maxLen - elem.value.length;
	if(txtLength <= 0) {
		txtLength=0;
		elem.value = elem.value.substr(0, maxLen);
	}
	document.getElementById(elem.name + '_charCount').innerHTML = txtLength + ' character' + (txtLength!=1?'s':'') + ' remaining'
}

function portfolioGalleryView(pic){
	var galleryPicWin = window.open('/_images/portfolio_view.asp?img='+pic, 'galleryPicWin', 'location=0,status=0,scrollbars=0,menubar=0,resizable=1,left=20,top=20,width=500,height=500');
	try{galleryPicWin.focus()}catch(e){}
	return false;
}

function toggle_quick_discipline(elem){
	// 1 = Make Up Professionals
	// 2 = Jobs
	// 3 = Courses
	// 4 = Employers
	// 5 = Suppliers
	switch(parseInt(elem[elem.selectedIndex].value)){
		case 5:
			var frmSrc = document.forms['frm-quick-search'].elements['search_discipline_supplier'];
			break;
		default:
			var frmSrc = document.forms['frm-quick-search'].elements['search_discipline_standard'];
	}
	var frmDest = document.forms['frm-quick-search'].elements['search_discipline'];
		frmDest.length = frmSrc.length;
		frmDest.selectedIndex=0;
		for(i=0;i<frmSrc.length;i++){
			frmDest[i].value=frmSrc[i].value;
			frmDest[i].text=frmSrc[i].text;
		}
}

function toggle_discipline(elem){
	// 1 = Make Up Professionals
	// 2 = Jobs
	// 3 = Courses
	// 4 = Employers
	// 5 = Suppliers
	switch(parseInt(elem[elem.selectedIndex].value)){
		case 5:
			show_discipline(false);
			document.getElementById('tr_search_discipline').style.visibility='hidden';
			toggle_speciality(null, 3)
			show_experience(false);
			break;
		case 3:
		case 4:
			show_discipline(true);
			toggle_speciality(null, 0)
			show_experience(false);
			break;
		default:
			show_discipline(true);
			toggle_speciality(null, 0)
			show_experience(true);
	}
}

function show_discipline(bDisp){
	document.getElementById('tr_search_discipline').style.visibility=(bDisp?'visible':'hidden');
}

function toggle_speciality(elem, elemIndx){
	if(elem) elemIndx = elem.selectedIndex;
	var oDisp=0;
	while(document.getElementById('div_search_discipline_'+oDisp)){document.getElementById('div_search_discipline_'+oDisp).style.display='none';oDisp++;}
	document.getElementById('div_search_discipline_'+elemIndx).style.display='block';
}

function show_experience(bDisp){
	document.getElementById('tr_search_experience').style.visibility=(bDisp?'visible':'hidden');
}

var bReportFormView = false;
function toggle_reportForm(){
	bReportFormView=!bReportFormView
	document.getElementById('report-form-div').style.display=(bReportFormView?'block':'none')
}

function add_favourite(){
	document.forms['favourite-form'].submit();
	return false;
}
function manage_favourite(favArea, favId){
	var favFrm = document.forms['manage-favourites'];
	favFrm.elements['favourite'].value = favArea;
	favFrm.elements['id'].value = favId;
	favFrm.submit();
	return false;
}

