//load e unload body
function bodyLoad()
{
	//riscrivo lo stato user dopo aver letto la lingua
	var codlingu=document.getElementById("pcodlingu").value;
	loadUserStatus(codlingu);
}
function bodyUnload()
{
	//
}
//caricamento userData AJAX
function loadUserStatus(codlingu)
{
	AJAX_LeggiURL('AJAX_UserStatus.aspx?dummy=1&lang=' + codlingu,'UserStatusDiv');
}

//recupero form
function getForm1()
{
	var theform;
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		theform = document.Form1;
	}
	else {
		theform = document.forms["Form1"];
	}
	return theform;
}

//gestione paging
function gotoPage(i)
{
	var theform=getForm1();
	theform.elements["GOTOPAGE_HIDDEN"].value=i;
	__doPostBack("","");
	if (event) {event.returnValue=0;}
	return false;
}
/* message box modali */

/* parte 1: definizione oggetto */
DHTML_modalMessage = function()
{
	var url;								// url of modal message
	var htmlOfModalMessage;					// html of modal message
	
	var divs_transparentDiv;				// Transparent div covering page content
	var divs_content;						// Modal message div.
	var iframe;								// Iframe used in ie
	var layoutCss;							// Name of css file;
	var width;								// Width of message box
	var height;								// Height of message box
	
	var existingBodyOverFlowStyle;			// Existing body overflow css
	var dynContentObj;						// Reference to dynamic content object
	var cssClassOfMessageBox;				// Alternative css class of message box - in case you want a different appearance on one of them
	var shadowDivVisible;					// Shadow div visible ? 
	var shadowOffset; 						// X and Y offset of shadow(pixels from content box)
	var MSIE;
		
	this.url = '';							// Default url is blank
	this.htmlOfModalMessage = '';			// Default message is blank
	this.layoutCss = 'modal-message.css';	// Default CSS file
	this.height = 200;						// Default height of modal message
	this.width = 400;						// Default width of modal message
	this.cssClassOfMessageBox = false;		// Default alternative css class for the message box
	this.shadowDivVisible = true;			// Shadow div is visible by default
	this.shadowOffset = 5;					// Default shadow offset.
	this.MSIE = false;
	if(navigator.userAgent.indexOf('MSIE')>=0) this.MSIE = true;
	

}

