
function getAbsX(elt) { return (elt.x) ? elt.x : getAbsPos(elt,"Left"); }
	function getAbsY(elt) { return (elt.y) ? elt.y : getAbsPos(elt,"Top"); }
	
	function getAbsPos(elt,which) {
	iPos = 0;
	while (elt != null) {
	iPos += elt["offset" + which];
	elt = elt.offsetParent;
	}
	return iPos;
	}					

function showPlus(p){
		
	
	 $('#plus_'+p).removeClass('plus');
	 $('#plus_'+p).addClass('plus_over');
	 
	 $('#country_'+p).removeClass('cc');
	 $('#country_'+p).addClass('cc_over');
	 
	
    
    var x = $("#mapContainer").offset().left
    var y = $("#mapContainer").offset().top +  $("#mapContainer").height();
	
	
	var left = getAbsX(document.getElementById("plus_"+p)) - x  + 20;
	var top =  getAbsY(document.getElementById("plus_"+p)) - y ;
 
 
 
	$("#brief"+p).css({'left':left});
	$("#brief"+p).css({'top': top});
	$("#brief"+p).show();
}

function hidePlus(p){
	
	 $('#plus_'+p).removeClass('plus_over');
	 $('#plus_'+p).addClass('plus');
	
	$('#country_'+p).removeClass('cc_over');
	 $('#country_'+p).addClass('cc');
	
	$("#brief"+p).hide();
}



var pastDetails=-1;
function showDetails(p){

	$('#label_'+pastDetails).removeClass('cc_over');
	 $('#label_'+pastDetails).addClass('cc');

 $('#label_'+p).removeClass('cc');
	 $('#label_'+p).addClass('cc_over');
	 
$("#details_"+pastDetails).hide();
$("#details_"+p).show();
pastDetails = p;
	 
}

var currentForm = null;

function validate_career(obj){
	
	 with(obj){

		   
		   if(firstname.value==""){
			alert("Please fill in your firstname");
			return ;
			}
			
		   if(lastname.value==""){
			alert("Please fill in your lastname");
			return ;
			}
			
			
			if(!isEmail(email.value)){
			alert("Please fill in a valid email address");
			return ;
			}
			
			if(telephone.value==""){
			alert("Please fill in your telephone number");
			return ;
				}
			
			if(country.value==""){
			alert("Please select your country");
			return ;
				}
			
			
			
					
			if(cv.value==""){
			alert("Please attach your cv");
			return ;
			}
	}
	
	  
	busy = true;
	currentForm = obj;
	$("#sending").show();
   
	obj.submit();
	  
	  
	  
}


function startUpload(){
		 
    
}

function stopUpload(success){
	busy = false; 
	$("#sending").hide();
    currentForm.reset();
	alert("Application sent");
}



function isEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}



var currentForm2 = null;

function validate_contact(obj){
	
	 with(obj){

		   
		   if(firstname.value==""){
			alert("Please fill in your firstname");
			return ;
			}
			
		   if(lastname.value==""){
			alert("Please fill in your lastname");
			return ;
			}
			
			
			if(!isEmail(email.value)){
			alert("Please fill in a valid email address");
			return ;
			}
			
			if(telephone.value==""){
			alert("Please fill in your telephone number");
			return ;
			}
			
			
			 if(fax.value==""){
			alert("Please fill in your fax number");
			return ;
			}
			
			
			 if(company.value==""){
			alert("Please fill in your company");
			return ;
			}
			
			
			
			if(country.value==""){
			alert("Please select your country");
			return ;
				}
			
			
			if(activity.value==""){
			alert("Please fill in your field of activity");
			return ;
			}
			
			
			
				if(comments.value==""){
			alert("Please fill in your comments");
			return ;
			}
			
			
			
			
			
	}
	
	  

	currentForm2 = obj;
	$("#sending2").show();
   
	obj.submit();
	  
	  
	  
}


function startUpload2(){
		 
    
}

function stopUpload2(success){

	$("#sending2").hide();
    currentForm2.reset();
}


