<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function Popup( url, name, width, height ) {
  var w=width
  var h=height
  var x = (screen.width -w)/2
  var y = (screen.height - h)/2
  var finestra=window.open(url,name,'width=' + w +',height=' + h + ', toolbar=no,directories=no,location=no,status=no,menubar=no,copyhistory=no,scrollbars=no,resizable=no')
  finestra.moveTo(x,y)
  finestra.focus()
}
 
function ChangePage( page ) {
	top.main.location.href=page ;
}

function printpage(){
   bV = parseInt(navigator.appVersion)
   if (bV >= 4) window.print() ;
   window.close ;
}

function printfriendly( url ){
	winId=window.open(url + '?print=friendly','printwin','width=100,height=100,top=25000,left=25000');
 	winId.focus();
 	window.setTimeout('winId.print()', 1000);
	window.setTimeout('winId.close()', 5000);
}

function mailaddress( email, domain ) { 
	return email + "@" + domain;
} 

function buildmailaddress( email, domain ) { 
	location.href = 'mailto:' + email + "@" + domain;
} 

// Check that the number of characters in a string is between a max and a min
function isValidLength(string, min, max) {
        if (string.length < min || string.length > max) return false;
        else return true;
}

// Check that an email address is valid based on RFC 821 (?)
function isValidEmail(address) {
        if (address.indexOf('@') < 3) return false;
        var name = address.substring(0, address.indexOf('@'));
        var domain = address.substring(address.indexOf('@') + 1);
        if (name.indexOf('(') != -1 || name.indexOf(')') != -1 || name.indexOf('<') != -1 || name.indexOf('>') != -1 || name.indexOf(',') != -1 || name.indexOf(';') != -1 || name.indexOf(':') != -1 || name.indexOf('\\') != -1 || name.indexOf('"') != -1 || name.indexOf('[') != -1 || name.indexOf(']') != -1 || name.indexOf(' ') != -1) return false;
        if (domain.indexOf('(') != -1 || domain.indexOf(')') != -1 || domain.indexOf('<') != -1 || domain.indexOf('>') != -1 || domain.indexOf(',') != -1 || domain.indexOf(';') != -1 || domain.indexOf(':') != -1 || domain.indexOf('\\') != -1 || domain.indexOf('"') != -1 || domain.indexOf('[') != -1 || domain.indexOf(']') != -1 || domain.indexOf(' ') != -1) return false;
        return true;
}

// Check that a US zip code is valid
function isValidZipcode(zipcode) {
        zipcode = removeSpaces(zipcode);
        if (!(zipcode.length == 5) || !isNumeric(zipcode)) return false;
        return true;
}


// Check that a Canadian postal code is valid
function isValidPostalcode(postalcode) {
        if (postalcode.search) {
                postalcode = removeSpaces(postalcode);
                if (postalcode.length == 6 && postalcode.search(/^\w\d\w\d\w\d$/) != -1) return true;
                else if (postalcode.length == 7 && postalcode.search(/^\w\d\w\-d\w\d$/) != -1) return true;
                else return false;
        }
        return true;
}

// Check that a string contains only letters and numbers
function isAlphanumeric(string, ignoreWhiteSpace) {
        if (string.search) {
                if ((ignoreWhiteSpace && string.search(/[^\w\s]/) != -1) || (!ignoreWhiteSpace && string.search(/\W/) != -1)) return false;
        }
        return true;
}

// Check that a string contains only letters
function isAlphabetic(string, ignoreWhiteSpace) {
        if (string.search) {
                if ((ignoreWhiteSpace && string.search(/[^a-zA-Z\s]/) != -1) || (!ignoreWhiteSpace && string.search(/[^a-zA-Z]/) != -1)) return false;
        }
        return true;
}

// Check that a string contains only numbers
function isNumeric(string, ignoreWhiteSpace) {
        if (string.search) {
                if ((ignoreWhiteSpace && string.search(/[^\d\s]/) != -1) || (!ignoreWhiteSpace && string.search(/\D/) != -1)) return false;
        }
        return true;
}

