<!-- 
var lr_Browser = new Object();
lr_Browser.isMozilla = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined') && (typeof HTMLDocument!='undefined');
lr_Browser.isIE = window.ActiveXObject ? true : false;
lr_Browser.isOpera = (navigator.userAgent.toLowerCase().indexOf("opera")!=-1);



//Browser Support Code
function ajaxFunction(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		var loading='<span style="background-color:#000;color:#FFF">&nbsp;Loading...&nbsp;</span><br /><br />';
		
		switch (ajaxRequest.readyState) {
			case 0: document.getElementById("print_message").innerHTML = loading; break; 
			case 1: document.getElementById("print_message").innerHTML = loading; break; 
			case 2: document.getElementById("print_message").innerHTML = loading; break; 
			case 3: document.getElementById("print_message").innerHTML = loading; break; 
			case 4: document.getElementById("print_message").innerHTML = ajaxRequest.responseText; document.myForm.reset();
		}//end of switch statement
	}//end of function ajaxRequest.onreadystatechange

	//assigning content of the form ob variables
	var personal_name = document.getElementById("personal_name").value;
	var phone_number = document.getElementById("phone_number").value;
	var company_name = document.getElementById("company_name").value;
	var email = document.getElementById("email").value;
	var message = document.getElementById("message").value;

	//this variable holds all the 
	var str = "personal_name="+personal_name+"&phone_number="+phone_number+"&company_name="+company_name+"&email="+email+"&message="+message+"";
	ajaxRequest.open("POST", "send_message.php", true);
	ajaxRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	ajaxRequest.send(str); 
}



// this makes input field background on
function background_on(o) {
    o.style.backgroundColor = '#E2FFE4';
}


// this makes input field background off
function background_off(o) {
    o.style.backgroundColor = '#FFF';
}


// this makes the tooltip appear onfocus
function tooltip_on(uid, message, s1, s2) {
    o = document.getElementById(uid);
    o.innerHTML = unescape(message);
    o.style.height = s1 + 'px';
    if (lr_Browser.isIE) o.style.height = s2 + 'px';
    o.style.display = 'block';
}

//  this makes the tooltip disappear onblur
function tooltip_off(uid) {
    o = document.getElementById(uid);
    o.style.display = 'none';
}


function isInEmailFormat(val) {
	if (val == "")
		return false;
	else if (val.indexOf("@") != (-1)) {
		var loc_at = val.indexOf("@");
		if ((loc_at != 0) && (val.substr(loc_at-1) != "") && (val.substr(loc_at+1) != "")) {
			var loc_dot = val.lastIndexOf(".");
			if (loc_at < loc_dot) {
				if (val.substr(loc_dot+1) != "")
					return true;
				else
					return false;
			}
			else
				return false;
		}
		else
			return false;
	}
	else
		return false;
}


//check the employer form
function ValidEmplForm () {
	var obj = document.employer_form;
	
	if (obj.contact_name.value.length >= 1) {
		if (obj.position.value.length >= 1)	{
			if(obj.tel_number_1.value.length >= 1) {
				if (isInEmailFormat(obj.email.value)) {
					if (obj.company_name.value.length >= 1) {
						if (obj.company_address.value.length >= 1) {
							if (obj.company_city.value.length >= 1) {
								if (obj.company_country.value.length >= 1) {
									if (obj.represented_by.value.length >= 1) {
										if (obj.job_title.value.length >= 1) {
											if (obj.job_location.value.length >= 1) {
												if (obj.number_vacancies.value.length >= 1) {
													if (obj.working_hours.value.length >= 1) {
														if (obj.currency.value != "") {
															if (obj.period.value != "") {
																if (obj.overtime_hours.value != "") {
																	if (obj.starting_date.value.length >= 1) {
																		if (obj.employment_lenght.value.length >= 1) {
																			if (obj.job_description.value.length >= 1) {
																					obj.submit();
																			}
																			else {alert("Please enter job description!");return false;}
																		}
																		else {alert("Please enter employment lenght for the position!");return false;}
																	}
																	else {alert("Please enter starting date for the position!");return false;}
				
																}
																else {alert("Please specify approx. number of overtime hours per week!");return false;}
															}
															else {alert("Please specify the parameter period in the wage information!");return false;}
															}
														else {alert("Please choose wage currency!");return false;}
													}
													else {alert("Please enter number of working hours per week with overtime included!");return false;}
												}
												else {alert("Please enter the number of people you would like to recruit on this position!");return false;}
											}
											else {alert("Please enter the job location of the position you offer!");return false;}
										}
										else {alert("Please enter the job title of the position you offer!");return false;}
									}
									else {alert("Please enter the name of the person the company is represented by!");return false;}
								}
								else {alert("Please enter the country where the company is located!");return false;}
							}
							else {alert("Please enter the city where the company is located!");return false;}
						}
						else {alert("Please enter the company address!");return false;}
					}
					else {alert("Please enter the name of your company!");return false;}
				}
				else {alert("Your email is not entered or in wrong format!");return false;}
				
			}
			else {alert("Please enter your telephone number!");return false;}
		}
		else {alert("Please enter your position in the company!");return false;} 
	}
	else {
		alert("Please enter contact name!");
		return false;
	}
}// end of function ValidEmplForm ()



//-->
