var breite = 0; 
var aktiv;
var previousActiveTab;
var NeuesFenster;

function NewWin (Adresse) {
	NeuesFenster = window.open(Adresse, "NewWin", "width=620,height=580,left=5,top=5,scrollbars=yes,dependent=yes");
	NeuesFenster.focus();
}

function NewWinOrder (Adresse) {
	NeuesFenster = window.open(Adresse, "NewWin", "width=750,height=580,left=5,top=5,scrollbars=yes,dependent=yes");
	NeuesFenster.focus();
}

function goto_url(str_url){
	document.location.href=str_url;
}

function show_description () {
	dv_description = document.getElementById("description");
	if (dv_description.style.display != "block"){
		dv_description.style.display = "block";
	}else{
		dv_description.style.display = "none";
	}
}

function preload() {
  for(var img, i = 0; i < arguments.length; i++) {
    img = new Image;
    img.src = arguments[i];
  }
}

function tdMouseOver (tID) {
	tc_a_ID = document.getElementById("tc_a_"+tID);
	tc_b_ID = document.getElementById("tc_b_"+tID);
	tc_c_ID = document.getElementById("tc_c_"+tID);
	tc_d_ID = document.getElementById("tc_d_"+tID);
	tc_e_ID = document.getElementById("tc_e_"+tID);
	tc_f_ID = document.getElementById("tc_f_"+tID);
	tc_g_ID = document.getElementById("tc_g_"+tID);
	tc_h_ID = document.getElementById("tc_h_"+tID);
	tc_i_ID = document.getElementById("tc_i_"+tID);
	
	if (tc_a_ID){tc_a_ID.style.backgroundColor = "#f0f0f0";}
	if (tc_b_ID){tc_b_ID.style.backgroundColor = "#f0f0f0";}
	if (tc_c_ID){tc_c_ID.style.backgroundColor = "#f0f0f0";}
	if (tc_d_ID){tc_d_ID.style.backgroundColor = "#f0f0f0";}
	if (tc_e_ID){tc_e_ID.style.backgroundColor = "#f0f0f0";}
	if (tc_f_ID){tc_f_ID.style.backgroundColor = "#f0f0f0";}
	if (tc_g_ID){tc_g_ID.style.backgroundColor = "#f0f0f0";}
	if (tc_h_ID){tc_h_ID.style.backgroundColor = "#f0f0f0";}
	if (tc_i_ID){tc_i_ID.style.backgroundColor = "#f0f0f0";}
	
}

function tdMouseOut (tID) {
	tc_a_ID = document.getElementById("tc_a_"+tID);
	tc_b_ID = document.getElementById("tc_b_"+tID);
	tc_c_ID = document.getElementById("tc_c_"+tID);
	tc_d_ID = document.getElementById("tc_d_"+tID);
	tc_e_ID = document.getElementById("tc_e_"+tID);
	tc_f_ID = document.getElementById("tc_f_"+tID);
	tc_g_ID = document.getElementById("tc_g_"+tID);
	tc_h_ID = document.getElementById("tc_h_"+tID);
	tc_i_ID = document.getElementById("tc_i_"+tID);
	
	if (tc_a_ID){tc_a_ID.style.backgroundColor = "#ffffff";}
	if (tc_b_ID){tc_b_ID.style.backgroundColor = "#ffffff";}
	if (tc_c_ID){tc_c_ID.style.backgroundColor = "#ffffff";}
	if (tc_d_ID){tc_d_ID.style.backgroundColor = "#ffffff";}
	if (tc_e_ID){tc_e_ID.style.backgroundColor = "#ffffff";}
	if (tc_f_ID){tc_f_ID.style.backgroundColor = "#ffffff";}
	if (tc_g_ID){tc_g_ID.style.backgroundColor = "#ffffff";}
	if (tc_h_ID){tc_h_ID.style.backgroundColor = "#ffffff";}
	if (tc_i_ID){tc_i_ID.style.backgroundColor = "#ffffff";}
	
}

function add_to_cart (a) {
	
	frm_add_to_cart.a.value = a;
	frm_add_to_cart.fromURL.value = ""+window.location;
	frm_add_to_cart.submit();

}


