  function isNumeric_pro(s)
  {
      for (i=0;i<s.length;i++)
       if ((s.charAt(i) <"0" || s.charAt(i) > "9") && s.charAt(i) != ".")
         return false;
      return true;
  }
	
  function isNumeric_int_pro(s)
  {
      for (i=0;i<s.length;i++)
       if ((s.charAt(i) <"0" || s.charAt(i) > "9"))
         return false;
      return true;
  }
    
    
  function pop_up_laden(pic_id,pro_id,main_pic)
  {
  	var l = (screen.availWidth - 480) / 2;
  	var t = (screen.availHeight - 600) / 2;    
    
  	window.open("hector_inhalt/produkte/popup.shtml?pic_id="+pic_id+"&pro_id="+pro_id+"&is_main="+main_pic, "hadialog",
  			      "toolbar=no,menubar=no,personalbar=no,width=10,height=10,top="+t+",left="+l+"," +
  			      "scrollbars=yes,resizable=yes");
  }

  function bild_wechsel(new_pic)
  {
    document.images['main_pic'].src = new_pic;
  }
  
  function make_link(ob)
  {
    if (isNumeric_int_pro(document.getElementById("pro_anz").value)==false)
    {
      alert("Bitte geben Sie eine g"+unescape("%FC")+"ltige Zahl ein.");
      return false;
    }
    i=0;
    y="";
    //ob.href = ob.href +"&pro_anz="+document.getElementById("pro_anz1")[document.getElementById("pro_anz1").selectedIndex].value;
    ob.href = ob.href +"&pro_anz="+ document.getElementById("pro_anz").value;
    while (x=document.getElementById(i+"_opt")[document.getElementById(i+"_opt").selectedIndex].value)
    {
      ob.href = ob.href + "&"+i+"_opt="+x;
      i++;
    }
  }
  
	function my_pop_up_shop(breit,hoch)
	{
		//breit=500;
		//hoch=200;
		linkto = "agb_popup.php";
		zusatz = "location=no,width=" + breit + ",height=" + hoch + ",scrollbars=yes,menubars=no,toolbars=no,resizable=no";
		window.open(linkto,"AGBs",zusatz);
	}  
	
	
  function check_email(s)
  {
   var a = false;
   var res = false;
   if(typeof(RegExp) == 'function')
   {
    var b = new RegExp('abc');
    if(b.test('abc') == true){a = true;}
    }

   if(a == true)
   {
    reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)'+
                     '(\\@)([a-zA-Z0-9\\-\\.]+)'+
                     '(\\.)([a-zA-Z]{2,4})$');
    res = (reg.test(s));
   }
   else
   {
    res = (s.search('@') >= 1 &&
           s.lastIndexOf('.') > s.search('@') &&
           s.lastIndexOf('.') >= s.length-5)
   }
   return(res);
  }	
	
  function zahlen_check()
  {
    if (isNumeric(document.getElementById("such_p_ab").value)==false)
    {
      alert("Bitte geben Sie eine gültige Zahl ein (Preis ab).");
      document.getElementById("such_p_ab").focus();
      document.getElementById("such_p_ab").select();
      return false;
    }
    
    if (isNumeric(document.getElementById("such_p_bis").value)==false)
    {
      alert("Bitte geben Sie eine gültige Zahl ein (Preis bis).");
      document.getElementById("such_p_bis").focus();
      document.getElementById("such_p_bis").select();
      return false;
    }
    return true;
  }	
	
	function change_sp_opts(akt_obj,pos,pro_id)
	{
		var url = 'http://'+location.host+'/hector_inhalt/set_sp_opts.php';
		
		opt_id = $('0_opt')[$('0_opt').selectedIndex].value;
		
		next_pos = pos + 1;
		paras = 'opt_id='+opt_id+'&pro_id='+pro_id;
		
    var set_sel = new Ajax.Request(url, {
        method: 'get',
        parameters: {
            opt_id: opt_id,
						pro_id: pro_id
        },
        onComplete: function(text, json){
					
            var data = text.responseText.evalJSON();

						
            //alte Daten lï¿½schen
            anz = $(next_pos+'_opt').options.length + 1;
            for (i = anz; i != -1; i--) 
                $(next_pos+'_opt').options[i] = null;
            
						
						
            //neue Daten hinzufï¿½gen
            if (next_pos+'_opt' != ""){
                n = new Option('Bitte wählen', -1, 'false', 'false');
                $(next_pos+'_opt').options[$(next_pos+'_opt').options.length] = n;
            }

            anz = data.ids.length;
            for (i = 0; i < anz; i++) {
                n = new Option(data.texte[i], data.ids[i], 'false', 'false');
                $(next_pos+'_opt').options[$(next_pos+'_opt').options.length] = n;
            }
						$(next_pos+'_opt').selectedIndex=0;
        },
			onerror:function()
			{
				alert('fehler');
			}
    });
		
		
		
		
		$(next_pos+'_opt').disabled = false;
	}
	
	function change_sp_optsxx(akt_obj,pos,pro_id)
	{
		var url = 'http://'+location.host+'/hector_inhalt/set_sp_opts.php';
		
		opt_id = $('0_opt')[$('0_opt').selectedIndex].value;
		
		next_pos = pos + 1;
		paras = 'opt_id='+opt_id+'&pro_id='+pro_id;
		
		//
		
	  new Ajax.Updater('test_ausgabe',url, {
	    method: 'get',
			parameters: paras
	  });			
		$(next_pos+'_opt').disabled = false;
	}
	
