function PressInfoList(_list, _language){
	var
		index=-1;
	var
		list = _list;
	var
		maxSize = 5;
	var
		imgSrcBackup;
	var
		language=_language;
		
	this.setStartIndex = setStartIndex;
	this.flipLeft = flipLeft;
	this.flipRight = flipRight;
	
	function setStartIndex(_index){
		var
			size = Math.min(list.length, maxSize);
		// update
		var
			i;
			
			if (_index+size>=list.length)
				setContent("pl_idx",(_index+1)+"-"+(list.length));
			else
				setContent("pl_idx",(_index+1)+"-"+(_index+size));

		for (i=0; i < list.length+_index+size; i++){
			if ((i+_index) >= _index+size){
				if(document.getElementById("pl_div_"+(i+_index))!=null)
				document.getElementById("pl_div_"+(i+_index)).style.visibility = 'hidden';
			} else {
				if(list[i+_index]!=null){
				txt=list[i+_index].headline+"<br/><b>"+list[i+_index].text+"</b>";
				    setContent("pl_a2_"+i,txt);
				    document.getElementById("pl_img_"+i).src=list[i+_index].image_target.uri;
				    document.getElementById("pl_a1_"+i).href=list[i+_index].target.uri;
				    document.getElementById("pl_a2_"+i).href=list[i+_index].target.uri;
				    document.getElementById("pl_div_"+i).style.visibility = 'visible';
    				} else {
				    if(document.getElementById("pl_div_"+i)!=null)
				    document.getElementById("pl_div_"+i).style.visibility = 'hidden';
				}
			}
		}
		index = _index;
	}

	function flipLeft(){
		if (index > 0)
			setStartIndex(Math.max(0,index-5));
	}
	
	function flipRight(){
		if (index+maxSize < list.length)
			setStartIndex(index+5);
	}	
}
function JobList(_list, _language, _i18n){
	var
		index=-1;
	var
		list = _list;
	var
		i18n = _i18n;
	var
		maxSize = 8;
	var
		imgSrcBackup;
	var
		language=_language;
		
	this.setStartIndex = setStartIndex;
	this.showDetail = showDetail;
	this.showOverview = showOverview;
	this.flipLeft = flipLeft;
	this.flipRight = flipRight;
	
	function setStartIndex(_index){
		var
			size = Math.min(list.length, maxSize);
		// update
		var
			i;
			
		if (_index+size>=list.length)
			setContent("jl_idx",(_index+1)+"-"+(list.length));
		else
			setContent("jl_idx",(_index+1)+"-"+(_index+size));

		for (i=0; i < maxSize; i+=2){
			if(list[i+_index]!=null){
				txt="<b>"+list[i+_index].position+"</b><br/>";
				if(list[i+_index].country.length>0)
					txt+= i18n["CONTACT_COUNTRY"]+": "+list[i+_index].country+"<br/>";
				if(list[i+_index].area.length>0)
					txt+= i18n["JOBS_AREA"]+": "+list[i+_index].area+"<br/>";
				if(list[i+_index].starting_date.length>0)
					txt+= i18n["JOBS_STARTING_DATE"]+": "+list[i+_index].starting_date+"<br/>";
				if(list[i+_index].from.length>0)
					txt+= i18n["JOBS_FROM"]+": "+list[i+_index].from+"<br/>";
				if(list[i+_index].job_number.length>0)
					txt+= i18n["JOBS_NUMBER"]+": "+list[i+_index].job_number+"<br/>";
				if(list[i+_index].position.length>0){
					txt+= "<a href=\"javascript:jl.showDetail("+(i+_index)+",false);\"><b>"+i18n["JOBS_INFORMATION"]+"</b></a><br />";
					txt+= "<a href=\"javascript:jl.showDetail("+(i+_index)+",true);\"><b>"+i18n["JOBS_APPLICATION"]+"</b></a><br />";
				}
			if(list[i+_index].position.length>0 && ["PDF_DOWNLOAD_LINK"].length>0){
					txt+= "<a href=\""+i18n["PDF_DOWNLOAD_LINK"]+"\"><b>"+i18n["PDF_DOWNLOAD"]+"</b></a><br />";					
			}
				setContent("jl_b1_"+i,txt);
			} else {
				setContent("jl_b1_"+i,"");
			}
			if(list[i+_index+1]!=null){
				txt="<b>"+list[i+_index+1].position+"</b><br/>";
				if(list[i+_index+1].country.length>0)
					txt+= i18n["CONTACT_COUNTRY"]+": "+list[i+_index+1].country+"<br/>";
				if(list[i+_index+1].area.length>0)
					txt+= i18n["JOBS_AREA"]+": "+list[i+_index+1].area+"<br/>";
				if(list[i+_index+1].starting_date.length>0)
					txt+= i18n["JOBS_STARTING_DATE"]+": "+list[i+_index+1].starting_date+"<br/>";
				if(list[i+_index+1].from.length>0)
					txt+= i18n["JOBS_FROM"]+": "+list[i+_index+1].from+"<br/>";
				if(list[i+_index+1].job_number.length>0)
					txt+= i18n["JOBS_NUMBER"]+": "+list[i+_index+1].job_number+"<br/>";		
				if(list[i+_index+1].position.length>0){
					txt+= "<a href=\"javascript:jl.showDetail("+(i+_index+1)+",false);\"><b>"+i18n["JOBS_INFORMATION"]+"</b></a><br />";
					txt+= "<a href=\"javascript:jl.showDetail("+(i+_index+1)+",true);\"><b>"+i18n["JOBS_APPLICATION"]+"</b></a><br />";
				}
				if(list[i+_index+1].position.length>0 && ["PDF_DOWNLOAD_LINK"].length>0){
						txt+= "<a href=\""+i18n["PDF_DOWNLOAD_LINK"]+"\"><b>"+i18n["PDF_DOWNLOAD"]+"</b></a><br />";					
				}

				setContent("jl_b2_"+(i+1),txt);
			} else {
				setContent("jl_b2_"+(i+1),"");
			}
			if(list[i+_index]==null && list[i+_index+1]==null){
				if(document.getElementById("jl_div_"+i)!=null)
					document.getElementById("jl_div_"+i).style.visibility = 'hidden';
			} else {
				if(document.getElementById("jl_div_"+i)!=null)
					document.getElementById("jl_div_"+i).style.visibility = 'visible';
			}
		}
		index = _index;
		debug(_index+" / "+index+" / "+maxSize+" / "+ list.length);
	}
	function showDetail(_id,_form){
		if (_form)
			req.setState('show_job_request');
			
		setDisplayBlockOrNoneById('karriere',false);
			if(list[_id]!=null){
				jobtxt="<b>"+list[_id].position+"</b><br/>";
				if(list[_id].country.length>0)
					jobtxt+= i18n["CONTACT_COUNTRY"]+": "+list[_id].country+"<br/>";
				if(list[_id].area.length>0)
					jobtxt+= i18n["JOBS_AREA"]+": "+list[_id].area+"<br/>";
				if(list[_id].starting_date.length>0)
					jobtxt+= i18n["JOBS_STARTING_DATE"]+": "+list[_id].starting_date+"<br/>";
				if(list[_id].from.length>0)
					jobtxt+= i18n["JOBS_FROM"]+": "+list[_id].from+"<br/>";
				if(list[_id].job_number.length>0)
					jobtxt+= i18n["JOBS_NUMBER"]+": "+list[_id].job_number+"<br/>";

				txt="<b>"+list[_id].position+"</b><br/>";
				if(list[_id].position_description.length>0)
					txt+="<br/>"+list[_id].position_description.replace(/  /g,"&nbsp;&nbsp;").replace(/\n/g,"<br />")+"<br />";
				if(list[_id].requirements.length>0)
					txt+="<br/><b>"+i18n["JOBS_REQUIREMENTS"]+"</b><br/>"+list[_id].requirements.replace(/  /g,"&nbsp;&nbsp;").replace(/\n/g,"<br />");
				txt+="<br/><br/>";
				if(list[_id].country.length>0)
					txt+= "<b>"+i18n["CONTACT_COUNTRY"]+":</b> "+list[_id].country+"<br/>";
				if(list[_id].area.length>0)
					txt+= "<b>"+i18n["JOBS_AREA"]+":</b> "+list[_id].area+"<br/>";
				if(list[_id].starting_date.length>0)
					txt+= "<b>"+i18n["JOBS_STARTING_DATE"]+":</b> "+list[_id].starting_date+"<br/>";
				if(list[_id].from.length>0)
					txt+= "<b>"+i18n["JOBS_FROM"]+":</b> "+list[_id].from+"<br/>";
				if(list[_id].job_number.length>0)
					txt+= "<b>"+i18n["JOBS_NUMBER"]+":</b> "+list[_id].job_number+"<br/>";
				if(list[_id].contact.length>0)
					txt+="<br/><b>"+i18n["JOBS_CONTACT_PERSON"]+"</b><br/>"+list[_id].contact+"<br />";					
				txt+="<br/>"
				if(list[_id].telefon.length>0)
					txt+= "Tel.: "+list[_id].telefon+"<br/>";
				if(list[_id].mail.length>0)
					txt+= i18n["CONTACT_EMAIL"]+": <a class=\"mailto\" href=\"mailto:"+list[_id].mail+"\">"+list[_id].mail+"</a>";
				if(list[_id].website.length>0){
					if (list[_id].website.indexOf(".siematic.")>-1) {
						txt += "<br />"+list[_id].website;
						} else if (list[_id].website.indexOf("http://")>-1) {
							txt += "<br /><a href=\""+list[_id].website+"\" target=\"_blank\">"+list[_id].website+"</a>";
						} else {
							txt += "<br /><a href=\"http://"+list[_id].website+"\" target=\"_blank\">"+list[_id].website+"</a>";
						}
					}
				txt+="<br/><br/>"
				setValueById('form_application', jobtxt);
				setValueById('form_name_recipient',list[_id].mail);
				setValueById('form_email_recipient',list[_id].mail);				
				setContent("detail_text",txt);
				setContent("job_text1",jobtxt);
				setContent("job_text2",jobtxt);
			} else {
				setContent("detail_text","");
			}
		setDisplayBlockOrNoneById('karriere_detail',true);		
	}
	function showOverview(){
		req.setState('hide_job_request');
		setDisplayBlockOrNoneById('karriere',true);
		setDisplayBlockOrNoneById('karriere_detail',false);		
	}
	function flipLeft(){
		if (index > 0)
			setStartIndex(index-8);
	}
	
	function flipRight(){
		if (index+maxSize < list.length)
			setStartIndex(index+8);
	}	
}