// clanza@imteam.it - versione 2.0 - 2002/10/04

function init(){
	is = new BrowserCheck();
	return true;
}

function BrowserCheck() {
	this.ns4 = (document.layers);
	this.ns6 = (!document.all && document.getElementById);
	this.ie4 = (document.all && !document.getElementById);
	this.ie5 = (document.all && document.getElementById);
	return true;
}

function showObject(obj) {
  	if (is.ns4) {
		this.layer = window.document[obj];
		this.layer.visibility = "show";
	}
  	if (is.ie4) {
		this.element = window.document.all[obj];
		this.style = this.element.style;
		this.style.visibility = "visible";
	}
  	if (is.ns6 || is.ie5) {
		this.element = document.getElementById(obj);
		this.style = this.element.style;
		this.style.visibility = "visible";
	}
	return true;
}

function hideObject(obj) {
  	if (is.ns4) {
		this.layer = window.document[obj];
		this.layer.visibility = "hide";
	}
  	if (is.ie4) {
		this.element = window.document.all[obj];
		this.style = this.element.style;
		this.style.visibility = "hidden";
	}
  	if (is.ns6 || is.ie5) {
		this.element = document.getElementById(obj);
		this.style = this.element.style;
		this.style.visibility = "hidden";
	}
	return true;
}

function resetObject(obj, val_height) {
  if (is.ns4) {
		this.layer = window.document[obj];
		this.layer.height = val_height;
	}
  	if (is.ie4) {
		this.element = window.document.all[obj];
		this.style = this.element.style;
		this.style.height = val_height;
	}
  	if (is.ns6 || is.ie5) {
		this.element = document.getElementById(obj);
		this.style = this.element.style;
		this.style.height = val_height;
	}
	return true;
}

function setBody(layer,obj,body) {
  //netscape 4.x
  if (is.ns4) {
		this.layer = window.document[obj];
		for(var i = 0; i < body.length; i++) {
			this.layer.document.writeln(body[i]);
    }
		this.layer.document.close();
	}
  //internet explorer 4.x
  if (is.ie4) {
		this.element = window.document.all[obj];
    this.element.innerHTML = body;
  }
  //internet explorer 5.x e 6.x
  //netscape 6.x e 7.x
  if (is.ie5 || is.ns6) {
	this.element = document.getElementById(obj);
    this.element.innerHTML = body;
  }
	return true;  
}

function changeImage(imgName,imgObj,obj) {
	is = new BrowserCheck();
  //netscape 4.x
  if (is.ns4) {
    this.layer = window.document[obj];
    this.layer.document.images[imgName].src = imgObj;
//old//		eval("document.images[" + imgName + "].src = '" + imgObj + "'");
	}
  //internet explorer 4.x
  if (is.ie4) {
    document.images[imgName].src = imgObj;
  }
  //internet explorer 5.x e 6.x
  //netscape 6.x e 7.x
  if (is.ie5 || is.ns6) {
    document.images[imgName].src = imgObj;
  }
  return true; 
}
function ApriProd(pag,prodotto) {
	  var pagina;
	  
	  //if (pag<10){
	  //	codice = "0" + pag;
	  //} else {
	  //	codice = pag;
	  //} 	
	  
	  codice = pag;
	  
	  if (prodotto<10){
	  	codice = codice + "_0" + prodotto;
	  } else {
	  	codice = codice + "_" + prodotto;
	  }
		var titolo = "prod_" + prodotto;  
	  
	  window.open('popup.php?img=' + codice,titolo,"width=350,height=350,toolbar=no,title=no,directories=no,scrollbars=no,resizable=no");
	  
	}
	
// Compone URL

function urlcomposer(base) {
	loc = window.location.toString();
    subs = loc.substr(loc.indexOf(base) + base.length).split("/");
	 
	//a = (loc.indexOf() == -1) ? 1 : 2;
    for (i = 0; i < (subs.length); i++) {
        //subs[i] = makeCaps(unescape(subs[i]));
	
		host = subs[0];
		var context =  "";
	}
		
}


