/*
        function $() {
                 var elements = new Array();
                 for ( var i = 0; i < arguments.length; i++ ) {
                      var element = arguments[i] ;
                      if ( typeof element == 'string' )
                          element = document.getElementById(element) ;
                      if ( arguments.length == 1 )
                          return element ;
                      elements.push(element) ;
                 }
                 return elements ;
        }

function addLoadEvent(func) {
   var oldonload = window.onload;
   if (typeof window.onload != 'function') {
       window.onload = func;
   } else {
       window.onload = function() {
       func();
       oldonload();
       }
  }
}
        var onloads = new Array();
        function bodyOnLoad() {
            for ( var i = 0 ; i < onloads.length ; i++ )
	             onloads[i]();
        }

        ns4 = (document.layers) ? 1:0;
        ie4 = (document.all)    ? 1:0;
        if (ie4+ns4==0) {ie4=1;}
        function Show(what) {
	             if (ns4&&document.layers[what]) { document.layers[what].display="inline"; }
                 if (ie4&&document.all[what]) { document.all[what].style.display="inline"; }
        }
        function Hide(what) {
	             if (ns4&&document.layers[what]) { document.layers[what].display="none"; }
                 if (ie4&&document.all[what]) { document.all[what].style.display="none"; }
        }

        // REGULAR EXPRESSION DECLARATIONS
        var regExLetter            = /^[a-zA-Z]$/
        var regExItalianDate       = /^\d{1,2}\-\d{1,2}\-\d{4}$/
        var regExItalianFiscalCode = /^[A-Z]{6}\d{2}[A-Z]\d{2}[A-Z]\d{3}[A-Z]$/
        var regExImporto           = /^\d{1,3}(\.?\d{3})*(,\d{1,2})?$/
        //test data for proper format
        function test_data(src) {
        	     if ( src.length == 0 ) return false ;
                 return regExItalianDate.test(src);
        }
        //test string for proper format
        function test_alfa(src) {
        	     if ( src.length == 0 ) return false ;
                 var alfaReg = "^[\\w-_]*[\\w-_]$";
                 var regex = new RegExp(alfaReg);
                 return regex.test(src);
        }
        //test number for proper format
        function test_number(src, length) {
        	     if ( src.length == 0 ) return true ;
        	     if ( typeof length == "undefined" )
        	     	eval (' var numberReg = "^[0-9]*$";') ;
        	     else
                    eval (' var numberReg = "^[0-9]{'+length+'}$";') ;
                 var regex = new RegExp(numberReg);
                 return regex.test(src);
        }
        //test email for proper format
        function test_email(src) {
        	     if ( src.length == 0 ) return false ;
                 var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
                 var regex = new RegExp(emailReg);
                 return regex.test(src);
        }
                //test string for proper format
        function test_cf(src) {
        	     if ( src.length == 0 ) return false ;
        	     return regExItalianFiscalCode.test(src);
        }
        //compare two dates
        function compare_dates(date1, date2) {
        	     if ( date1.length == 0 || date2.length == 0 ) return false ;
        	     vdate1 = date1.split("-") ;
        	     vdate2 = date2.split("-") ;
        	     if ( vdate2[2] < vdate1[2] ) {
        	     	return false ;
        	     } else {
                    if ( vdate2[1] < vdate1[1] ) {
        	     	    return false ;
        	        } else {
                        if ( vdate2[0] < vdate1[0] ) {
        	     	        return false ;
        	            } else {
                            return true ;
        	            }
        	        }
        	     }
        }
        //
        function open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable) {
                 toolbar_str = toolbar ? 'yes' : 'no';
                 menubar_str = menubar ? 'yes' : 'no';
                 statusbar_str = statusbar ? 'yes' : 'no';
                 scrollbar_str = scrollbar ? 'yes' : 'no';
                 resizable_str = resizable ? 'yes' : 'no';
                 window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
        }
        //
        function set_home_page(url) {
                 if(document.all)
                    document.body.style.behavior='url(#default#homepage)';
                 document.body.setHomePage(url);
        }
        function add_to_favorites(url, title) {
                 if ( document.all ) {
                     window.external.AddFavorite (url, title) ;
                 }
        }
        //
        function showToolTip(e,text){
		         if(document.all)e = event;
		         var obj = document.getElementById('bubble_tooltip');
		         var obj2 = document.getElementById('bubble_tooltip_content');
		         obj2.innerHTML = text;
		         obj.style.display = 'block';
		         var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
		         var leftPos = e.clientX +25;
		         if(leftPos<0)leftPos = 0;
		         obj.style.left = leftPos + 'px';
		         obj.style.top = e.clientY - obj.offsetHeight -1 + st + 'px';
	   }
	   function hideToolTip(){
		         document.getElementById('bubble_tooltip').style.display = 'none';
	   }
	   //
	   //function to check form when this is submitted
       function checkform_product(form, type){
       	        var msg = " è vuoto oppure il formato non è coretto!" ;
         	      if ( form.name == "insert_product" ) {
         	          if (form.idCartShop.value == "") {
                	      alert("Il campo \"Negozio\""+msg);
                          form.idCartShop.focus();
                	      return false ;
                      }
                      if (form.idCartCategorie.value == "") {
                	      alert("Il campo \"Categoria\""+msg);
                          form.idCartCategorie.focus();
                	      return false ;
                      }
         	      }
                  if (form.code.value == "") {
                	  alert("Il campo \"Codice prodotto\""+msg);
                      form.code.focus();
                	  return false ;
                  }
                  if (form.product.value == "") {
                	  alert("Il campo \"Prodotto\""+msg);
                      form.product.focus();
                	  return false ;
                  }
                  if (form.description.value == "") {
                	  alert("Il campo \"Descrizione\""+msg);
                      form.description.focus();
                	  return false ;
                  }
                  if (form.technicaldata.value == "") {
                	  alert("Il campo \"Dati tecnici\""+msg);
                      form.technicaldata.focus();
                	  return false ;
                  }
                  var X = form.prezzo.value ;
	              if ( regExImporto.test(X) ) {
			          form.prezzo.value = X.replace(/[.]/g,"").replace(",",".");
	              } else {
    	   	          alert("Il campo \"Importo\""+msg);
                      form.prezzo.focus();
        	          return false ;
	              }
	              if (type == "insert") {
	              if (form.img_sourcefile.value == "") {
                	  alert("Selezionare dal computer il file per l'immagine");
                      form.img_sourcefile.focus();
                	  return false ;
                  }
	              }
            	  return true ;
         }
	   var arrayWidths = new Array( 133, 374, 170, 254 ) ;
       function show_picture( img ) {
	             $("hp_left").disabled = false ;
	             $("hp_centrale").disabled = false ;
	             $("offerta_1").disabled = false ;
        	     tmpImage = new Image;
        	     tmpImage.src = img.value ;
        	     //alert(tmpImage.width);
        	     $("consiglio").innerHTML = "" ;
        	     if ( tmpImage.width < arrayWidths[3] )
        	           $("consiglio").innerHTML = "La larghezza della immagine e consiliata a 254px(cosi come si  vede nella scheda dettaglio del prodotto) oppure superiore. Negli altri posti dove comparira sara ridotta automaticamente." ;
        	     for(i=0;i<3000;i++){}
	             document.images.img1.src = img.value ;
	             $("img_dimensions").innerHTML = "Dimensioni immagine: "+tmpImage.width+"x"+tmpImage.height+"px" ;
	             if ( tmpImage.width < arrayWidths[0] ) {
	             	$("img_dimensions").style.color = "Red" ;
	             } else {
	             	$("img_dimensions").style.color = "Black" ;
	             }
	             if ( tmpImage.width < arrayWidths[0] ) {
	             	$("hp_left").checked = false ;
	             	$("hp_left").disabled = true ;
	             }
	             if ( tmpImage.width < arrayWidths[1] ) {
	             	$("hp_centrale").checked = false ;
	             	$("hp_centrale").disabled = true ;
	             }
	             if ( tmpImage.width < arrayWidths[2] ) {
	             	$("offerta_1").checked = false ;
	             	$("offerta_1").disabled = true ;
	             }
	             if ( tmpImage.width>100 ) document.images.img1.width = 100 ;
        }
        
        
 message = "Benvenuto su Audiotek.it!";
        bV  = parseInt(navigator.appVersion)
        bNS = navigator.appname=="Netscape"
        bIE = navigator.appname=="Microsoft Internet Explorer"
        function nrc(e) {
                 if (bNS && e.which > 1){
                     alert(message) ;
                     return false ;
                 } else if (bIE && (event.button >1)) {
                     alert(message) ;
                     return false;
                 }
        }
        document.onmousedown = nrc;
        if (document.layers) window.captureEvents(Event.MOUSEDOWN);
        if (bNS && bV<5) window.onmousedown = nrc;
        
function na_preload_img()
{
  var img_list = na_preload_img.arguments;
  if (document.preloadlist == null)
    document.preloadlist = new Array();
  var top = document.preloadlist.length;
  for (var i=0; i < img_list.length; i++) {
    document.preloadlist[top+i] = new Image;
    document.preloadlist[top+i].src = img_list[i+1];
  }
}

function na_restore_img_src(name, nsdoc)
{
  var img = eval((navigator.appname.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
  if (name == '')
    return;
  if (img && img.altsrc) {
    img.src    = img.altsrc;
    img.altsrc = null;
  }
}

function na_change_img_src(name, nsdoc, rpath, preload)
{
  var img = eval((navigator.appname.indexOf('Netscape', 0) != -1) ? nsdoc+'.'+name : 'document.all.'+name);
  if (name == '')
    return;
  if (img) {
    img.altsrc = img.src;
    img.src    = rpath;
  }
}          


*/      
