/*******************************************************************************
* java script library
********************************************************************************/

/***
* varabili che controllano le window nel contesto di chiamata
****/
var Winshop = null;
var Winzoom = null;
var Winpreview = null;

/***
* Funzione Base OpenView
***/
function OpenView( sUrl, sfeatures, owin )
{		
	if( owin && !owin.closed )
	{		
		owin.navigate( sUrl );
		owin.focus();
	}
	else 	
	{		
		owin = window.open( sUrl, "_blank", sfeatures, true );
		if( owin == null )		
			showHiddenMessage();		
	}
	return owin;
}

/***
* Get message from input type hidden and show it! (già tradotto)
***/
function showHiddenMessage()
{
	var el = document.getElementById("HiddenMessage")	
	if( el != null )	
		alert( el.value );		
}

/***
* Apertura Preview: da Prodotti cad e demo doc del download
***/
function OpenPreview( direct, indice ) 
{		
	var sUrl = "../Preview/Preview.aspx?dir=" +  direct + "&ind=" + indice	
	var sfeatures = "width=600,height=560,left=5,top=5,status=no,toolbar=no,menubar=no"		
	
	Winpreview = OpenView( sUrl, sfeatures, Winpreview );
}	

/***
* Apertura Zoom: dettaglio del catalogo materiali. Shoopping Catalogo.aspx
***/	
function OpenZoom( articolo, img, descrizione ) 
{	
	var sUrl = "../Preview/Zoom.aspx?cod=" +  articolo +  "&img=" + img +  "&desc=" + descrizione		
	var sfeatures = "width=560,height=510,left=5,top=5,status=no,toolbar=no,menubar=no"		
	
	Winzoom = OpenView( sUrl, sfeatures, Winzoom );
}


/***
* Apertura del Carrello per la selezioni dei materiali. Shoopping  Catalogo.aspx  
***/
function OpenCarrello( articolo, descrizione, disponibile, prodotto ) 
{	
	var sUrl = "Carrello.aspx?cod=" + articolo 
	var sfeatures = "width=850,height=640,left=5,top=5,status=no,toolbar=no,menubar=no,scrollbars=yes"			
	sUrl += "&desc=" + descrizione 	
	sUrl += "&disp=" + disponibile 
	sUrl += "&prod=" + prodotto 		
	Winshop = OpenView( sUrl, sfeatures, Winshop );
}

/***
* Apertura Messaggi: Support Bridge.aspx
***/

function openMessage()
{

	var sfeatures = "width=1024,height=768,left=50,top=50,directories=no,toolbar=no,resizable=yes";	
	var backurl, re; 	
	
	OpenView( "FrameMsg.htm", sfeatures, null);	
			
	// non farti ingannare dalla strana sintassi, le righe successive non
	// fanno altro che sostituire MainPage.aspx al path completo di questa 
	// pagina e tornare indietro con l'oggetto history
	re = /Bridge.aspx/g		
	backurl = location.href.replace( re, "MpSupport.aspx" )					
	history.go( backurl );		
}

/***
* Apertura Note: Chiamata Download.aspx 
***/		
function openNote( prodotto )
{					
	var versione = ""	
	var sUrl = "note.aspx?prodotto=" + prodotto + "&versione=" + versione	
	var sfeatures = "height=600,width=700,left=200,top=5,status=no,toolbar=no,menubar=no,titlebar=yes,resizable=yes,scrollbars=yes" 
	
	OpenView( sUrl, sfeatures, null);	
}

/***
* Apertura Messaggi: Support Legenda.aspx 
***/
function openNewMessage( )
{  	
	var sfeatures  = "height=750,width=850,left=100,top=100,status=no,resizable=no,toolbar=no,menubar=no"   
	
	OpenView( "SceltaAssist.aspx", sfeatures, null);		
}

/***
* importantissima : Chiamata  su  Body onunload di Legenda.aspx
***/
function listReload()
{		
	window.parent.location.reload(true);
}
			