DHTML_modalMessage.prototype = {
	// {{{ setSource(urlOfSource)
    /**
     *	Set source of the modal dialog box
     * 	
     *
     * @public	
     */		
	setSource : function(urlOfSource)
	{
		this.url = urlOfSource;
		
	}	
	// }}}	
	,
	// {{{ setHtmlContent(newHtmlContent)
    /**
     *	Setting static HTML content for the modal dialog box.
     * 	
     *	@param String newHtmlContent = Static HTML content of box
     *
     * @public	
     */		
	setHtmlContent : function(newHtmlContent)
	{
		this.htmlOfModalMessage = newHtmlContent;
		
	}
	// }}}		
	,
	// {{{ setSize(width,height)
    /**
     *	Set the size of the modal dialog box
     * 	
     *	@param int width = width of box
     *	@param int height = height of box
     *
     * @public	
     */		
	setSize : function(width,height)
	{
		if(width)this.width = width;
		if(height)this.height = height;		
	}
	// }}}		
	,		
	// {{{ setCssClassMessageBox(newCssClass)
    /**
     *	Assign the message box to a new css class.(in case you wants a different appearance on one of them)
     * 	
     *	@param String newCssClass = Name of new css class (Pass false if you want to change back to default)
     *
     * @public	
     */		
	setCssClassMessageBox : function(newCssClass)
	{
		this.cssClassOfMessageBox = newCssClass;
		if(this.divs_content){
			if(this.cssClassOfMessageBox)
				this.divs_content.className=this.cssClassOfMessageBox;
			else
				this.divs_content.className='modalDialog_contentDiv';	
		}
					
	}
	// }}}		
	,	
	// {{{ setShadowOffset(newShadowOffset)
    /**
     *	Specify the size of shadow
     * 	
     *	@param Int newShadowOffset = Offset of shadow div(in pixels from message box - x and y)
     *
     * @public	
     */		
	setShadowOffset : function(newShadowOffset)
	{
		this.shadowOffset = newShadowOffset
					
	}
	// }}}		
	,	
	// {{{ display()
    /**
     *	Display the modal dialog box
     * 	
     *
     * @public	
     */		
	display : function()
	{
		if(!this.divs_transparentDiv){
			this.__createDivs();
		}	
		
		// Redisplaying divs
		this.divs_transparentDiv.style.display='block';
		this.divs_content.style.display='block';
		this.divs_shadow.style.display='block';		
		if(this.MSIE)this.iframe.style.display='block';	
		this.__resizeDivs();
		
		/* Call the __resizeDivs method twice in case the css file has changed. The first execution of this method may not catch these changes */
		window.refToThisModalBoxObj = this;		
		setTimeout('window.refToThisModalBoxObj.__resizeDivs()',150);
		
		this.__insertContent();	// Calling method which inserts content into the message div.
	}
	// }}}		
	,
	// {{{ ()
    /**
     *	Display the modal dialog box
     * 	
     *
     * @public	
     */		
	setShadowDivVisible : function(visible)
	{
		this.shadowDivVisible = visible;
	}
	// }}}	
	,
	// {{{ close()
    /**
     *	Close the modal dialog box
     * 	
     *
     * @public	
     */		
	close : function()
	{
		//document.documentElement.style.overflow = '';	// Setting the CSS overflow attribute of the <html> tag back to default.
		
		/* Hiding divs */
		this.divs_transparentDiv.style.display='none';
		this.divs_content.style.display='none';
		this.divs_shadow.style.display='none';
		if(this.MSIE)this.iframe.style.display='none';
		
	}	
	// }}}	
	,
	// {{{ __addEvent()
    /**
     *	Add event
     * 	
     *
     * @private	
     */		
	addEvent : function(whichObject,eventType,functionName,suffix)
	{ 
	  if(!suffix)suffix = '';
	  if(whichObject.attachEvent){ 
	    whichObject['e'+eventType+functionName+suffix] = functionName; 
	    whichObject[eventType+functionName+suffix] = function(){whichObject['e'+eventType+functionName+suffix]( window.event );} 
	    whichObject.attachEvent( 'on'+eventType, whichObject[eventType+functionName+suffix] ); 
	  } else 
	    whichObject.addEventListener(eventType,functionName,false); 	    
	} 
	// }}}	
	,
	// {{{ __createDivs()
    /**
     *	Create the divs for the modal dialog box
     * 	
     *
     * @private	
     */		
	__createDivs : function()
	{
		// Creating transparent div
		this.divs_transparentDiv = document.createElement('DIV');
		this.divs_transparentDiv.className='modalDialog_transparentDivs';
		this.divs_transparentDiv.style.left = '0px';
		this.divs_transparentDiv.style.top = '0px';
		
		document.body.appendChild(this.divs_transparentDiv);
		// Creating content div
		this.divs_content = document.createElement('DIV');
		this.divs_content.className = 'modalDialog_contentDiv';
		this.divs_content.id = 'DHTMLSuite_modalBox_contentDiv';
		this.divs_content.style.zIndex = 100000;
		
		if(this.MSIE){
			this.iframe = document.createElement('<IFRAME src="about:blank" frameborder=0>');
			this.iframe.style.zIndex = 90000;
			this.iframe.style.position = 'absolute';
			document.body.appendChild(this.iframe);	
		}
			
		document.body.appendChild(this.divs_content);
		// Creating shadow div
		this.divs_shadow = document.createElement('DIV');
		this.divs_shadow.className = 'modalDialog_contentDiv_shadow';
		this.divs_shadow.style.zIndex = 95000;
		document.body.appendChild(this.divs_shadow);
		window.refToModMessage = this;
		this.addEvent(window,'scroll',function(e){ window.refToModMessage.__repositionTransparentDiv() });
		this.addEvent(window,'resize',function(e){ window.refToModMessage.__repositionTransparentDiv() });
		

	}
	// }}}
	,
	// {{{ __getBrowserSize()
    /**
     *	Get browser size
     * 	
     *
     * @private	
     */		
	__getBrowserSize : function()
	{
    	var bodyWidth = document.documentElement.clientWidth;
    	var bodyHeight = document.documentElement.clientHeight;
    	
		var bodyWidth, bodyHeight; 
		if (self.innerHeight){ // all except Explorer 
		 
		   bodyWidth = self.innerWidth; 
		   bodyHeight = self.innerHeight; 
		}  else if (document.documentElement && document.documentElement.clientHeight) {
		   // Explorer 6 Strict Mode 		 
		   bodyWidth = document.documentElement.clientWidth; 
		   bodyHeight = document.documentElement.clientHeight; 
		} else if (document.body) {// other Explorers 		 
		   bodyWidth = document.body.clientWidth; 
		   bodyHeight = document.body.clientHeight; 
		} 
		return [bodyWidth,bodyHeight];		
		
	}
	// }}}	
	,
	// {{{ __resizeDivs()
    /**
     *	Resize the message divs
     * 	
     *
     * @private	
     */	
    __resizeDivs : function()
    {
    	
    	var topOffset = Math.max(document.body.scrollTop,document.documentElement.scrollTop);

		if(this.cssClassOfMessageBox)
			this.divs_content.className=this.cssClassOfMessageBox;
		else
			this.divs_content.className='modalDialog_contentDiv';	
			    	
    	if(!this.divs_transparentDiv)return;
    	
    	// Preserve scroll position
    	var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
    	var sl = Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);
    	
    	window.scrollTo(sl,st);
    	setTimeout('window.scrollTo(' + sl + ',' + st + ');',10);

    	this.__repositionTransparentDiv();
    	

		var brSize = this.__getBrowserSize();
		var bodyWidth = brSize[0];
		var bodyHeight = brSize[1];
    	
    	// Setting width and height of content div
      	this.divs_content.style.width = this.width + 'px';
    	this.divs_content.style.height= this.height + 'px';  	
    	
    	// Creating temporary width variables since the actual width of the content div could be larger than this.width and this.height(i.e. padding and border)
    	var tmpWidth = this.divs_content.offsetWidth;	
    	var tmpHeight = this.divs_content.offsetHeight;
    	
    	
    	// Setting width and height of left transparent div
		
    	this.divs_content.style.left = Math.ceil((bodyWidth - tmpWidth) / 2) + 'px';
    	this.divs_content.style.top = (Math.ceil((bodyHeight - tmpHeight) / 2) +  topOffset) + 'px';
    	
 		if(this.MSIE){
 			this.iframe.style.left = this.divs_content.style.left;
 			this.iframe.style.top = this.divs_content.style.top;
 			this.iframe.style.width = this.divs_content.style.width;
 			this.iframe.style.height = this.divs_content.style.height;
 		}
 		
    	this.divs_shadow.style.left = (this.divs_content.style.left.replace('px','')/1 + this.shadowOffset) + 'px';
    	this.divs_shadow.style.top = (this.divs_content.style.top.replace('px','')/1 + this.shadowOffset) + 'px';
    	this.divs_shadow.style.height = tmpHeight + 'px';
    	this.divs_shadow.style.width = tmpWidth + 'px';
    	
    	if(!this.shadowDivVisible)this.divs_shadow.style.display='none';	// Hiding shadow if it has been disabled
    	
    	
    }
    // }}}	
    ,
	// {{{ __insertContent()
    /**
     *	Insert content into the content div
     * 	
     *
     * @private	
     */	    
    __repositionTransparentDiv : function()
    {
    	this.divs_transparentDiv.style.top = Math.max(document.body.scrollTop,document.documentElement.scrollTop) + 'px';
    	this.divs_transparentDiv.style.left = Math.max(document.body.scrollLeft,document.documentElement.scrollLeft) + 'px';
		var brSize = this.__getBrowserSize();
		var bodyWidth = brSize[0];
		var bodyHeight = brSize[1];
    	this.divs_transparentDiv.style.width = bodyWidth + 'px';
    	this.divs_transparentDiv.style.height = bodyHeight + 'px';		
		   	
    }
	// }}}	
	,
	// {{{ __insertContent()
    /**
     *	Insert content into the content div
     * 	
     *
     * @private	
     */	
    __insertContent : function()
    {
		if(this.url){	// url specified - load content dynamically
			ajax_loadContent('DHTMLSuite_modalBox_contentDiv',this.url);
		}else{	// no url set, put static content inside the message box
			this.divs_content.innerHTML = this.htmlOfModalMessage;	
		}
    }		
}

