
	function page (LINK) {
			
		document.location.href = LINK;
	
	}
  
 	function node_open_close(LAYER,NODE_ID) {
 
 		document.product_form.layer.value = LAYER;
    document.product_form.node_id.value = NODE_ID;
    document.product_form.submit();
 
 	}
 
 	function showArticles(NODE_ID) {
 
 		document.product_form.products.value = NODE_ID;
 		document.product_form.submit();
 
 	}
  
  function showSearchResult(NODE_ID) {
 
 		document.search_form.products.value = NODE_ID;
 		document.search_form.submit();
 
 	}
  
  function go_back(BACKTO) {
  	
  	if(BACKTO == 'backtosearchresults') {
    	document.search_form.products.value = 'search';
      document.search_form.submit();  
    }
    else {
    	document.product_form.products.value = '';
      document.product_form.submit();
    }
  }
  
  function perform_search() {
  
  	document.search_form.products.value = 'search';
    document.search_form.submit();
  
  }
  
  function open_haendler_liste(PLZ,PAGE_ID) {
  
		window.open('index.php?page_id='+ PAGE_ID +'&plz='+ PLZ, 'Händler', 'width=600,height=400,left=0,top=0,scrollbars=yes');
  
  }
	
  function open_tm_karte(ID,PAGE_ID) {
  
		window.open('index.php?page_id='+ PAGE_ID +'&tm_id='+ ID, 'Händler', 'width=600,height=200,left=0,top=0,scrollbars=no');
  
  }	
	
	
	// script for filling goods-basket
	// mod = table
	// tbl_type = shop
	
	function fill (PAGE_ID, TBL_ID, TD_ID, SESSID) {
		
		var quantity = document.getElementById('qua' + TD_ID).value;
		
		document.location.href = 'index.php?page_id=' + PAGE_ID + '&action=filltd&tbl_id=' + TBL_ID + '&td_id=' + TD_ID + '&quantity=' + quantity + '&PHPSESSID=' + SESSID;
	
	}
	
	function cookie_save() {
		
		if (!document.tbl_order)
			return;
		
		var FORM	 = document.tbl_order;
		
		for (var num = 0; num < FORM.length; num++) {
			document.cookie = FORM[num].name + "=" + FORM[num].value + ";";
		}
	}
	
	function cookie_load() {
		
  	var COOKIE = document.cookie.split(";");
  	
  	for (var cn = 0; cn < COOKIE.length; cn++) {
  		
  		var TEMP 				= COOKIE[cn].split("=");
  		var TEMP_COOKIE = TEMP[0].replace(/ /, "");
  		
  		if (document.getElementById(TEMP_COOKIE) && TEMP[1])
  			eval('document.tbl_order.' + TEMP_COOKIE + '.value = "' + TEMP[1] + '";');
  	
  	}
  }
	
	function browse_up(PAGE_ID, CN_ID, COUNT) {
	
		document.location.href = 'index.php?page_id=' + PAGE_ID + '&action=browseuptd&cn_id=' + CN_ID + '&count=' + COUNT;
	
	}
	
	function browse_down(PAGE_ID, CN_ID, COUNT) {
	
		document.location.href = 'index.php?page_id=' + PAGE_ID + '&action=browsedowntd&cn_id=' + CN_ID + '&count=' + COUNT;
	
	}	
	
	function $(id) {
		if(document.getElementById(id))
			return document.getElementById(id);
	}
	
	var Held_Form = {
		
		checking: false,
		lan_id: 1,
		check: "",
		
		Formular: function() {
			
			if(this.checking == false) {
				if(this.Fields() == true) {
    			if(document.forms[0].Suchmaschine)
    				return true;
					this.setChecking();
				}
				return false;
			} else {
				var f = document.forms[0];
				for(var c = 0; c < f.length; c++) {
					if(f[c].type == 'checkbox' || f[c].type == 'select-one')
						f[c].disabled = false;					
				}			
				return true;
			}
		}, 
		
		Fields: function() {
			
			this.check = this.check.replace(/ /, "");
			
			var js_fields_array = new Array();
			js_fields_array = this.check.split(",");
			
			for (var c = 0; c < js_fields_array.length; c++) {
  			
				if (js_fields_array[c] == "")
					continue;
				
				var field = eval("document.forms[0]." + js_fields_array[c]);
				
				var is_empty = false;
				if(field.type == 'text' && field.value == "")
					is_empty = true;
				if(field.type == 'checkbox' && field.checked == false)
					is_empty = true;
				
				if (is_empty == true) {
					field.focus();
  				if(this.lan_id == 1)
  					alert("Bitte füllen Sie alle Pflichtfelder aus.");
  				else if (this.lan_id == 2)
  					alert("Please fill in all fields marked with *");
  				else if (this.lan_id == 4)
  					alert("Merci de renseigner tous les champs munis d'une * ");
  				else
  					alert("Please fill in all fields marked with *");
					
					return false;
				}
			}
			if(document.forms[0].Suchmaschine) {
				if((document.forms[0].Suchmaschine.value == '') &&
					 (document.forms[0].Anzeige && document.forms[0].Anzeige.value == 'bitte wählen' || document.forms[0].Anzeige.value == 'choisir' || document.forms[0].Anzeige.value == 'please choose') &&
					 (document.forms[0].sonstige_Anzeige.value == '') &&
					 (document.forms[0].Empfehlung.value == '') &&
					 (document.forms[0].Sonstiges.value == '')
  					) {
    						
						if(this.lan_id == 1)
							alert("Bitte geben Sie an, wie Sie auf uns aufmerksam geworden sind.");
						else if (this.lan_id == 2)
							alert("Please tell us how you heard/read about us. Thanks!");
						else if (this.lan_id == 4)
							alert("Indiquez nous encore comment nous avons attiré votre attention. Merci !");
						else
							alert("Please tell us how you heard/read about us. Thanks!");					
  					
    				return false;
    		}
  		}
			return true;
		},
		
		setChecking: function() {
			
			this.checking = true;
			
			$('sendbutton').value = 'Bestellung senden';
			$('sendbutton_prev').style.display = 'inline';
			
			var f = document.forms[0];
			for(var c = 0; c < f.length; c++) {
				if(f[c].type == 'checkbox' || f[c].type == 'select-one')
					f[c].disabled = true;
				else if(f[c].type != 'text' && f[c].type != 'textarea')
					continue;
				f[c].style.border = '0';
				f[c].style.backgroundColor = '#ffffff';
				f[c].style.color = '#000000';
				f[c].readOnly = true;
			}
			
		},
		
		unsetChecking: function() {
		
			this.checking = false;
			
			$('sendbutton').value = 'Bestellung prüfen';
			$('sendbutton_prev').style.display = 'none';
			
			var f = document.forms[0];
			for(var c = 0; c < f.length; c++) {
				if(f[c].type == 'checkbox' || f[c].type == 'select-one')
					f[c].disabled = false;
				else if(f[c].type != 'text' && f[c].type != 'textarea')
					continue;
				f[c].style.border = '#cccccc solid 1px';
				f[c].style.backgroundColor = '#ffffff';
				f[c].style.color = '#666666';
				f[c].readOnly = false;
			}
			
		}
	}