// Remove characters that might cause security problems from a string
function removeBadCharacters(string) {
        if (string.replace) {
                string.replace(/[<>\"\'%;\)\(&\+]/, '');
        }
        return string;
}

// Remove all spaces from a string
function removeSpaces(string) {
        var newString = '';
        for (var i = 0; i < string.length; i++) {
                if (string.charAt(i) != ' ') newString += string.charAt(i);
        }
        return newString;
}

// Remove leading and trailing whitespace from a string
function trimWhitespace(string) {
        var newString  = '';
        var substring  = '';
        beginningFound = false;

        // copy characters over to a new string
        // retain whitespace characters if they are between other characters
        for (var i = 0; i < string.length; i++) {

                // copy non-whitespace characters
                if (string.charAt(i) != ' ' && string.charCodeAt(i) != 9) {

                        // if the temporary string contains some whitespace characters, copy them first
                        if (substring != '') {
                                newString += substring;
                                substring = '';
                        }
                        newString += string.charAt(i);
                        if (beginningFound == false) beginningFound = true;
                }

                // hold whitespace characters in a temporary string if they follow a non-whitespace character
                else if (beginningFound == true) substring += string.charAt(i);
        }
        return newString;
}

// Returns a checksum digit for a number using mod 10
function getMod10(number) {

        // convert number to a string and check that it contains only digits
        // return -1 for illegal input
        number = '' + number;
        number = removeSpaces(number);
        if (!isNumeric(number)) return -1;

        // calculate checksum using mod10
        var checksum = 0;
        for (var i = number.length - 1; i >= 0; i--) {
                var isOdd = ((number.length - i) % 2 != 0) ? true : false;
                digit = number.charAt(i);

                if (isOdd) checksum += parseInt(digit);
                else {
                        var evenDigit = parseInt(digit) * 2;
                        if (evenDigit >= 10) checksum += 1 + (evenDigit - 10);
                        else checksum += evenDigit;
                }
        }
        return (checksum % 10);
}
                
function CookieDelete() {
  var cookie = this.$name+'='
  if (this.$path)   cookie+='; path='+this.$path
  if (this.$domain) cookie+='; domain='+this.$domain
  cookie+='; expires=Fri, 02-Jan-1970 00:00:00 GMT' // MAKE IT EXPIRE!
  this.$doc.cookie=cookie
} 
        
function CookieRead() {
  var allcookies=this.$doc.cookie
  if (allcookies=="") {
    return false
  }
  var start= allcookies.indexOf(this.$name+'=')
  if (start== -1) {
    return false
  }
  start += this.$name.length+1
  var end=allcookies.indexOf(';',start)
  if (end == -1) end=allcookies.length
  var cookieval = allcookies.substring(start,end)
  var a = cookieval.split('&')
  for (var i=0;i < a.length;i++) a[i]=a[i].split(':')
  for (var i=0;i < a.length;i++) this[a[i][0]]=unescape(a[i][1])
  return true
}

function CookieWrite() {
  var cookieval=""
  for(var prop in this) {
    if ((prop.charAt(0) == '$') || ((typeof this[prop]) == 'function') || prop == '') continue
        if (cookieval != "") cookieval += '&'
        cookieval+=escape(this[prop])
  }
  var cookie=this.$name+"="+cookieval
  if (this.$expiration) cookie+='; expires=' + this.$expiration.toGMTString()
  if (this.$path)       cookie+='; path='    + this.$path
  if (this.$domain)     cookie+='; domain='  + this.$domain
  if (this.$secure)     cookie+='; secure'
  this.$doc.cookie=cookie
}
       
function Cookie(document,name,hours,path,domain,secure) {
 // any VAR in "this" that does not start with a "$" will
 // be written into the cookie (read from also)
  this.$doc  = document
  this.$name = name
  if (hours)  this.$expiration=new Date((new Date()).getTime()+hours*3600000); else this.$expiration = null
  if (path)   this.$path   = path;                                             else this.$path       = null
  if (domain) this.$domain = domain;                                           else this.$domain     = null
  if (secure) this.$secure = true;                                             else this.$secure     = false
}
        
function setta_il_cookie(argomenti, dominio, path) {       
	new Cookie()
	Cookie.prototype.write = CookieWrite
	Cookie.prototype.del   = CookieDelete
	Cookie.prototype.read  = CookieRead
	// end cookie construct
	    
	var myCookie = new Cookie(document,"clampcosistemi", 2400, path, dominio )
	myCookie.clampcosistemi = argomenti;
	myCookie.write();

}
        
function detect_cookies_enabled() {
   var tmpcookie = new Date();
   chkcookie = (tmpcookie.getTime() + '');
   document.cookie = "chkcookie=" + chkcookie + "; path=/";
   if (document.cookie.indexOf(chkcookie,0) < 0) {
   	return false ;
   } else {
   	return true ;
   }
}
        
function detect_plugins() {
	var agt=navigator.userAgent.toLowerCase();
	var ie  = (agt.indexOf("msie") != -1);
	var ns  = (navigator.appName.indexOf("Netscape") != -1);
	var win = ((agt.indexOf("win")!=-1) || (agt.indexOf("32bit")!=-1));
	var mac = (agt.indexOf("mac")!=-1);

	if (ie && win) {	pluginlist = detectIE("Adobe.SVGCtl","SVG Viewer") + detectIE("SWCtl.SWCtl.1","Shockwave Director") + detectIE("ShockwaveFlash.ShockwaveFlash.1","Shockwave Flash") + detectIE("rmocx.RealPlayer G2 Control.1","RealPlayer") + detectIE("QuickTimeCheckObject.QuickTimeCheck.1","QuickTime") + detectIE("MediaPlayer.MediaPlayer.1","Windows Media Player") + detectIE("PDF.PdfCtrl.5","Acrobat Reader"); }
	if (ns || !win) {
        nse = ""; for (var i=0;i<navigator.mimeTypes.length;i++) nse += navigator.mimeTypes[i].type.toLowerCase();
		pluginlist = detectNS("image/svg-xml","SVG Viewer") + detectNS("application/x-director","Shockwave Director") + detectNS("application/x-shockwave-flash","Shockwave Flash") + detectNS("audio/x-pn-realaudio-plugin","RealPlayer") + detectNS("video/quicktime","QuickTime") + detectNS("application/x-mplayer2","Windows Media Player") + detectNS("application/pdf","Acrobat Reader");
	}

	function detectIE(ClassID,name) { result = false; document.write('<SCRIPT LANGUAGE=VBScript>\n on error resume next \n result = IsObject(CreateObject("' + ClassID + '"))</SCRIPT>\n'); if (result) return name+','; else return ''; }
	function detectNS(ClassID,name) { n = ""; if (nse.indexOf(ClassID) != -1) if (navigator.mimeTypes[ClassID].enabledPlugin != null) n = name+","; return n; }

	pluginlist += navigator.javaEnabled() ? "Java," : "";
	if (pluginlist.length > 0) pluginlist = pluginlist.substring(0,pluginlist.length-1);
    
	return pluginlist ;
	   
}

function CheckBrowserSupportXMLHttp() {	
	xmlhttp = '' ;
	// creo oggetto AJAX
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
        xmlhttp = new XMLHttpRequest();
        if ( xmlhttp.overrideMimeType ) {
            xmlhttp.overrideMimeType('text/plain');
        }
    } else if (window.ActiveXObject) { // IE
        try {
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
            	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {
            	xmlhttp='';
            }
        }
    } 
	if ( xmlhttp ) {
		return xmlhttp ;
	} else {
		return '' ;
	}
}

function ProductSearchChange( url, selectId ) {
	// prendo l'oggetto "SELECT"
	select_obj = document.getElementById( selectId ) ;
	// se non ho l'URL, la costruisco
	url = ( url == '') ? location.href + '?' : url ;
	// determino se devo aggiungere il '?' oppre il '&' 
	if ( url.indexOf( '?' ) == -1 ) url = url + '?' + select_obj.name + '=' + select_obj.options[ select_obj.selectedIndex ].value ;
	else url = url + '&' + select_obj.name + '=' + select_obj.options[ select_obj.selectedIndex ].value ;
	// salto all'URL
	location.href = url ;
}

function ProductSearchSubmit( url, inputId ) {
	// prendo l'oggetto "INPUT"
	input_obj = document.getElementById( inputId ) ;
	// se non ho l'URL, la costruisco
	url = ( url == '') ? location.href + '?' : url ;
	// determino se devo aggiungere il '?' oppre il '&' 
	if ( url.indexOf( '?' ) == -1 ) url = url + '?' + input_obj.name + '=' + escape( input_obj.value ) ;
	else url = url + '&' + input_obj.name + '=' + escape( input_obj.value ) ;
	// salto all'URL
	location.href=url ;
}

function go( url ) {
	location.href=url ;	
}
//-->