/* parte 2: funzioni per visualizzare i messagebox */
messageObj = new DHTML_modalMessage();	// We only create one object of this class
messageObj.setShadowOffset(5);	// Large shadow

function displayAddedCart(codlingu)
{
	messageObj.setHtmlContent(htmlAddedCart(codlingu));
	messageObj.setSize(300,175);
	messageObj.setSource(false);	// no html source since we want to use a static message here.
	messageObj.setShadowDivVisible(false);	// Disable shadow for these boxes	
	messageObj.display();
}
function displayLogonSuccess_GoHome(codlingu)
{
	messageObj.setHtmlContent(htmlLogonSuccess_GoHome(codlingu));
	messageObj.setSize(300,175);
	messageObj.setSource(false);	// no html source since we want to use a static message here.
	messageObj.setShadowDivVisible(false);	// Disable shadow for these boxes	
	messageObj.display();
}
function displayLogonSuccess_GoCart(codlingu)
{
	messageObj.setHtmlContent(htmlLogonSuccess_GoCart(codlingu));
	messageObj.setSize(300,175);
	messageObj.setSource(false);	// no html source since we want to use a static message here.
	messageObj.setShadowDivVisible(false);	// Disable shadow for these boxes	
	messageObj.display();
}
function displayPasswordSent(codlingu)
{
	messageObj.setHtmlContent(htmlPasswordSent(codlingu));
	messageObj.setSize(300,175);
	messageObj.setSource(false);	// no html source since we want to use a static message here.
	messageObj.setShadowDivVisible(false);	// Disable shadow for these boxes	
	messageObj.display();
}
function displayPasswordSent_Logon(codlingu)
{
	messageObj.setHtmlContent(htmlPasswordSent_Logon(codlingu));
	messageObj.setSize(300,175);
	messageObj.setSource(false);	// no html source since we want to use a static message here.
	messageObj.setShadowDivVisible(false);	// Disable shadow for these boxes	
	messageObj.display();
}
function displayPasswordSent_GoCart(codlingu)
{
	messageObj.setHtmlContent(htmlPasswordSent_GoCart(codlingu));
	messageObj.setSize(300,175);
	messageObj.setSource(false);	// no html source since we want to use a static message here.
	messageObj.setShadowDivVisible(false);	// Disable shadow for these boxes	
	messageObj.display();
}
function displayMissingEgoMail(codlingu)
{
	messageObj.setHtmlContent(htmlMissingEgoMail(codlingu));
	messageObj.setSize(300,210);
	messageObj.setSource(false);	// no html source since we want to use a static message here.
	messageObj.setShadowDivVisible(false);	// Disable shadow for these boxes	
	messageObj.display();
}
function displayRegistration_ExistingUser(codlingu)
{
	messageObj.setHtmlContent(htmlRegistration_ExistingUser(codlingu));
	messageObj.setSize(300,210);
	messageObj.setSource(false);	// no html source since we want to use a static message here.
	messageObj.setShadowDivVisible(false);	// Disable shadow for these boxes	
	messageObj.display();
}
function displayRegistration_OK(codlingu)
{
	messageObj.setHtmlContent(htmlRegistration_OK(codlingu));
	messageObj.setSize(300,210);
	messageObj.setSource(false);	// no html source since we want to use a static message here.
	messageObj.setShadowDivVisible(false);	// Disable shadow for these boxes	
	messageObj.display();
}
function displayRegistration_OK_GoCart(codlingu)
{
	messageObj.setHtmlContent(htmlRegistration_OK_GoCart(codlingu));
	messageObj.setSize(300,210);
	messageObj.setSource(false);	// no html source since we want to use a static message here.
	messageObj.setShadowDivVisible(false);	// Disable shadow for these boxes	
	messageObj.display();
}
function displayGenericInfoMessage(msg)
{
	messageObj.setHtmlContent(htmlGenericInfoMessage(msg));
	messageObj.setSize(300,160);
	messageObj.setSource(false);	// no html source since we want to use a static message here.
	messageObj.setShadowDivVisible(false);	// Disable shadow for these boxes	
	messageObj.display();
}

function closeMessage()
{
	messageObj.close();	
}