//Flash detect
function flashdetect(version) {
 
var playerversion = version;
 
	 if (navigator.appVersion.indexOf("MSIE 4.5") != -1) {
	 
	 	return true;
	 
	 } else {
  
		 var agent = navigator.userAgent.toLowerCase();
		 gotflash = 0;
		 if (navigator.mimeTypes
		   && navigator.mimeTypes["application/x-shockwave-flash"]
		   && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin
		   && navigator.plugins
		   && navigator.plugins["Shockwave Flash"]){
			// NS3+ and Opera3+ (support plugin array):  check for Flash plugin in plugin array
			if (navigator.plugins != null && navigator.plugins.length > 0) {
				var flashPlugin = navigator.plugins['Shockwave Flash'];
				if (typeof flashPlugin == 'object') {
				desc = flashPlugin.description;
				startpnt = desc.indexOf('Flash') +6;
		     endpnt = desc.indexOf('.');
				gotflash = parseInt((desc.substring(startpnt, endpnt)));
				}
			}
		}
		
		// Check the browser...we're looking for ie/win, but not aol
		var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;    // true if we're on ie
		var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; // true if we're on windows


		// This is a js1.1 code block, so make note that js1.1 is supported.
		jsVersion = 1.1;

		// Write vbscript detection on ie win. IE on Windows doesn't support regular
		// JavaScript plugins array detection.
		if(isIE && isWin){
	
		var WM_startTagFix = '</';
		document.writeln('<script language="VBscript">');
		document.writeln('on error resume next');
		document.writeln('if IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.10")) then gotflash = 10');
		document.writeln('if gotflash < 10 and IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9")) then gotflash = 9');
		document.writeln('if gotflash < 9 and IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8")) then gotflash = 8');
		document.writeln('if gotflash < 8 and IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7")) then gotflash = 7');
		document.writeln('if gotflash < 7 and IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6")) then gotflash = 6');
		document.writeln('if gotflash < 6 and IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5")) then gotflash = 5');
		document.writeln('if gotflash < 5 and IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4")) then gotflash = 4');
		document.writeln('if gotflash < 4 and IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3")) then gotflash = 3'); 
		document.writeln(WM_startTagFix+'script>');
		}		
			
		if (gotflash < playerversion){
			//Flash 4 or later
			return false;
		} else {
		    //Flash 5 or more
			return true;
		} 

	}

} 

// Genera il flash o l'alternativa statica
function generatorflash(nomefile,width,height,bgcolor,version,playerversion,no1,no2) {

var playerversion = 7;
var N1;
var NNONE;
	NNONE= no1;	
	
	N1=('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + version + '" ID="ticker_news" WIDTH="' + width + '" HEIGHT="' + height + '">');
	N1= N1+ ('<PARAM NAME=movie VALUE="' + nomefile + '">');
	N1= N1+ ('<PARAM NAME=quality VALUE=high>');
	N1= N1+ ('<PARAM NAME=bgcolor VALUE=#' + bgcolor + '>');
	N1= N1+ ('<PARAM NAME=menu VALUE=False>');
	N1= N1+ ('<PARAM NAME=borders VALUE=noborder>');
	N1= N1+ ('<PARAM NAME=loop VALUE=true>');
	N1= N1+ ('<embed src="' + nomefile + '" quality=high loop=true menu=false bgcolor=#' + bgcolor + '');
	N1= N1+ ('swLiveConnect="FALSE" WIDTH="' + width + '" HEIGHT="' + height + '" border="0" TYPE="application/x-shockwave-flash"');
	N1= N1+ ('PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></embed></OBJECT>')

if (flashdetect(playerversion)) document.write(N1);

else { document.write(NNONE); setTimeout("document.location.replace('http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&Lang=Italian&P5_Language=Italian')",5000); }


}

// Genera solo il flash
function generatorflashunico(nomefile,width,height,bgcolor,version,playerversion2,no1,no2) {

var playerversion2 = 7;
var M1;
var MNONE;
	MNONE= no1;	
	
	M1=('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + version + '" ID="ticker_news" WIDTH="' + width + '" HEIGHT="' + height + '">');
	M1= M1+ ('<PARAM NAME=movie VALUE="' + nomefile + '">');
	M1= M1+ ('<PARAM NAME=quality VALUE=high>');
	M1= M1+ ('<PARAM NAME=bgcolor VALUE=#' + bgcolor + '>');
	M1= M1+ ('<PARAM NAME=wmode VALUE=transparent>');
	M1= M1+ ('<PARAM NAME=menu VALUE=False>');
	M1= M1+ ('<PARAM NAME=borders VALUE=noborder>');
	M1= M1+ ('<PARAM NAME=loop VALUE=true>');
	M1= M1+ ('<embed src="' + nomefile + '" quality=high loop=true wmode=transparent menu=false bgcolor=#' + bgcolor + '');
	M1= M1+ ('swLiveConnect="FALSE" WIDTH="' + width + '" HEIGHT="' + height + '" border="0" TYPE="application/x-shockwave-flash"');
	M1= M1+ ('PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></embed></OBJECT>')

   document.write(M1);

}








