//LOGOUT UTENTE
function LogOut() {
  bConfirm=window.confirm("Disconnettersi dal sito?");
  if (bConfirm) {
    location.href=APPLICATIONPATH + "formLogin.asp?Mode=LOGOUT";
  }
}

//Modifica dati utente
function User_ModifyData() {
  location.href=APPLICATIONPATH + "formRegisterUser.asp?Mode=MODIFY";
}

//Mostra contabilità utente
function User_ShowECOMOrders() {
  location.href=APPLICATIONPATH + "formUser_ECOMOrders.asp";
}

//Apri pannello di controllo amministrativo
function OpenPDC() {  
  sFeatures="resizable=yes, status=yes, menubar=yes, toolbar=yes";
  winext=window.open(APPLICATIONPATH + "admin/default.asp","_blank",sFeatures);
  if (window.screen) {
    winext.window.moveTo(0,0);
    winext.window.resizeTo(screen.availWidth,screen.availHeight);
    winext.focus();
  }
}

//Apri carrello articoli
function ShowECOMCart() {
  location.href=APPLICATIONPATH + "formECOMCart.asp";
}


//Apre un link
function GoToLink(sLocation,bBlankWindow) {
  location.href=sLocation;
}


//Apre una pagina in modalità di stampa
function OpenWindowForPrint(sLocation,iWidth,iHeight) {
  var sPath="";
  sPath=APPLICATIONPATH + "controls/Print/Print.asp?Path=" + sLocation;
  var oWindow=window.open(sPath,"","status=no,toolbar=no,scrollbars=yes,menubar=no,location=no,resizable=no,height=" + iHeight + ",width=" + iWidth + ",top=20,left=20");
  oWindow.focus();
}


//Apre finestra
function OpenWindow(sLocation) {
  var oWindow=window.open(sLocation,"","status=yes,toolbar=yes,scrollbars=yes,menubar=no,location=yes,resizable=yes,height=550,width=700,top=20,left=20");
  oWindow.focus();
}

//Apre finestra galleria immagini
function ShowGallery(sLocation) {
  var oWindow=window.open(sLocation,"","status=no,toolbar=no,scrollbars=no,menubar=no,location=no,resizable=no,height=550,width=650,top=20,left=20");
  oWindow.focus();
}


//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 later
			return false;
		} else {
		    //Flash more
			return true;
		} 

	}

} 

//Genera il file flash o l'alternativa statica//ex. generatorflash("filename.swf",300,200,"#ffffff","6","6,0,79,0","","")
function generatorflash(nomefile,width,height,bgcolor,version,playerversion,no1,no2) {

var N1;
var NNONE;
	NNONE= no1 + no2;
	
	if (no2 == 'noticker' || no1 == '') {
		var NNONE='';		//var NNONE = '<a href="http://www.kataweb.it/requisiti_sistema.html" target="_blank" style="display: block;text-align:center;font: 10px Verdana, Arial, sans-serif;color: #000;"><img src="http://www.kataweb.it/images/flash.gif" width="22" height="27" hspace="4" border="0" align="absmiddle">Per un corretta visualizzazione del sito consulta la pagina dei requisiti di sistema</a>';
		//alert(nomefile);
	} 	
	
	N1=('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + version + '" ID="objflashmovie" 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=false>');
	N1= N1+ ('<embed src="' + nomefile + '" quality=high 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);


}