function add_to_cart2 (t1,h1) {
	
	frm_add_to_cart.t1.value = t1;
	frm_add_to_cart.h1.value = h1;
	frm_add_to_cart.fromURL.value = ""+window.location;
	frm_add_to_cart.submit();

}



function selTab(tabNumber) {
	
	tb_a_ID = document.getElementById("tb_"+(parseInt(tabNumber)-1));
	tb_b_ID = document.getElementById("tb_"+tabNumber);
	tb_c_ID = document.getElementById("tb_"+(parseInt(tabNumber)+1));
	if (!document.getElementById("tb_"+(parseInt(tabNumber)+2))){
		var last_tab = 1;
	}
	dvID = document.getElementById("dv_"+tabNumber);
	
	if (parseInt(previousActiveTab) > 0){
		prev_a_ID = document.getElementById("tb_"+(parseInt(previousActiveTab)-1));
		prev_b_ID = document.getElementById("tb_"+previousActiveTab);
		prev_c_ID = document.getElementById("tb_"+(parseInt(previousActiveTab)+1));
		prev_dvID = document.getElementById("dv_"+previousActiveTab);
		if (parseInt(previousActiveTab) == 2){
			prev_a_ID.className = "";
		}else{
			prev_a_ID.className = tabSplit;
		}
		prev_b_ID.className = "tab_unsel";
		
		if (!document.getElementById("tb_"+(parseInt(previousActiveTab)+2))){
			prev_c_ID.className = "";
		}else{
			prev_c_ID.className = tabSplit;
		}
		prev_dvID.style.display = "none";
	}
	
	if (parseInt(tabNumber) == 2){
		tb_a_ID.className = "tab_sel_l_outer";
	}else{
		tb_a_ID.className = tabSelL;
	}
	tb_b_ID.className = "tab_sel_m";
	if (last_tab == 1){
		tb_c_ID.className = "tab_sel_r_outer";
	}else{
		tb_c_ID.className = tabSelR;
	}
	
	previousActiveTab = tabNumber;
	dvID.style.display = "block";
}

function ShowDetails (sTarget,hText) {
	document.body.style.overflow = "hidden";
	
	ifrID = document.getElementById("ifrInfo");
	dvID = document.getElementById("dvDetails");
	dvDarkenID = document.getElementById("dvDarken");
	dvInfoID = document.getElementById("dvInfo");
	dvInfoID.innerText = hText;
		
	var body = (window.document.compatMode && window.document.compatMode == "CSS1Compat") ? window.document.documentElement : window.document.body || null; 
   
  var win_h = (window.innerHeight || parseInt(body.clientHeight )) / 2; 
  var win_w = (window.innerWidth || parseInt(body.clientWidth)) / 2; 
  var dv_height = 580/2;
  var dv_width = 775/2;
  var t = win_h - dv_height + parseInt(window.pageYOffset || body.scrollTop) ; 
  var l = win_w  - dv_width  + parseInt(window.pageXOffset || body.scrollLeft); 
 	
 	if (t < 0){t=0;}
  
  window.addEvent('domready', function() {
		$('dvDarken').setStyle('opacity', 0.7); 
	});
	var x =  document.body.clientWidth/2 - 310;
	
	dvID.style.left = l +"px";
	dvID.style.top = t +"px";
	
	ifrID.src = sTarget;
	
	dvID.style.display = "block";
	
	
}

function HideDetails () {
	document.body.style.overflow = "visible";
	dvID = document.getElementById("dvDetails");
	ifrID = document.getElementById("ifrInfo");
	dvDarkenID = document.getElementById("dvDarken");
	
	ifrID.src = "";
	window.addEvent('domready', function() {
		$('dvDarken').setStyle('opacity', 0);
		$('dvDetails').setStyle('display', 'none');
	}); 
	 
  
}

function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpacDown(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        }
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpacUp(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 

//change the opacity for different browsers 
function changeOpacUp(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
    if (opacity >= 100){
    	object.removeAttribute('filter'); 
 	 }
} 

function changeOpacDown(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
    if (opacity < 1){
    	dvID = document.getElementById(id);
			dvID.style.display = "none";
    }
} 