var stato=0;
var minPlayer=4; 
var flashPlugIn=false;
var agt=navigator.userAgent.toLowerCase();
var is_major=parseInt(navigator.appVersion);
var is_nav=((agt.indexOf('mozilla')!=-1)&&(agt.indexOf('spoofer')==-1)&&(agt.indexOf('compatible')==-1)&&(agt.indexOf('opera')==-1)&&(agt.indexOf('webtv')==-1));
var is_nav4up=(is_nav && (is_major>=4));
var is_ie=(agt.indexOf("msie")!=-1);
var is_ie3=(is_ie&&(is_major<4));
var msie_vers_start=agt.indexOf("msie")+5;
var msie_real_vers=parseFloat(agt.substring(msie_vers_start,msie_vers_start+3));
var is_ie4=(is_ie&&(is_major==4)&&(msie_real_vers<5));
var is_ie4up=(is_ie&&(is_major>=4));
var is_ie5up=(is_ie&&!is_ie3&&!is_ie4);
var is_win=((agt.indexOf("win")!=-1)||(agt.indexOf("16bit")!=-1));
var is_mac=(agt.indexOf("mac")!=-1);
if (is_win&&is_ie4up) document.write(''+'<scr'+'ipt language="VBScript">'+'\n'+'Function Flash_checkForActiveX()'+'\n'+'Dim hasPlayer,playerversion'+'\n'+'hasPlayer=false'+'\n'+'playerversion=10'+'\n'+'Do While playerversion>=minPlayer'+'\n'+'On Error Resume Next'+'\n'+'hasPlayer=(IsObject(CreateObject(\"ShockwaveFlash.ShockwaveFlash.\"&playerversion&\"\")))'+'\n'+'If hasPlayer=true Then Exit Do'+'\n'+'playerversion=playerversion-1'+'\n'+'Loop'+'\n'+'Flash_checkForActiveX=hasPlayer'+'\n'+'End Function'+'\n</scr'+'ipt>');

function Flash_checkForPlugIn(){
var plugin=(navigator.mimeTypes&&navigator.mimeTypes["application/x-shockwave-flash"]) ?
  navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if(plugin){var pluginversion=parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) 
if(pluginversion>=minPlayer){return true;}}
return false;}


function new_checkPlugin(){
if(is_win&&is_ie4up) flashPlugIn=Flash_checkForActiveX();
else{if((is_mac&&is_ie4up)||(is_nav4up)) flashPlugIn=Flash_checkForPlugIn();}
if(flashPlugIn) stampa_flash();//return true;//generaflash(nomeflash,flashpixw,flashpixh);
else stampa_no_flash();//return false;//generaimg(nomeimmagine,imgpixw,imgpixh,par_link);
}

function stampa_flash() {
document.write('');
}


function stampa_no_flash() {
document.write('<img src=images/transparent.png border=0>');
}



var marked_row = new Array; 
 /*
	function addLoadEvent(func) {
		var oldonload = window.onload;
		if (typeof window.onload != 'function') {
			window.onload = func;
		} else {
			window.onload = function() {
				oldonload();
				func();
			}
		}
	}
*/
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
       if (typeof func == "function") func();
    }
  }
} 
 
addLoadEvent(prepareMenu);
 
var imgMenuApri = new Image(9,9);
var imgMenuChiudi = new Image(9,9);
imgMenuApri.src = "images/nav_arrow_animated.gif";
imgMenuChiudi.src = "images/nav_arrow_animated2.gif";


function prepareMenu() {
	if (!document.getElementById || !document.getElementsByTagName) return false;
	if (!document.getElementById("menu")) return false;

	var links = document.getElementById("menu").getElementsByTagName("a");
	for (var i=0; i<links.length; i++) {
  
			links[i].onclick = function() {
				if (this.parentNode.getElementsByTagName("UL")[0] != undefined) {
					toggleMenu(this.parentNode.getElementsByTagName("UL")[0], this.href);
					return false;				
				}
			}  
	}
} 


function toggleMenu(node, link) {


	if (!document.getElementById) return false;
	if (!link) return false;
	
	
	if (!node) {
		location.href = link;
		return;
	}
	
	// Collapse all nodes, and only show clicked node (when clicking top level of menu)
//	if (node.parentNode.parentNode.id == "menu") {
		hideTopLevels(node);
//	}

	var numMenu = new String(node.id);
	numMenu = numMenu.replace("menu",''); 

	if (node.style.display == "" || node.style.display == "block") {
		if ($('imgLeft'+numMenu)) $('imgLeft'+numMenu).src = imgMenuChiudi.src+"?random=";
		if ($('liChange'+numMenu)) $('liChange'+numMenu).style.background = "";

		 new Effect.BlindUp(node.id, {duration: 0.1, queue: 'end', afterFinish:  settCookies(node.id,numMenu,'none') }); 
	} else {

		if ($('imgLeft'+numMenu)) $('imgLeft'+numMenu).src = imgMenuApri.src;
		if ($('liChange'+numMenu)) $('liChange'+numMenu).style.background = "#D2D2D2";

		 new Effect.BlindDown(node.id, {duration: 0.1, queue: 'end',afterFinish:  settCookies(node.id,numMenu,'block') }); 
	}

}