/* stringhe HTML per messaggi */
function htmlAddedCart(codlingu)
{
	var s='';

	switch(codlingu)
	{
		case "it":
				//messaggio
				s=s + 
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdmsgTable">' +
				'<tr>' +
						'<td class="mcdmsgIco">' +
							'<img src="img/ico/icoInfo.gif">' +
						'</td>' +
						'<td class="mcdmsgTxt">' +
							'Il prodotto scelto &egrave; stato aggiunto al carrello.' +
						'</td>' +
					'</tr>' +
				'</table>';

				//links
				s=s +
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
					'<tr>' +
						'<td class="mcdmsgBtn" width="50%">' +
							'<div class="mcdmsgLnk"><a href="#" onclick="closeMessage();return false;"><img src="img/btn/ContinueShopping_it.gif" border="0"></a></div>' +
							'<div class="mcdmsgDsc">Prosegui nella consultazione del catalogo. '+
							'In qualsiasi momento potrai accedere al contenuto del carrello ' +
							'mediante il link "Carrello" in alto a destra.</div>' +
						'</td>' +
						'<td class="mcdmsgBtn" width="50%">' +
							'<div class="mcdmsgLnk"><a href="Cart.aspx?lang=' + codlingu + '"><img src="img/btn/GoToCart_it.gif" border="0"></a></div>' +
							'<div class="mcdmsgDsc">Visualizza il contenuto del tuo carrello e il costo della spedizione. ' +
							'Dalla pagina carrello potrai procedere all\'ordine.</div>' +
						'</td>' +
					'</tr>' +
				'</table>';
			break;

		case "en":

				//messaggio
				s=s + 
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdmsgTable">' +
				'<tr>' +
						'<td class="mcdmsgIco">' +
							'<img src="img/ico/icoInfo.gif">' +
						'</td>' +
						'<td class="mcdmsgTxt">' +
							'The item you have selected has been added to the cart.' +
						'</td>' +
					'</tr>' +
				'</table>';

				//links
				s=s +
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
					'<tr>' +
						'<td class="mcdmsgBtn" width="50%">' +
							'<div class="mcdmsgLnk"><a href="#" onclick="closeMessage();return false;"><img src="img/btn/ContinueShopping_en.gif" border="0"></a></div>' +
							'<div class="mcdmsgDsc">Return to the catalogue. At any time you can access the shopping cart using the "cart" button in the upper right corner.</div>' +
						'</td>' +
						'<td class="mcdmsgBtn" width="50%">' +
							'<div class="mcdmsgLnk"><a href="Cart.aspx?lang=' + codlingu + '"><img src="img/btn/GoToCart_en.gif" border="0"></a></div>' +
							'<div class="mcdmsgDsc">View the contents of your cart and shipping costs. From the shopping cart page you can proceed with your order.</div>' +
						'</td>' +
					'</tr>' +
				'</table>';

		
			break;
	}

	return s;
}
function htmlLogonSuccess_GoHome(codlingu)
{

	var s='';
	
	switch(codlingu)
	{
		case "it":
			//messaggio
				s=s + 
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdmsgTable">' +
				'<tr>' +
						'<td class="mcdmsgIco">' +
							'<img src="img/ico/icoInfo.gif">' +
						'</td>' +
						'<td class="mcdmsgTxt">' +
							'Accesso effettuato correttamente.' +
						'</td>' +
					'</tr>' +
				'</table>';

				//links
				s=s +
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
					'<tr>' +
						'<td class="mcdmsgBtn" width="100%">' +
							'<div class="mcdmsgLnk"><a href="Default.aspx?lang=' + codlingu + '"><img src="img/btn/GoToHomePage_it.gif" border="0"></a></div>' +
							'<div class="mcdmsgDsc">Dalla home page potrai consultare il catalogo libri e lo stato dei tuoi ordini mediante il link "I miei ordini" in alto a destra.' +
							'</div>' +
						'</td>' +
					'</tr>' +
				'</table>';
			break;

		case "en":
			//messaggio
				s=s + 
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdmsgTable">' +
				'<tr>' +
						'<td class="mcdmsgIco">' +
							'<img src="img/ico/icoInfo.gif">' +
						'</td>' +
						'<td class="mcdmsgTxt">' +
							'You have logged in successfully.' +
						'</td>' +
					'</tr>' +
				'</table>';

				//links
				s=s +
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
					'<tr>' +
						'<td class="mcdmsgBtn" width="100%">' +
							'<div class="mcdmsgLnk"><a href="Default.aspx?lang=' + codlingu + '"><img src="img/btn/GoToHomePage_en.gif" border="0"></a></div>' +
							'<div class="mcdmsgDsc">From the home page you can browse the complete catalogue and view your order status by clicking on "Track Orders" in the upper right corner.' +
							'</div>' +
						'</td>' +
					'</tr>' +
				'</table>';

			break;
	}

				

	return s;
}
function htmlLogonSuccess_GoCart(codlingu)
{

	var s='';

	switch(codlingu)
	{
		case "it":
				//messaggio
				s=s + 
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdmsgTable">' +
				'<tr>' +
						'<td class="mcdmsgIco">' +
							'<img src="img/ico/icoInfo.gif">' +
						'</td>' +
						'<td class="mcdmsgTxt">' +
							'Accesso effettuato correttamente.' +
						'</td>' +
					'</tr>' +
				'</table>';

				//links
				s=s +
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
					'<tr>' +
						'<td class="mcdmsgBtn" width="100%">' +
							'<div class="mcdmsgDsc">Ora puoi proseguire con l\'acquisto cliccando su "prosegui" e seguendo le istruzioni.' +
							'<div class="mcdmsgLnk"><a href="#" onclick="closeMessage();return false;"><img src="img/btn/Prosegui_it.gif" border="0"></a></div>' +
						'</td>' +
					'</tr>' +
				'</table>';
			break;

		case "en":
				//messaggio
				s=s + 
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdmsgTable">' +
				'<tr>' +
						'<td class="mcdmsgIco">' +
							'<img src="img/ico/icoInfo.gif">' +
						'</td>' +
						'<td class="mcdmsgTxt">' +
							'You have logged in successfully.' +
						'</td>' +
					'</tr>' +
				'</table>';

				//links
				s=s +
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
					'<tr>' +
						'<td class="mcdmsgBtn" width="100%">' +
							'<div class="mcdmsgDsc">You can now proceed with your purchase by clicking on "continue" and following the instructions.' +
							'<div class="mcdmsgLnk"><a href="#" onclick="closeMessage();return false;"><img src="img/btn/Prosegui_en.gif" border="0"></a></div>' +
						'</td>' +
					'</tr>' +
				'</table>';
			break;
	}
	

	return s;
}
function htmlPasswordSent(codlingu)
{

	var s='';
	
	switch(codlingu)
	{
		case "it":
				//messaggio
				s=s + 
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdmsgTable">' +
				'<tr>' +
						'<td class="mcdmsgIco">' +
							'<img src="img/ico/icoInfo.gif">' +
						'</td>' +
						'<td class="mcdmsgTxt">' +
							'Il nome utente e la password ti sono stati inviati via e-mail.' +
						'</td>' +
					'</tr>' +
				'</table>';

				//links
				s=s +
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
					'<tr>' +
						'<td class="mcdmsgBtn" width="100%">' +
							'<div class="mcdmsgDsc">Accedi alla tua casella e-mail per recuperare il nome utente e la password.' +
							'<div class="mcdmsgLnk"><a href="#" onclick="closeMessage();return false;"><img src="img/btn/Close_it.gif" border="0"></a></div>' +				
							'</div>' +
						'</td>' +
					'</tr>' +
				'</table>';
			break;

		case "en":
				//messaggio
				s=s + 
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdmsgTable">' +
				'<tr>' +
						'<td class="mcdmsgIco">' +
							'<img src="img/ico/icoInfo.gif">' +
						'</td>' +
						'<td class="mcdmsgTxt">' +
							'The username and password have been sent to you via e-mail.' +
						'</td>' +
					'</tr>' +
				'</table>';

				//links
				s=s +
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
					'<tr>' +
						'<td class="mcdmsgBtn" width="100%">' +
							'<div class="mcdmsgDsc">Go to your mailbox to retrieve your username and password.' +
							'<div class="mcdmsgLnk"><a href="#" onclick="closeMessage();return false;"><img src="img/btn/Close_en.gif" border="0"></a></div>' +				
							'</div>' +
						'</td>' +
					'</tr>' +
				'</table>';
			break;
	}

	return s;
}
function htmlPasswordSent_Logon(codlingu)
{

	var s='';
	switch(codlingu)
	{
		case "it":
			//messaggio
			s=s + 
			'<table cellspacing="0" cellpadding="0" border="0" class="mcdmsgTable">' +
			'<tr>' +
					'<td class="mcdmsgIco">' +
						'<img src="img/ico/icoInfo.gif">' +
					'</td>' +
					'<td class="mcdmsgTxt">' +
						'Il nome utente e la password ti sono stati inviati via e-mail.' +
					'</td>' +
				'</tr>' +
			'</table>';

			//links
			s=s +
			'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
				'<tr>' +
					'<td class="mcdmsgBtn" width="100%">' +
						'<div class="mcdmsgDsc">Controlla la tua e-mail: troverai un messaggio contenente il nome utente e la password.' +
						'</div>' +
					'</td>' +
				'</tr>' +
			'</table>' + 
			'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
				'<tr>' +
					'<td class="mcdmsgBtn" width="50%">' +
						'<div class="mcdmsgLnk"><a href="Login.aspx?lang=it"><img src="img/btn/AccessoAlSistema_it.gif" border="0"></a></div>' +				
						'</div>' +
					'</td>' +
					'<td class="mcdmsgBtn" width="50%">' +
						'<div class="mcdmsgLnk"><a href="#" onclick="closeMessage();return false;"><img src="img/btn/Close_it.gif" border="0"></a></div>' +				
						'</div>' +
					'</td>' +
				'</tr>' +
			'</table>';
			break;
		case "en":
			//messaggio
			s=s + 
			'<table cellspacing="0" cellpadding="0" border="0" class="mcdmsgTable">' +
			'<tr>' +
					'<td class="mcdmsgIco">' +
						'<img src="img/ico/icoInfo.gif">' +
					'</td>' +
					'<td class="mcdmsgTxt">' +
						'The username and password have been sent to you via e-mail.' +
					'</td>' +
				'</tr>' +
			'</table>';

			//links
			s=s +
			'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
				'<tr>' +
					'<td class="mcdmsgBtn" width="100%">' +
						'<div class="mcdmsgDsc">Check your e-mail: you will find a message containing your username and password.' +
						'</div>' +
					'</td>' +
				'</tr>' +
			'</table>' + 
			'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
				'<tr>' +
					'<td class="mcdmsgBtn" width="50%">' +
						'<div class="mcdmsgLnk"><a href="Login.aspx?lang=en"><img src="img/btn/AccessoAlSistema_en.gif" border="0"></a></div>' +				
						'</div>' +
					'</td>' +
					'<td class="mcdmsgBtn" width="50%">' +
						'<div class="mcdmsgLnk"><a href="#" onclick="closeMessage();return false;"><img src="img/btn/Close_en.gif" border="0"></a></div>' +				
						'</div>' +
					'</td>' +
				'</tr>' +
			'</table>';
			break;
	}

	return s;
}
function htmlPasswordSent_GoCart(codlingu)
{

	var s='';

	switch(codlingu)
	{
		case "it":
				//messaggio
				s=s + 
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdmsgTable">' +
				'<tr>' +
						'<td class="mcdmsgIco">' +
							'<img src="img/ico/icoInfo.gif">' +
						'</td>' +
						'<td class="mcdmsgTxt">' +
							'Il nome utente e la password ti sono stati inviati via e-mail.' +
						'</td>' +
					'</tr>' +
				'</table>';

				//links
				s=s +
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
					'<tr>' +
						'<td class="mcdmsgBtn" width="100%">' +
							'<div class="mcdmsgDsc">Controlla la tua e-mail: troverai un messaggio contenente il nome utente e la password.' +
							'</div>' +
						'</td>' +
					'</tr>' +
				'</table>' + 
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
					'<tr>' +
						'<td class="mcdmsgBtn" width="50%">' +
							'<div class="mcdmsgLnk"><a href="Cart.aspx?lang=it"><img src="img/btn/TornaAlCarrello_it.gif" border="0"></a></div>' +				
							'</div>' +
						'</td>' +
						'<td class="mcdmsgBtn" width="50%">' +
							'<div class="mcdmsgLnk"><a href="#" onclick="closeMessage();return false;"><img src="img/btn/Close_it.gif" border="0"></a></div>' +				
							'</div>' +
						'</td>' +
					'</tr>' +
				'</table>';

			break;

		case "en":
				//messaggio
				s=s + 
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdmsgTable">' +
				'<tr>' +
						'<td class="mcdmsgIco">' +
							'<img src="img/ico/icoInfo.gif">' +
						'</td>' +
						'<td class="mcdmsgTxt">' +
							'The username and password have been sent to you via e-mail.' +
						'</td>' +
					'</tr>' +
				'</table>';

				//links
				s=s +
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
					'<tr>' +
						'<td class="mcdmsgBtn" width="100%">' +
							'<div class="mcdmsgDsc">Check your e-mail: you will find a message containing your username and password.' +
							'</div>' +
						'</td>' +
					'</tr>' +
				'</table>' + 
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
					'<tr>' +
						'<td class="mcdmsgBtn" width="50%">' +
							'<div class="mcdmsgLnk"><a href="Cart.aspx?lang=en"><img src="img/btn/TornaAlCarrello_en.gif" border="0"></a></div>' +				
							'</div>' +
						'</td>' +
						'<td class="mcdmsgBtn" width="50%">' +
							'<div class="mcdmsgLnk"><a href="#" onclick="closeMessage();return false;"><img src="img/btn/Close_en.gif" border="0"></a></div>' +				
							'</div>' +
						'</td>' +
					'</tr>' +
				'</table>';

			break;
	}
	
	return s;
}

