function close_popup() {
	document.getElementById("popup").style.display = 'none';
}	

function timer() {		
	setTimeout("change_news()", 5000);
}

function change_news() {
	if (document.getElementById('news_1').style.display == 'block') {
		document.getElementById('news_2').style.display = 'block';	
		document.getElementById('news_1').style.display = 'none';
		document.getElementById('news_3').style.display = 'none';
	} else if (document.getElementById('news_2').style.display == 'block') {
		document.getElementById('news_3').style.display = 'block';	
		document.getElementById('news_1').style.display = 'none';
		document.getElementById('news_2').style.display = 'none';
	}	else if (document.getElementById('news_3').style.display == 'block') {
		document.getElementById('news_1').style.display = 'block';	
		document.getElementById('news_2').style.display = 'none';
		document.getElementById('news_3').style.display = 'none';
	}	
	timer();	
}

function change_picture(bild) {
  document.getElementById('product_image').src = '/images/artikel/big/'+bild;
}

function open_faq(faq_number) {
  document.getElementById(faq_number).style.display = 'block';
}

function open_menu (menu_id) {
	if (document.getElementById(menu_id).style.display == 'none') {				
		document.getElementById(menu_id).style.display = 'block';
		document.getElementById(menu_id+'_grafik').src = '/images/arrow_up_over.gif';
		write_cookie(menu_id,'open');
	} else {
		document.getElementById(menu_id).style.display = 'none';
		document.getElementById(menu_id+'_grafik').src = '/images/arrow_down_over.gif';
		write_cookie(menu_id,'close');
	}
}	
function write_cookie(menu_id,menu_value) {
	var a = new Date();
	a = new Date(a.getTime() +1000*60*60*24*1);	 // 1 Tages Cookie
	document.cookie = ''+menu_id+'='+menu_value+'; expires='+a.toGMTString()+';'; 
}

var http_content = null;

if (window.XMLHttpRequest)
{
    http_content = new XMLHttpRequest();
    http_menu = new XMLHttpRequest();
    http_gemeinde = new XMLHttpRequest();
    http = new XMLHttpRequest();
    if(navigator.appName=='Microsoft Internet Explorer') browser = 2; else browser = 1;
}
else if (window.ActiveXObject)
{
    try
    {
        http_content = new ActiveXObject("Msxml2.XMLHTTP");
        http_menu = new ActiveXObject("Msxml2.XMLHTTP");
        http_gemeinde = new ActiveXObject("Msxml2.XMLHTTP");
        http = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e)
    {
        try
        {
            http_content = new ActiveXObject("Microsoft.XMLHTTP");
            http_menu = new ActiveXObject("Microsoft.XMLHTTP");
            http_gemeinde = new ActiveXObject("Microsoft.XMLHTTP");
            http = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (e) {alert('kein object');}
    }
    browser = 2;
}


function put_into_cart(bestellnummer, anzahl) {
	if (http_content != null)
    {
       http_content.open("POST", "ajax_warenkorb.php", true);
       http_content.onreadystatechange = ajaxAusgabe;
       http_content.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
       http_content.send("bestellnummer="+bestellnummer+"&anzahl="+anzahl);
       document.getElementById('LoadMessage').style.display = "block";	
       document.getElementById('ajaxContent').style.display = "block";
       document.getElementById('ajaxContent').innerHTML = "<img src='/images/loading_dark.gif' border='0' style='margin-top:300px;'>";
       
       document.getElementById('header_link_warenkorb').innerHTML = '<a class="headerNavigation" title="LED Lamp LED Light LED Lighting" href="warenkorb.php?left=j" style="vertical-align:bottom;color:#FF8439;" rel="nofollow"><img src="/images/warenkorb_icon2.gif" border="0" style="margin-right:5px;" alt="www.led-light-24.com LED Spot GU10, MR16, E27" />shopping cart</a>';
    }
}

function put_into_cart_custom(bestellnummer, anzahl, laenge) {
	if (http_content != null)
    {
       http_content.open("POST", "ajax_warenkorb.php", true);
       http_content.onreadystatechange = ajaxAusgabe;
       http_content.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
       http_content.send("bestellnummer="+bestellnummer+"&anzahl="+anzahl+"&laenge="+laenge);
       document.getElementById('LoadMessage').style.display = "block";	
       document.getElementById('ajaxContent').style.display = "block";
       document.getElementById('ajaxContent').innerHTML = "<img src='/images/loading_dark.gif' border='0' style='margin-top:300px;'>";
    }
}

function refresh_cartbox() {
	if (http_content != null)
    {
       http_content.open("POST", "ajax_cart_box.php", true);
       http_content.onreadystatechange = ajaxAusgabeCartBox;
       http_content.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
       http_content.send();
       document.getElementById('ajaxCartBox').innerHTML = "<img src='/images/loading.gif' border='0' style='margin-top:300px;'>";
    }
}

function ajaxAusgabe() {
  if (http_content.readyState == 4) {
    document.getElementById("ajaxContent").innerHTML = http_content.responseText;
    refresh_cartbox();
  }
}

function ajaxAusgabeCartBox() {
  if (http_content.readyState == 4) {
    document.getElementById("ajaxCartBox").innerHTML = http_content.responseText;
  }
}

function continue_shopping() {
  document.getElementById('ajaxContent').style.display = "none";
  document.getElementById('LoadMessage').style.display = "none";
  
}

function number_check(feld) {
	  var eingabe = feld.value;
	  var erlaubt = '0123456789';
	  for (i=0;i <= eingabe.length; i++) {
	    if (erlaubt.indexOf(eingabe.charAt(i)) < 0  ) {
	      feld.value = feld.value.replace(eingabe.charAt(i), ""); 
	    } 
	  }
	}


function switch_dropdown(element, bgElement) {
	if (document.getElementById(element).style.display == "block") {
		document.getElementById(element).style.display = "none";
		document.getElementById(bgElement).style.backgroundImage = "url(images/bg_grey.gif)";
	} else {
		document.getElementById(element).style.display = "block";
		document.getElementById(bgElement).style.backgroundImage = "url(images/bg_grey_rev.gif)";
	}
}

pic1= new Image(1,20); 
pic1.src="images/bg_grey_rev.gif"; 

