function WorkerTabClick(id, eid) {
	var div = document.getElementById('workerContainer');
	var list = document.getElementById('workerMenu');
	var link = document.getElementById('wil_' + id);
	if ((div) && (link) && (list) && (link.className != 'current')) {
		var event = 
			function (result) {
				div.innerHTML = result;
				var items = list.getElementsByTagName('A');
				for (var i = 0; i < items.length; i++) items[i].className = '';
				link.className = 'current';
			} // end event
		HttpRequest(site_path + 'AJAX/GetEmployeeTab.aspx?EmployeeTab=' + id + '&EmployeeID=' + eid, null, 'worker', event);
	} // end if
	return false;
} // end function

function ShowWorkerVacancySubscribeForm(id) {
	var div = document.getElementById('wvsubscribe_div' + id);
	var sendToFriendDiv = document.getElementById('wvac' + id);
	var link = document.getElementById('wvasubscribe' + id);
	if (div && link) {
		if (div.style.display == 'none') {
			if (div.innerHTML.length > 0) {
				div.style.display = 'block';
				sendToFriendDiv.style.display = 'none';
				link.className = 'open';
			} else {
				var event = 
					function (result) {
						div.innerHTML = result;
						div.style.display = 'block';
						sendToFriendDiv.style.display = 'none';
						link.className = 'open';
					} // end event
	    	HttpRequest(site_path + 'AJAX/GetVacancySubscribeForm.aspx', null, 'worker', event);
			} // end if
		} else {
			div.style.display = 'none';
			sendToFriendDiv.style.display = 'block';
			link.className = '';
		} // end if
	} // end if
	return false;
} // end function

function ProcessWorkerFeedbackForm(eid) {
	var div = document.getElementById('workerContainer');
	var form = document.getElementById('workerFeedback');
	
	var data = '';

    data += 'EmployeeID=' + eid + '&';
    data += 'fullname=' + encodeURIComponent(form.fullname.value) + '&';
    data += 'phone=' + encodeURIComponent(form.phone.value) + '&';
    data += 'text=' + encodeURIComponent(form.text.value);
	
	if ((div) && (form)) {
		var event = 
			function (result) {
			    if (result.substr(0, 5) == 'ERROR') {
			        alert(result.substr(5));
			    } else {
				    div.innerHTML = result;
				}
			} // end event
		HttpRequest(site_path + 'AJAX/SendMailToEmployee.aspx', data, 'worker', event);
	} // end if
	return false;
} // end function

function WorkerVacancyMoreClick(id) {
	var dd = document.getElementById('wvacd' + id);
	var divb = document.getElementById('wvacb' + id);
	var divf = document.getElementById('wvacf' + id);
	if ((dd) && (divb) && (divf)) {
		if (divf.style.display == 'none') {
			if (divf.innerHTML.length > 0) {
				dd.className = 'hidemore';
				divb.style.display = 'none';
				divf.style.display = 'block';
			} else {
				var event = 
					function (result) {
						divf.innerHTML = result;
						dd.className = 'hidemore';
						divb.style.display = 'none';
						divf.style.display = 'block';
					} // end event
				HttpRequest(site_path + 'AJAX/GetEmployeeVacancyFull.aspx?VacancyID=' + id, null, 'worker', event);
			} // end if
		} else {
			dd.className = '';
			divf.style.display = 'none';
			divb.style.display = 'block';
		} // end if
	} // end if
	return false;
} // end function

function WorkerVacancyCVclick(id) {
	var div = document.getElementById('wvacv' + id);
	var link = document.getElementById('wvacvl' + id);
	if ((div) && (link)) {
		if (div.style.display == 'none') {
			if (div.innerHTML.length > 0) {
				div.style.display = 'block';
				link.className = 'open';
			} else {
				var event = 
					function (result) {
						div.innerHTML = result;
						div.style.display = 'block';
						link.className = 'open';
					} // end event
				HttpRequest(site_path + 'AJAX/GetVacancyTab.aspx?VacancyID=' + id + '&VacancyTab=Resume', null, 'worker', event);
			} // end if
		} else {
			div.style.display = 'none';
			link.className = '';
		} // end if
	} // end if
	return false;
} // end function

function ProcessSubscribeFormTiny()
{
    var form = document.SubscribeFormTiny;
    
    var data = '';
    
    data += 'email='  + encodeURIComponent(form.email.value) + '&';
    data += 'region=' + encodeURIComponent(form.region.value);
    
	var event = 
		function (result) {
		    if (result.substr(0, 5) == 'ERROR') {
		        alert(result.substr(6));
		    } else {
			    alert(result);
			}
		} // end event
	HttpRequest(site_path + 'AJAX/VacancySubscribeFormTiny.aspx', data, 'vacancies', event);		
	
    return false;
}