function htmlMissingEgoMail(codlingu)
{

	var s='';
	
	//questo non viene tradotto in inglese perchè nella parte inglese EGO non compare

	//messaggio
	s=s + 
	'<table cellspacing="0" cellpadding="0" border="0" class="mcdmsgTable">' +
	'<tr>' +
			'<td class="mcdmsgIco">' +
				'<img src="img/ico/icoWarning.gif">' +
			'</td>' +
			'<td class="mcdmsgTxt">' +
				'Non disponiamo di un indirizzo e-mail.' +
			'</td>' +
		'</tr>' +
	'</table>';

	//links
	s=s +
	'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
		'<tr>' +
			'<td class="mcdmsgBtn" width="100%">' +
				'<div class="mcdmsgDsc">Per utilizzare questo sito &egrave; essenziale che ci comunichi il tuo indirizzo e-mail. Il sistema infatti utilizza l\'e-mail per ' + 
				'inviarti le conferme d\'ordine e le notifiche di spedizione.<br>' +
				'Per comunicarci il tuo indirizzo e-mail devi accedere ad EGO <a class="classicA" target=_blank" href="http://ego.evsrl.it/">cliccando qui</a> e, dalla tua pagina personale, utilizzare la funzione di inserimento indirizzo e-mail, ' +
				'accessibile dal box "I tuoi indirizzi e-mail" nella parte sinistra.' +
				'<div class="mcdmsgLnk"><a href="#" onclick="closeMessage();return false;"><img src="img/btn/Close_it.gif" border="0"></a></div>' +				
				'</div>' +
			'</td>' +
		'</tr>' +
	'</table>';

	return s;

}

