/* höhe für IE explizit setzen für hauptcontentbereich */
function init(){
	/*if (navigator.appVersion.indexOf("MSIE") != -1) {
		document.getElementById('main_container').style.height = '335px';
	}*/
}
// Images vorladen
function preload_images(preload_img) { 
  if(document.images){ 
  	if(!document.pre) 
		document.pre=new Array();
    	var i,j=document.pre.length;
		for(i=0; i<preload_img.length; i++)
    		if (preload_img[i].indexOf("#")!=0){ 
				document.pre[j] = new Image; 
				document.pre[j++].src = rel_path_prefix+'img/global/'+preload_img[i]+'_rollOver.gif';
			}
	}
}

/* Austauschen von Images per ID und vollständigem Pfad */
function change_image(path, id){
	document.getElementById(id).src = path;
}

/* Mouseoverfunktionen für globale Images */
function nav_mouseover(id) {
	if(id != ''){
		if(document.getElementById(id)){
			document.getElementById(id+"_text").style.color='#EA5D25';
			document.getElementById(id).src = abs_path+'img/button_ak.gif';
		}
	}
}

function nav_mouseout(id) {
	if(id != ''){
		if(document.getElementById(id)){
			document.getElementById(id+"_text").style.color='#666666';
			document.getElementById(id).src = abs_path+'img/button_pa.gif';
		}
	}
}




/* Mouseoverfunktionen für footer navigation */
function btn_mouseover(id, img) {
	if(document.getElementById(id)){
		document.getElementById(id).src = abs_path+'img/'+img+'_ak.gif';
	}
}

function btn_mouseout(id, img) {
	if(document.getElementById(id)){
		document.getElementById(id).src = abs_path+'img/'+img+'_pa.gif';
	}
}


// Austauschen von Etiketthinweisen auf Seite Etikett
function change_content(head, copy) { 
	document.getElementById("headtext").innerHTML=head; 
	document.getElementById("copytext").innerHTML=copy; 
	if(head == "" && copy == ""){
		document.getElementById("etikett").style.visibility='hidden';
	} else {
		document.getElementById("etikett").style.visibility='visible';
	}
}



//Bereich Referenzansicht: auffüllen der projektliste
function addElements(currProject) { 
	//reset list
	while(document.form.pId.length > 0) { 
	   document.form.pId.options[document.form.pId.length - 1] = null; 
	}
	//add head
	element = new Option("Projektauswahl", "", false, true); 
	document.form.pId.options[document.form.pId.options.length] = element;
	//fill projects for selected customer
	var index = 0;
	var count = 0;
	for(x=0;x<customers.length; x++){
		//ist wert des arrays = ausgewählter wert in der liste?...
		if(customers[x]["customer"] == document.form.cId[document.form.cId.selectedIndex].text){
			for(z=0;z<customers[x]["projectList"].length; z++){
				count++;
				element = new Option(customers[x]["projectList"][z]["project"], customers[x]["projectList"][z]["value"], false, true); 
				document.form.pId.options[document.form.pId.options.length] = element;
				if(customers[x]["projectList"][z]["value"] == currProject){
					index = count;
				}
			}
		}
	}
	//set selected index of projects to top
	document.form.pId.selectedIndex = index;
}

// Bereich Referenzansicht: Initialisieren der Auswahllisten
function initList(currCustomer, currProject){
	//add head for customers
	element = new Option("Kunde", "", false, true); 
	document.form.cId.options[document.form.cId.options.length] = element;	
	//add customers to customerlist
	var index = 0;
	var count = 0;
	for(x=0;x<customers.length; x++){
		var insert = false;
		
		for(y=0;y<document.form.cId.length; y++){
			if(document.form.cId.options[y].text == customers[x]["customer"]){
				insert = true;
			}
		}
		
		if(!insert){
			count++;
			element = new Option(customers[x]["customer"], customers[x]["customerValue"], false, true); 
			document.form.cId.options[document.form.cId.options.length] = element;
		}
		
		if(currCustomer == customers[x]["customerValue"]){
			index = count;
		}
	}
	//set selected index of customers to top
	document.form.cId.selectedIndex = index;
	addElements(currProject);
}