function hideTopLevels(nodoz) {
	if (!document.getElementById) return false;
	if (!(node = document.getElementById("menu"))) return false;	
	
	var parentuno = (nodoz.parentNode.id) ? nodoz.parentNode.id : false;
	var parentdue = (nodoz.parentNode.parentNode.id) ? nodoz.parentNode.parentNode.id : false;
	var parenttre = (nodoz.parentNode.parentNode.parentNode.id) ? nodoz.parentNode.parentNode.parentNode.id : false;
		

		var someNodeList = $('menu').getElementsByTagName('ul');
		var nodes = $A(someNodeList);

		nodes.each(function(node){ 
				if (parentuno == node.id || parentdue == node.id || parenttre == node.id) return false;
				if (node.style.display == 'block' || node.style.display == '') {
					if (node.id != undefined) {
						var numMenu = new String(node.id);
						numMenu = numMenu.replace("menu",''); 
						//alert(numMenu);
						if ($('liChange'+numMenu))
							$('liChange'+numMenu).style.background = "";

						if ($('imgLeft'+numMenu))
							$('imgLeft'+numMenu).src = imgMenuChiudi.src;

						new  Effect.BlindUp(node.id, {duration: 0.1,queue: 'end',afterFinish:  settCookies(node.id,numMenu,'none')  }); 				
					}
				}

			});


}
 
function settCookies(a,b,type) {
	SetCookie(a, type);

	if ($('imgLeft'+b) && type == "none") {
		$('imgLeft'+b).src = "images/nav_arrow.gif"; 
	}

}
 


function mmenuOLD(mID) {
	var menu = document.getElementById(mID);
	var display = menu.style.display;
//	menu.style.display = (display == "block") ? "none" : "block";	

	if (display == "block") { 
	 // BLOCK CHIUDE
		  SetCookie(mID, "block");
		  menu.style.display = "none";
	}else if(display == "none") { 
	// NONE APRE
		  SetCookie(mID, "none");
		  menu.style.display = "block";
	}
	
	

//	menu.parentNode.style.listStyleImage = "";
}


 


function getCookieVal (offset)  
   {

   var endstr = document.cookie.indexOf (";", offset);
   if (endstr == -1)
      endstr = document.cookie.length;
   return unescape(document.cookie.substring(offset, endstr));
   } 

function GetCookie (name) 

   { 
   var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) 
      {
      var j = i + alen;
      if (document.cookie.substring(i, j) == arg)
         return getCookieVal (j);
      i = document.cookie.indexOf(" ", i) + 1;
      if (i == 0) 
         break; 
      }
   return null;

   }


function SetCookie (name, value) 

   {
   var argv = SetCookie.arguments;
   var argc = SetCookie.arguments.length;
   var expires = (2 < argc) ? argv[2] : null;
   var path = (3 < argc) ? argv[3] : null;
   var domain = (4 < argc) ? argv[4] : null;
   var secure = (5 < argc) ? argv[5] : false;
   document.cookie = name + "=" + escape (value) +
     ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
     ((path == null) ? "" : ("; path=" + path)) +
     ((domain == null) ? "" : ("; domain=" + domain)) +
        ((secure == true) ? "; secure" : "");
   }


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function removeText(field){
field.value = '';
}

function vai(v) {
	window.location.href = 'modules.php?name='+v;
}

function redirect(url) {
	window.location.href = url;
}

/**
 * Sets/unsets the pointer and marker in browse mode
 *
 * @param   object    the table row
 * @param   interger  the row number
 * @param   string    the action calling this script (over, out or click)
 * @param   string    the default background color
 * @param   string    the color to use for mouseover
 * @param   string    the color to use for marking a row
 *
 * @return  boolean  whether pointer is set or not
 */
function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
    var theCells = null;

    // 1. Pointer and mark feature are disabled or the browser can't get the
    //    row -> exits
    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }

    // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    // 3. Gets the current color...
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    // 3.1 ... with DOM compatible browsers except Opera that does not return
    //         valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    } // end 3

    // 3.3 ... Opera changes colors set via HTML to rgb(r,g,b) format so fix it
    if (currentColor.indexOf("rgb") >= 0) 
    {
        var rgbStr = currentColor.slice(currentColor.indexOf('(') + 1,
                                     currentColor.indexOf(')'));
        var rgbValues = rgbStr.split(",");
        currentColor = "#";
        var hexChars = "0123456789ABCDEF";
        for (var i = 0; i < 3; i++)
        {
            var v = rgbValues[i].valueOf();
            currentColor += hexChars.charAt(v/16) + hexChars.charAt(v%16);
        }
    }

    // 4. Defines the new color
    // 4.1 Current color is the default one
    if (currentColor == ''
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor              = thePointerColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;
        }
    }
    // 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
             && (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])) {
        if (theAction == 'out') {
            newColor              = theDefaultColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;
        }
    }
    // 4.1.3 Current color is the marker one
    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
        if (theAction == 'click') {
            newColor              = (thePointerColor != '')
                                  ? thePointerColor
                                  : theDefaultColor;
            marked_row[theRowNum] = (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])
                                  ? true
                                  : null;
        }
    } // end 4

    // 5. Sets the new color...
    if (newColor) {
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } // end 5

    return true;
} // end of the 'setPointer()' function