function htmlRegistration_ExistingUser(codlingu)
{
	var s='';
	
	switch(codlingu)
	{
		case "it":
				//messaggio
				s=s + 
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdmsgTable">' +
				'<tr>' +
						'<td class="mcdmsgIco">' +
							'<img src="img/ico/icoWarning.gif">' +
						'</td>' +
						'<td class="mcdmsgTxt">' +
							'L\'indirizzo e-mail immesso risulta gi&agrave; registrato.' +
						'</td>' +
					'</tr>' +
				'</table>';

				//links
				s=s +
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
					'<tr>' +
						'<td class="mcdmsgBtn" width="100%">' +
							'<div class="mcdmsgDsc">E\' possibile che tu ti sia gi&agrave; registrato in precedenza.</div>'+
						'</td>' +
					'</tr>' +
				'</table>' +
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
					'<tr>' +
						'<td class="mcdmsgBtn" width="50%">' +
							'<div class="mcdmsgLnk"><a href="PasswordLost.aspx?lang=it"><img src="img/btn/RecuperoPassword_it.gif" border="0"></a></div>' +
							'<div class="mcdmsgDsc">Accedi alla pagina di recupero password.</div>' +
						'</td>' +
						'<td class="mcdmsgBtn" width="50%">' +
							'<div class="mcdmsgLnk"><a href="#" onclick="closeMessage();return false;"><img src="img/btn/Close_it.gif" border="0"></a></div>' +
							'<div class="mcdmsgDsc">Ritorna alla pagina di registrazione per immettere un nuovo indirizzo e-mail.</div>' +
						'</td>' +
					'</tr>' +
				'</table>';
			break;

		case "en":
				//messaggio
				s=s + 
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdmsgTable">' +
				'<tr>' +
						'<td class="mcdmsgIco">' +
							'<img src="img/ico/icoWarning.gif">' +
						'</td>' +
						'<td class="mcdmsgTxt">' +
							'The e-mail your entered has already been registered.' +
						'</td>' +
					'</tr>' +
				'</table>';

				//links
				s=s +
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
					'<tr>' +
						'<td class="mcdmsgBtn" width="100%">' +
							'<div class="mcdmsgDsc">It may be that you have already previously registered.</div>'+
						'</td>' +
					'</tr>' +
				'</table>' +
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
					'<tr>' +
						'<td class="mcdmsgBtn" width="50%">' +
							'<div class="mcdmsgLnk"><a href="PasswordLost.aspx?lang=en"><img src="img/btn/RecuperoPassword_en.gif" border="0"></a></div>' +
							'<div class="mcdmsgDsc">Go to the password recovery page.</div>' +
						'</td>' +
						'<td class="mcdmsgBtn" width="50%">' +
							'<div class="mcdmsgLnk"><a href="#" onclick="closeMessage();return false;"><img src="img/btn/Close_en.gif" border="0"></a></div>' +
							'<div class="mcdmsgDsc">Return to the registration page to enter a new e-mail address.</div>' +
						'</td>' +
					'</tr>' +
				'</table>';
			break;
	}


	return s;
}
function htmlRegistration_OK(codlingu)
{
	var s='';

	switch(codlingu)
	{
		case "it":
				//messaggio
				s=s + 
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdmsgTable">' +
				'<tr>' +
						'<td class="mcdmsgIco">' +
							'<img src="img/ico/icoInfo.gif">' +
						'</td>' +
						'<td class="mcdmsgTxt">' +
							'Registrazione effettuata correttamente.' +
						'</td>' +
					'</tr>' +
				'</table>';

				//links
				s=s +
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
					'<tr>' +
						'<td class="mcdmsgBtn" width="100%">' +
							'<div class="mcdmsgDsc">Il nome utente e la password per accedere al sistema sono stati inviati all\'indirizzo e-mail che hai inserito. Controlla la posta.</div>'+
						'</td>' +
					'</tr>' +
				'</table>' +
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
					'<tr>' +
						'<td class="mcdmsgBtn" width="50%">' +
							'<div class="mcdmsgLnk"><a href="Login.aspx?lang=it"><img src="img/btn/AccessoAlSistema_it.gif" border="0"></a></div>' +
							'<div class="mcdmsgDsc">Nella pagina di accesso potrai immettere il nome utente e la password ricevuti per e-mail.</div>' +
						'</td>' +
						'<td class="mcdmsgBtn" width="50%">' +
							'<div class="mcdmsgLnk"><a href="Default.aspx?lang=it"><img src="img/btn/GoToHomePage_it.gif" border="0"></a></div>' +
							'<div class="mcdmsgDsc">Vai alla home page senza accedere al sistema.</div>' +
						'</td>' +
					'</tr>' +
				'</table>';

			break;

		case "en":
				//messaggio
				s=s + 
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdmsgTable">' +
				'<tr>' +
						'<td class="mcdmsgIco">' +
							'<img src="img/ico/icoInfo.gif">' +
						'</td>' +
						'<td class="mcdmsgTxt">' +
							'The registration has been completed successfully.' +
						'</td>' +
					'</tr>' +
				'</table>';

				//links
				s=s +
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
					'<tr>' +
						'<td class="mcdmsgBtn" width="100%">' +
							'<div class="mcdmsgDsc">The username and password necessary to access the system have been sent to the email address you entered. Check your mail.</div>'+
						'</td>' +
					'</tr>' +
				'</table>' +
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
					'<tr>' +
						'<td class="mcdmsgBtn" width="50%">' +
							'<div class="mcdmsgLnk"><a href="Login.aspx?lang=en"><img src="img/btn/AccessoAlSistema_en.gif" border="0"></a></div>' +
							'<div class="mcdmsgDsc">On the login page you can enter the username and password you received via e-mail.</div>' +
						'</td>' +
						'<td class="mcdmsgBtn" width="50%">' +
							'<div class="mcdmsgLnk"><a href="Default.aspx?lang=en"><img src="img/btn/GoToHomePage_en.gif" border="0"></a></div>' +
							'<div class="mcdmsgDsc">Go to the home page without logging in.</div>' +
						'</td>' +
					'</tr>' +
				'</table>';

			break;
	}


	return s;
}

