 	//window.onresize = resize;


	//Images
    var shop_pfeil = new Image();
    shop_pfeil.src = "images/shop_pfeil.png";
    var shop_pfeil_beamer = new Image();
    shop_pfeil_beamer.src = "images/shop_pfeil_beamer.png";
    var shop_pfeil_ohc = new Image();
    shop_pfeil_ohc.src = "images/shop_pfeil_ohc.png";
    var shop_pfeil_chbuy = new Image();
    shop_pfeil_chbuy.src = "images/shop_pfeil_chbuy.png";
    var pfeil_link_b = new Image();
    pfeil_link_b.src = "images/pfeil_link_b.gif";
    var pfeil_link_o = new Image();
    pfeil_link_o.src = "images/pfeil_link_o.gif";
    var pfeil_link_c = new Image();
    pfeil_link_c.src = "images/pfeil_link_c.gif";
    var leer = new Image();
    leer.src = "images/pix.gif";

	try
	{
		window.captureEvents(Event.KEYPRESS);
		window.onkeypress = Ausgabe;
	}
	catch (e){} 
	
	function Ausgabe(Ereignis)
	{
		if(Ereignis.which == 13)
		{                 
			sendForm();
		}

	}
	
	
	function enter_form()
	{
		if(document.all) 
		{
			if(window.event.keyCode == 13) 
			{
			  	return 1;
			}
			else
			{
				return 0;
			}
		}
		else
			return 0;
	}


	function checkForm() {
     var eP = document.forms['search_form'].q.value;
  /* Führende Leerzeichen entfernen */
      while(eP.charAt(0)==' '){
          eP = eP.substr(1);
      }
      document.forms['search_form'].q.value = eP;
  /* Länge prüfen, Name muss z.B. mind. 5 Zeichen lang sein */
      if(eP.length > 1)
         return true;
      else {
         alert ("Bitte mindestens 1 Zeichen als Suchbegriff eingeben");
         return false;
      }
		
}

    /* Formular senden */
    function sendForm() {
        if(checkForm())
            document.forms['f_input'].submit();
    }
    
    
    //Sprache wechseln 
    function change_lan(site, su, lan) {
    	var new_site = "hv.php?site="+site+"&su="+su+"&lan="+lan;
		window.location.href=new_site;
    }
    
    function my_login() {
    	//document.forms['top_login'].submit();
    	click_menu('start');
    	document.login.new_username.focus();
    }
    
    function my_login_error() {
    	document.forms['top_login'].submit();
    }
    
    
    function my_logout() {
    	document.forms['top_logout'].submit();
    }
    		

   function checkInput()
   {
        var s = "";
      	//Datum
        var temp = document.forms['f_data'].datum.value;
        while(temp.charAt(0)==' '){
            temp = temp.substr(1);
        }
        document.forms['f_data'].datum.value = temp;
    	//Muss mit den Punkten 10 Zeichen ergeben
        if(temp.length != 10) {
        	s += "Datumsformat ist inkorrekt; ";
        	document.getElementById('t_datum').className = "e";
        }
      	//Titel
        var temp = document.forms['f_data'].titel.value;
        while(temp.charAt(0)==' '){
            temp = temp.substr(1);
        }
        document.forms['f_data'].titel.value = temp;
        if(temp.length < 1) {
        	s += "Kein Titel vorhanden; ";
        	document.getElementById('t_titel').className = "e";
        }
      	//Preis
        var temp = document.forms['f_data'].preis.value;
        while(temp.charAt(0)==' '){
            temp = temp.substr(1);
        }
        document.forms['f_data'].preis.value = temp;
        if(temp.length < 1) {
        	s += "Kein Preis vorhanden; ";
        	document.getElementById('t_preis').className = "e";
        }
       	//Daten
        var temp = document.forms['f_data'].daten.value;
        while(temp.charAt(0)==' '){
            temp = temp.substr(1);
        }
        document.forms['f_data'].daten.value = temp;
        if(temp.length < 1) {
        	s += "Keine Daten vorhanden; ";
        	document.getElementById('t_daten').className = "e";
        }
       	//Inhalt
        var temp = document.forms['f_data'].inhalt.value;
        while(temp.charAt(0)==' '){
            temp = temp.substr(1);
        }
        document.forms['f_data'].inhalt.value = temp;
        if(temp.length < 1) {
        	s += "Keine Beschreibung vorhanden; ";
        	document.getElementById('t_inhalt').className = "e";
        }
       	//Nummer
        var temp = document.forms['f_data'].nummer.value;
        while(temp.charAt(0)==' '){
            temp = temp.substr(1);
        }
        document.forms['f_data'].nummer.value = temp;
        if(temp.length < 1) {
        	s += "Keine Anfrage-Nr vorhanden; ";
        	document.getElementById('t_nummer').className = "e";
        }
       if(s.length == 0)
           return true;
        else {
           alert ("Folgende Fehler sind aufgetreten: " + s + " - das sind Pflichfelder, die Eingaben enthalten sollen!");
           return false;
        }
    }

  function checkNews()
   {
      	//Nr1
        var temp = document.forms['f_news'].elements(1).value;
        while(temp.charAt(0)==' '){
            temp = temp.substr(1);
        }
        document.forms['f_news'].elements(1).value = temp;
      	//Nr2
        var temp = document.forms['f_news'].elements(2).value;
        while(temp.charAt(0)==' '){
            temp = temp.substr(1);
        }
        document.forms['f_news'].elements(2).value = temp;
       if(document.forms['f_news'].elements(1).value.length > 10 && document.forms['f_news'].elements(2).value.length > 10)
           return true;
        else {
           alert ("Sie müssen mindestens 2 Meldungen definieren!");
           return false;
        }
    }




    /* Formular mit Daten senden */
    function sendInput() {
        if(checkInput())
            document.forms['f_data'].submit();
    }
    
    /* Newsticker speichern */
    function saveNews() {
        if(checkNews())
            document.forms['f_news'].submit();
    }

    /* MouseOver -out Effekte */
    function fmouse(img_name, img_src) {
    	document.images[img_name].src = img_src;
    }
    
    function rot_out(tdid) {
    	document.getElementById(tdid).className="n";
    }


	  function getPosY(myObj) {
	    return(myObj.offsetTop + ((myObj.offsetParent) ? getPosY(myObj.offsetParent) : 0));
	    }
	
	  function getPosX(myObj) {
	    return(myObj.offsetLeft + ((myObj.offsetParent) ? getPosX(myObj.offsetParent) : 0));
	    }
	    
	    
    function getlinkPosY(m_link)
    {
        var yLocation=0;
        if(document.all)
            yLocation  = getPosY(document.all[m_link]);
        else if(document.layers)
            yLocation  = document.anchors[m_link].y;
        else if(document.getElementById)
            yLocation  = getPosY(document.anchors[m_link]);
		return yLocation;

    }

    function getlinkPosX(m_link)
    {
        var xLocation=0;
        if(document.all)
            xLocation  = getPosX(document.all[m_link]);
        else if(document.layers)
            xLocation  = document.anchors[m_link].x;
        else if(document.getElementById) 
            xLocation  = getPosX(document.anchors[m_link]);
		return xLocation;

    }

    function resize()
    {
        var thisX;
        var thisY;
        
    	i = 1;
    	while(document.getElementById('ttd'+i))
    	{
    		if(document.getElementById('tdiv'+i))
    		{
         		thisX = getlinkPosX('ttd'+i);
        		thisY = getlinkPosY('ttd'+i);
	        	document.getElementById('tdiv'+i).style.top = thisY;
	        	document.getElementById('tdiv'+i).style.left = thisX;
   			
    		}
    		i++;
    	}
    	
	    objContainer.css.left = getlinkPosX("my_divs")-10;
	    objContainer.css.top = getlinkPosY("my_divs")+10;
   }

    function make_divs(icount)
    {
        var thisX;
        var thisY;
    	for(i = 1; i <= icount; i++)
    	{
    		if(document.getElementById('tdiv'+i))
    		{
         		thisX = getlinkPosX('ttd'+i);
        		thisY = getlinkPosY('ttd'+i);
	        	document.getElementById('tdiv'+i).style.top = thisY;
	        	document.getElementById('tdiv'+i).style.left = thisX;
	        	document.getElementById('tdiv'+i).style.visibility = 'visible';
   			
    		}
    	}
    }
    
    function show_details(id, lan)
    {
    	var details = window.open("details.php?id="+id+"&lan="+lan, "details", "width=698,height=520,left=100,top=116,location=no,toolbar=no,scrollbars=yes");
    	details.focus();
    }
    
    function show_preview(lan)
    {
    	if(checkInput())
    	{
    		var preview = window.open("preview.php?lan="+lan, "preview", "width=698,height=520,left=100,top=116,location=no,toolbar=no,scrollbars=yes");
    		preview.focus();
    	}
    }

    function show_details_admin(id, lan)
    {
    	var details_admin = window.open("details_admin.php?id="+id+"&lan="+lan, "details", "width=698,height=520,left=100,top=116,location=no,toolbar=no,scrollbars=yes");
    	details_admin.focus();
    }
    
    function show_preview_admin(lan)
    {
    	if(checkInput())
    	{
    		var preview_admin = window.open("preview_admin.php?lan="+lan, "preview", "width=698,height=520,left=100,top=116,location=no,toolbar=no,scrollbars=yes");
    		preview_admin.focus();
    	}
    }

   function pdelete(id)
    {
		
		var check = confirm("Wollen Sie dieses Produkt aus der Datenbank wirklich entfernen?");
		if (check == true)
		{
			document.f_delete.i_delete.value=id;
			document.f_delete.submit();
		}
    }

	function checkForm_email() {
     var eP = document.forms['email_form'].email_partner.value;
  /* Führende Leerzeichen entfernen */
      while(eP.charAt(0)==' '){
          eP = eP.substr(1);
      }
      document.forms['email_form'].email_partner.value = eP;
     var eA = document.forms['email_form'].email_absender.value;
  /* Führende Leerzeichen entfernen */
      while(eA.charAt(0)==' '){
          eA = eA.substr(1);
      }
      document.forms['email_form'].email_absender.value = eA;
     var eT = document.forms['email_form'].email_text.value;
  /* Führende Leerzeichen entfernen */
      while(eT.charAt(0)==' '){
          eT = eT.substr(1);
      }
      document.forms['email_form'].email_text.value = eT;
  /* Länge prüfen, Name muss z.B. mind. 5 Zeichen lang sein */
      if(eP.length > 0 && eA.length > 0 && eT.length > 5)
         return true;
      else {
         alert ("Bitte fühlen Sie alle Felder aus.");
         return false;
      }
		
	}
	
	function write_msg(text)
	{
		document.getElementById("msgs").innerHTML = text;
	}

			//Anfang Scrollable Area
			//Browser-Analyse
			sc = new Array();
			var rest = 1;
			
			function verifyCompatibleBrowser(){ 
			    this.ver=navigator.appVersion; 
			    this.dom=document.getElementById?1:0; 
			    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
			    this.ie4=(document.all && !this.dom)?1:0; 
			    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
			    this.ns4=(document.layers && !this.dom)?1:0; 
			    this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5); 
			    return this; 
			} 
			bw=new verifyCompatibleBrowser(); 
			 
			 
			var speed=25; //Verzögerung zwischen zwei scroll-Zuständen
			var jump=1; //Schrittgrösse in Pixel
			 
			var loop, timer; 
			 
			//Scroll-Objekt definieren
			function ConstructObject(obj,nest){ 
			    nest=(!nest) ? '':'document.'+nest+'.'; 
			    this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0; 
			    this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0; 
			    this.scrollWidth=bw.ns4?this.css.document.width:this.el.offsetWidth; 
			    this.clipWidth=bw.ns4?this.css.clip.width:this.el.offsetWidth; 
			    this.right=MoveAreaRight;
			    this.left=MoveAreaLeft; 
			    this.right_last=MoveAreaRightLast;
			    this.left_first=MoveAreaLeftFirst; 
			    this.MoveArea=MoveArea;
			    this.x;
			    this.y; 
			    this.obj = obj + "Object"; 
			    eval(this.obj + "=this"); 
			    return this; 
			} 
			function MoveArea(x,y){ 
			    this.x=x;
			    this.y=y; 
			    this.css.left=this.x; 
			    this.css.top=this.y; 
			} 
			 
			//Rechts-Scrollen
			function MoveAreaRight(move){
				if(this.x>-this.scrollWidth){ 
				    this.MoveArea(this.x-move,0); 
				    if(loop)
				    	setTimeout(this.obj+".right("+move+")",speed); 
				}
				else {
					this.MoveArea(290,0);
					document.getElementById("lauftd").innerHTML = sc[rest%sc.length];
					rest = rest+1;
					setTimeout("PerformScroll(1)", 5000);
				}
			} 
			//Links-Scrollen
			function MoveAreaLeft(move){ 
				if(this.x<0){ 
			    	this.MoveArea(this.x-move,0); 
			    	if(loop)
			    		setTimeout(this.obj+".left("+move+")",speed); 
				} 
			} 
			 
			//Zum Ende der leiste springen
			function MoveAreaRightLast(){
				    this.MoveArea(-this.scrollWidth+660,0); 
			} 
			//Zum Anfang der Leiste springen
			function MoveAreaLeftFirst(){ 
			    	this.MoveArea(0,0); 
			} 
			//Scrollen starten
			function PerformScroll(speed){ 
				if(initialised){ 
					loop=true; 
					if(speed>0)
						objScroller.right(speed); 
					else
						objScroller.left(speed); 
				} 
			} 
			 
			//Sprung ausführen
			function PerformJump(speed){ 
				if(initialised){ 
					if(speed>0)
						objScroller.right_last(); 
					else
						objScroller.left_first(); 
				} 
			} 
			//Scrollen abbrechen
			function CeaseScroll(){ 
			    loop=false; 
			    if(timer)
			    	clearTimeout(timer); 
			}
			//Scrollen initialisieren 
			var initialised; 
			function InitialiseScrollableArea(){ 
			    objContainer=new ConstructObject('divContainer'); 
			    objScroller=new ConstructObject('divContent','divContainer'); 
			    objScroller.MoveArea(100,0); 
			    objContainer.css.left = getlinkPosX("my_divs")-10;
			    objContainer.css.top = getlinkPosY("my_divs")+10;
			    objContainer.css.visibility='visible'; 
			    initialised=true;
			    PerformScroll(1)
			}
			
			
			//Ende der Scrollable Area