/***********************************************
* Ultimate Fade-In Slideshow (v1.5): © Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
 
var fadeimages=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
fadeimages[0]=["images/distributore_ufficiale/01.png", "http://www.acer.it", "http://www.acer.it"] //plain image syntax
fadeimages[1]=["images/distributore_ufficiale/03.png", "http://www.magnex.it", "http://www.magnex.it"] //image with link syntax
fadeimages[2]=["images/distributore_ufficiale/04.png", "http://www.aopen.it", "http://www.aopen.it"] //image with link syntax
fadeimages[3]=["images/distributore_ufficiale/05.png", "http://www.tp-link.com", "http://www.tp-link.com"] //image with link syntax
fadeimages[4]=["images/distributore_ufficiale/06.png", "http://www.netgear.it", "http://www.netgear.it"] //image with link syntax
fadeimages[5]=["images/distributore_ufficiale/07.png", "", ""] //image with link syntax



var fadebgcolor="#eaebe8"
 
////NO need to edit beyond here/////////////
 
var fadearray=new Array() //array to cache fadeshow instances
var fadeclear=new Array() //array to cache corresponding clearinterval pointers
 
var dom=(document.getElementById) //modern dom browsers
var iebrowser=document.all
 
function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){
this.pausecheck=pause
this.mouseovercheck=0
this.delay=delay
this.degree=10 //initial opacity degree (10%)
this.curimageindex=0
this.nextimageindex=1
fadearray[fadearray.length]=this
this.slideshowid=fadearray.length-1
this.canvasbase="canvas"+this.slideshowid
this.curcanvas=this.canvasbase+"_0"
if (typeof displayorder!="undefined")
theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)
this.theimages=theimages
this.imageborder=parseInt(borderwidth)
this.postimages=new Array() //preload images
for (p=0;p<theimages.length;p++){
this.postimages[p]=new Image()
this.postimages[p].src=theimages[p][0]
}
 
var fadewidth=fadewidth+this.imageborder*2
var fadeheight=fadeheight+this.imageborder*2
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers (ie: Firefox)
document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);-moz-opacity:10;-khtml-opacity:10;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);-moz-opacity:10;background-color:'+fadebgcolor+'"></div></div>')
else
document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>')
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox
this.startit()
else{
this.curimageindex++
setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay)
}
}

function fadepic(obj){
if (obj.degree<100){
obj.degree+=10
if (obj.tempobj.filters&&obj.tempobj.filters[0]){
if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+
obj.tempobj.filters[0].opacity=obj.degree
else //else if IE5.5-
obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
}
else if (obj.tempobj.style.MozOpacity)
obj.tempobj.style.MozOpacity=obj.degree/101
else if (obj.tempobj.style.KhtmlOpacity)
obj.tempobj.style.KhtmlOpacity=obj.degree/100
}
else{
clearInterval(fadeclear[obj.slideshowid])
obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
obj.populateslide(obj.tempobj, obj.nextimageindex)
obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
}
}
 
fadeshow.prototype.populateslide=function(picobj, picindex){
var slideHTML=""
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'
slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML+='</a>'
picobj.innerHTML=slideHTML
}
 
 
fadeshow.prototype.rotateimage=function(){
if (this.pausecheck==1) //if pause onMouseover enabled, cache object
var cacheobj=this
if (this.mouseovercheck==1)
setTimeout(function(){cacheobj.rotateimage()}, 100)
else if (iebrowser&&dom||dom){
this.resetit()
var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
crossobj.style.zIndex++
fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50)
this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
}
else{
var ns4imgobj=document.images['defaultslide'+this.slideshowid]
ns4imgobj.src=this.postimages[this.curimageindex].src
}
this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
}
 
fadeshow.prototype.resetit=function(){
this.degree=10
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
if (crossobj.filters&&crossobj.filters[0]){
if (typeof crossobj.filters[0].opacity=="number") //if IE6+
crossobj.filters(0).opacity=this.degree
else //else if IE5.5-
crossobj.style.filter="alpha(opacity="+this.degree+")"
}
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=this.degree/101
else if (crossobj.style.KhtmlOpacity)
crossobj.style.KhtmlOpacity=obj.degree/100
}
 
 
fadeshow.prototype.startit=function(){
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
this.populateslide(crossobj, this.curimageindex)
if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
var cacheobj=this
var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid)
crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}
crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}
}
this.rotateimage()
} 