function htmlRegistration_OK_GoCart(codlingu)
{
	var s='';
	
	switch(codlingu)
	{
		case "it":
				//messaggio
				s=s + 
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdmsgTable">' +
				'<tr>' +
						'<td class="mcdmsgIco">' +
							'<img src="img/ico/icoInfo.gif">' +
						'</td>' +
						'<td class="mcdmsgTxt">' +
							'Registrazione effettuata correttamente.' +
						'</td>' +
					'</tr>' +
				'</table>';

				//links
				s=s +
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
					'<tr>' +
						'<td class="mcdmsgBtn" width="100%">' +
							'<div class="mcdmsgDsc">Il nome utente e la password per accedere al sistema sono stati inviati all\'indirizzo e-mail che hai inserito. Controlla la posta.</div>'+
						'</td>' +
					'</tr>' +
				'</table>' +
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
					'<tr>' +
						'<td class="mcdmsgBtn" width="100%">' +
							'<div class="mcdmsgLnk"><a href="Cart.aspx?lang=it"><img src="img/btn/TornaAlCarrello_it.gif" border="0"></a></div>' +
							'<div class="mcdmsgDsc" style="font-weight:bold;">Nel box "utente e-commerce" situato nella parte finale della pagina potrai immettere il nome utente e la password ricevuti per e-mail.</div>' +
						'</td>' +
					'</tr>' +
				'</table>';

			break;

		case "en":
				//messaggio
				s=s + 
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdmsgTable">' +
				'<tr>' +
						'<td class="mcdmsgIco">' +
							'<img src="img/ico/icoInfo.gif">' +
						'</td>' +
						'<td class="mcdmsgTxt">' +
							'The registration has been completed successfully.' +
						'</td>' +
					'</tr>' +
				'</table>';

				//links
				s=s +
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
					'<tr>' +
						'<td class="mcdmsgBtn" width="100%">' +
							'<div class="mcdmsgDsc">The username and password necessary to access the system have been sent to the email address you entered. Check your mail.</div>'+
						'</td>' +
					'</tr>' +
				'</table>' +
				'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
					'<tr>' +
						'<td class="mcdmsgBtn" width="100%">' +
							'<div class="mcdmsgLnk"><a href="Cart.aspx?lang=en"><img src="img/btn/TornaAlCarrello_en.gif" border="0"></a></div>' +
							'<div class="mcdmsgDsc" style="font-weight:bold;">In the "Log In" box at the bottom of the page you can enter the username and password you received via e-mail.</div>' +
						'</td>' +
					'</tr>' +
				'</table>';
			break;
	}


	return s;
}
function htmlGenericInfoMessage(msg)
{

	var s='';
	//messaggio
	s=s + 
	'<table cellspacing="0" cellpadding="0" border="0" class="mcdmsgTable">' +
	'<tr>' +
			'<td class="mcdmsgIco">' +
				'<img src="img/ico/icoInfo.gif">' +
			'</td>' +
			'<td class="mcdmsgTxt">' +
				msg +
			'</td>' +
		'</tr>' +
	'</table>';
	//links
	s=s +
	'<table cellspacing="0" cellpadding="0" border="0" class="mcdbtnTable" width="100%">' +
		'<tr>' +
			'<td class="mcdmsgBtn" width="100%">' +
				'<div class="mcdmsgLnk"><a href="#" onclick="closeMessage();return false;"><img src="img/btn/Close_it.gif" border="0"></a></div>' +
			'</td>' +
		'</tr>' +
	'</table>';

	return s;
}
/* gestione AJAX */
// lista ProgID Microsoft XML HTTP
var XMLHTTPREQUEST_MS_PROGIDS = new Array(
  "Msxml2.XMLHTTP.7.0",
  "Msxml2.XMLHTTP.6.0",
  "Msxml2.XMLHTTP.5.0",
  "Msxml2.XMLHTTP.4.0",
  "MSXML2.XMLHTTP.3.0",
  "MSXML2.XMLHTTP",
  "Microsoft.XMLHTTP"
);

