// AjsLib JS Liblary
// Easy functions Lib.
// by Artos (C) 2009  2010-01-12 08:48:51
// for Webprovider 



          function prev() { window.history.back() }

          function ShowHide(id) {
                  document.getElementById(id).style.display = (document.getElementById(id).style.display == "none") ? "block" : "none";
              }
         
          function Hide(id) {
                  document.getElementById(id).style.display = "none";
              }
         
          function Show(id) {
                  document.getElementById(id).style.display = "block";
              }
              
          function vHide(id) {
                  document.getElementById(id).style.visibility = "hidden";
              }

          function vShow(id) {
                  document.getElementById(id).style.visibility = "visible";
              }
              
          function Close(id, time) {      
              t=setTimeout('Hide("'+id+'")',time);             
              }
        
          function setOpacity(id, value) {
            document.getElementById(id).style.opacity = value/10;
          	document.getElementById(id).style.filter = 'alpha(opacity=' + value*10 + ')';
          }
         
          function Shadow() {
            //Show("msg_okno_cien");
            //z=document.getElementById("msg_okno").height;
            //document.getElementById("msg_okno").innerHTML="AAAA: ["+z+"]";         

          }
          
          function Send(id, wartosc) {
            //z=document.getElementById("msg_okno").height;
            document.getElementById(id).innerHTML=wartosc;         
          }
          
          function Send_value(id, wartosc) {
            //z=document.getElementById("msg_okno").height;
            document.getElementById(id).value=wartosc;        
          }
        
          function Send_src(id, wartosc) {
            document.getElementById(id).src=wartosc;         
          }

          function Send_href(id, wartosc) {
            document.getElementById(id).href=wartosc;         
          }
         
          function Send_bg(id, wartosc) {
            document.getElementById(id).style.background="url("+wartosc+") no-repeat center center";         
          }
          
          function z_index(id, wartosc) {
            document.getElementById(id).style.zIndex=wartosc;        
          }
        
          function Obj_height(id, wartosc) {
            document.getElementById(id).style.height=wartosc;         
          }
          
      //GALLERY
          function Gall(url,plik1,plik2) {
          
              content='<a href="'+url+plik1+'" rel="lightbox-gal-" class="img_mid" style="background: url('+url+plik2+') no-repeat center top;"><!-- img mid --></a>';
              Send('gall_mid',content);
          
          }
          
          function Producent() {
          
              obj=document.getElementById('fields[manufacturer]').value;
              
              alert(obj);
              if(obj==1) {
                  cat="101-moulinex";         
              }
              
              document.location="http://webpshop.webprovider3.kei.pl/kategoria/"+cat+".html";
              //if(this.value=='credit-card')
          }

          function JQinit() {
          
                $("#attribute_combination_id").change(function(event){ 
                
                    var wartosc = $(this).val();
                    var oldlink = $("#product_link").val();
                    //var cena = $(this).attr("title");
                    $("a.add_cart").attr("href",oldlink+"&k="+wartosc);
                    
                //alert("a:"+wartosc +"t:"+ cena);
                
                
                });
            
                 $("#product a.add_cart").click(function(event){                 
                     var product_size = $(this).nextAll("form").children("select").val();
                     $(this).nextAll("form").children("select").css("border","3px solid red");
                     //$(".attribute_combination_id").css("border","3px solid red");

                    //alert(this);
                    //return false;
                    
                      if(product_size=="") {
                          alert("Musisz wybrać rozmiar "+product_size);
                          return false;
                      } else {
                         // alert("ok");
                          return true;
                      
                      }
                 });
                 
                 
                 
          
          }
          
         function add_cart() {
          
                  //DODAWANIE DO KOSZYKA
                  $("a.add_cart").click(function(event){
                     
                     var product_size = $(this).nextAll("form").children("select").val();
                     
                     //alert("test: "+product_size);
                    
                     if(product_size=="") {
                        $(this).nextAll("form").children("select").css("border","1px solid red");
                        alert("Musisz wybrać rozmiar");
                        return false;
                     
                     } else {
                     
                       // alert("ok");
                     
                        return true;   
                     }
                                          
                     
                  
                  });
                  
          }

          function href_modify(obj_id, obj_href, obj_modify) {
          
                $(obj_id).change(function(event){ 
                
                    var wartosc = $(this).val();
                    var oldlink = $(obj_href).val();
                    //var cena = $(this).attr("title");
                    $(obj_modify).attr("href",oldlink+"&k="+wartosc);
                    
                //alert("a:"+wartosc +"t:"+ cena);
                
                
                });
            
                 $(obj_modify).click(function(event){                 
                     var product_size = $(this).nextAll("form").children("select").val();
                     //$(this).nextAll("form").children("select").css("border","3px solid red");
                     //$(".attribute_combination_id").css("border","3px solid red");

                    //alert(this);
                    //return false;
                    
                      if(product_size=="") {
                          //alert("Musisz wybrać rozmiar "+product_size);
                          return false;
                      } else {
                          //alert("ok: "+product_size);
                          return true;
                      
                      }
                 });
          
          }
          