// costanti ReadyState
var XMLHTTPREQUEST_READY_STATE_UNINITIALIZED = 0;
var XMLHTTPREQUEST_READY_STATE_LOADING       = 1;
var XMLHTTPREQUEST_READY_STATE_LOADED        = 2;
var XMLHTTPREQUEST_READY_STATE_INTERACTIVE   = 3;
var XMLHTTPREQUEST_READY_STATE_COMPLETED     = 4;
// contatore per fakeargument
var AJAX_FakeCounter=0;

// restituisce l'oggetto XMLHttpRequest.
function AJAX_getXMLHttpRequest()
{
  var httpRequest = null;

  // Create the appropriate HttpRequest object for the browser.
  if (window.XMLHttpRequest != null)
    httpRequest = new window.XMLHttpRequest();
  else if (window.ActiveXObject != null)
  {
    // Must be IE, find the right ActiveXObject.
    var success = false;
    for (var i = 0;
         i < XMLHTTPREQUEST_MS_PROGIDS.length && !success;
         i++)
    {
      try
      {
        httpRequest = new ActiveXObject(XMLHTTPREQUEST_MS_PROGIDS[i]);
        success = true;
      }
      catch (ex)
      {}
    }
  }
  // Display an error if we couldn't create one.
  if (httpRequest == null)
    alert("Errore in HttpRequest():\n\n"
      + "Impossibile creare l'oggetto XMLHttpRequest.");

  // Return it.
  return httpRequest;
}

function AJAX_LeggiURL(url, idElemento)
{
	
	var ajaxHttpRequest = AJAX_getXMLHttpRequest();
	
	//aggiungo un parametro fittizio all'url in modo da evitare il caching
	AJAX_FakeCounter = AJAX_FakeCounter + 1;
	url = url + '&AJAX_fakeargument=' + AJAX_FakeCounter + new Date().getTime();
	
	ajaxHttpRequest.onreadystatechange = function() 
	{
		if (ajaxHttpRequest.readyState == XMLHTTPREQUEST_READY_STATE_COMPLETED)
		{
			if (ajaxHttpRequest.status == 200)
			{
				document.getElementById(idElemento).innerHTML = ajaxHttpRequest.responseText;
			}
			else
			{
				//alert("Errore: HTTP " + ajaxHttpRequest.status + " " + ajaxHttpRequest.statusText);
			}	
		}
	}
	ajaxHttpRequest.open("GET", url, true);
	ajaxHttpRequest.send(null);
}

/* gestione AJAX addToCart */
function addCart(ID_ARTIC, codlingu)
{
	
	var ajaxHttpRequest = AJAX_getXMLHttpRequest();
		
	//aggiungo un parametro fittizio all'url in modo da evitare il caching
	AJAX_FakeCounter = AJAX_FakeCounter + 1;
	var url = 'AJAX_AddToCart.aspx?id=' + ID_ARTIC + '&lang=' + codlingu + '&AJAX_fakeargument=' + AJAX_FakeCounter + new Date().getTime();
	
	ajaxHttpRequest.onreadystatechange = function() 
	{
		if (ajaxHttpRequest.readyState == XMLHTTPREQUEST_READY_STATE_COMPLETED)
		{
			if (ajaxHttpRequest.status == 200)
			{
				//scrittura del nuovo userstatus
				document.getElementById('UserStatusDiv').innerHTML = ajaxHttpRequest.responseText;
				//messaggio carrello
				displayAddedCart(codlingu);
				
			}
			else
			{
				//alert("Errore: HTTP " + ajaxHttpRequest.status + " " + ajaxHttpRequest.statusText);
			}	
		}
	}
	ajaxHttpRequest.open("GET", url, true);
	ajaxHttpRequest.send(null);
	
	if (event) {event.returnValue=0;}
	return (0);
}
/* evita pressione enter=submit */
function PreventEnter(e)
{
	var keynum;
	if(e && e.which)
	{ //if which property of event object is supported (NN4)
		keynum = e.which; //character code is contained in NN4's which property
	}
	else
	{
		e = event;
		keynum = e.keyCode; //character code is contained in IE's keyCode property
	}
	if (keynum==13)
	{
		{
			//cancello l'evento
			e.returnValue=false;
		    e.cancel = true;			
		}
	}
	else
	{
		return true;
	}
}
/* gestione full text search */
function textSearchEnter(e, codlingu)
{
	var keynum;
	if(e && e.which)
	{ //if which property of event object is supported (NN4)
		keynum = e.which; //character code is contained in NN4's which property
	}
	else
	{
		e = event;
		keynum = e.keyCode; //character code is contained in IE's keyCode property
	}
	if (keynum==13)
	{
		if (e)
		{
			//cancellazione evento
			e.returnValue=false;
		    e.cancel = true;
		}
		return textSearch(e, codlingu);
	}
	else
	{
		return true;
	}
}

function textSearch(e, codlingu)
{
	var theform=getForm1();
	var search=escape(theform.elements["textsearch"].value);
	var codclaar=theform.elements["codclaarsearch"].value;
	if (search=="")
	{
		switch (codlingu)
		{
			case "it": window.alert("Immetti il/i termini da ricercare nell'apposita casella."); break;
			case "en": window.alert("Please enter the terms you want to search for."); break;
		}
		if (e) {e.returnValue=0; e.cancel=true;}
		return false;
	}
	else
	{
		var url="TextSearch.aspx?search=" + search + "&codclaar=" + codclaar + "&lang=" + codlingu;
		location.href=url;
		return false;
	}
}