	function Add2ShopCartIncentivi(form, mcard, discount) {
    	var answer = true;
		var flagDiscount = false;
    	
    	try
		{
			if (form.checkPromoIncentivi.checked) {
				answer = confirm("L'acquisto con contributo statale richiede il possesso dei requisiti richiesti e l'invio di idonea documentazione\nConfermi l'acquisto di questo prodotto con contributo statale?");
				flagDiscount = true;
			}
		}
		catch(err)
		{
		}
    	
    	if (answer) {
	        if (flagDiscount) {
				Add2ShopCart(form, mcard, discount);
			}
			else {
				Add2ShopCart(form, mcard, '');
			}
        }
    }
	
    function Add2ShopCart(form, mcard, discount) {
        form.action = "OrderItemAdd";
        form.URL.value = 'OrderItemDisplay?orderId=*';
        form.field1.value = mcard;
        form.comment.value = discount;
        form.submit();
    }

    function info() {
        popUp = window.open("", "info1", "width=334,height=170,scrollbars=no,resizable=no");
        doc = popUp.document;
        str = '<HTML><HEAD><TITLE><%= storeTitle %></TITLE><LINK  href="'+stylePath+'/stylepopup.css" type=text/css rel=stylesheet></HEAD>';
        str = str + '<BODY CLASS="body0" BGCOLOR="FFFFFF" onBlur="window.close()">';
        str = str + ' <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">';
        str = str + '<TR><TD CLASS="TxtMinipopND">';
        str = str + 'Il simbolo <img src="'+imgDir+'/flag_KO1.gif"> evidenzia la non disponibilità del prodotto<BR><BR>';
        str = str + 'Se è "sensibile" cliccalo e lascia la tua email; sarai avvisato tempestivamente quando il prodotto tornerà ad essere di nuovo disponibile<br><br>';
        str = str + 'Se "non è sensibile" significa che il prodotto terminato non è riordinabile e quindi non potrà più essere disponibile.';
        str = str + '</td></tr>';
        str = str + '</table>';
        str = str + '</BODY></HTML>';
        doc.write(str);

    }

    function openWinJ(Cada) {
        window.open(Cada, 1, 'toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=480,height=480');
    }

    function cutEuro(price) {
        document.write(price.substring(12, price.length));
    }
    
    //function popupKyoto() {
    //	document.location.href = "LoadHtml?storeId=20000&catalogId=20000&languageId=-1&content=/offerte/progreen_new/sez1.html";
    //}
	
	var browserO = navigator.userAgent.indexOf("Opera") != -1;
	var browserF = navigator.userAgent.indexOf("Firefox") != -1;
	
	var cursor1;
	var cursor2;
	var ruler;
	
	// obj cursor def
	function Cursor( cursorId, labelId, priceId )
	{
		this.cursor = document.getElementById( cursorId );
		this.label = document.getElementById( labelId );
		this.price = document.getElementById( priceId );
		
		// pos top
		this.cursor.style.top -= 5;
		this.label.style.top -= 5;
		
		this.cursorSize = 79;
		this.posErr = 0;
		
		this.cursorMove = false;
		
		this.mouseLeft = 0;	
		this.cursorLeft = 0;
		
		this.cursorMin = 0;
		this.cursorMax = 0;
	}
	
	// obj ruler def
	function Ruler()
	{
		this.rulerSize = 560;
			
		this.firstElement = parseFloat( document.getElementById( "firstElement" ).innerHTML );
		this.firstSelectedElement = parseFloat( document.getElementById( "firstSelectedElement" ).innerHTML );
		this.lastSelectedElement = parseFloat( document.getElementById( "lastSelectedElement" ).innerHTML );
		this.lastElement = parseFloat( document.getElementById( "lastElement" ).innerHTML );
		
		this.firstSelectedElement = parseFloat( this.firstSelectedElement ) == 0 ? this.firstElement : this.firstSelectedElement ;
		this.lastSelectedElement = parseFloat( this.lastSelectedElement ) == 0 ? this.lastElement : this.lastSelectedElement ;
		
		this.initPrice = function( price ) 
		{ 
			var interval = this.lastElement - this.firstElement;
			var procent = ( price - this.firstElement ) / interval;
			
			return procent * this.rulerSize;
		}
		
		this.calculatePrice = function( pos ) 
		{ 
			var interval = this.lastElement - this.firstElement;
			var procent = pos / this.rulerSize;
			
			return  Math.round( 10 * (this.firstElement + ( interval * procent ) ) ) / 10;
		}
	}

	/* 
	Set price interval in element CONSTR
	*/
	function setPrice()
	{
		try
		{	var constr = "1;PPPRC;>=;" + ruler.firstSelectedElement + ";";
			constr    += "2;PPPRC;<=;" + ruler.lastSelectedElement;
			document.getElementById( "constr" ).value = constr;
		}
		catch(err)
		{	// no price
		}
	}
	
	/* 
	Move the cursors
	*/
	function moveCursor( evt )
	{
		if(!evt) var evt = window.event;
		
		if( cursor1.cursorMove )
		{	// cursor1 move
			if( cursor1.mouseLeft == 0 ) cursor1.mouseLeft = evt.clientX;
		
			var pos = parseFloat( cursor1.cursorLeft ) + ( evt.clientX - cursor1.mouseLeft );
			var newposPos = pos > cursor1.cursorMin ? pos < cursor1.cursorMax ? pos : cursor1.cursorMax : cursor1.cursorMin;
			
			cursor1.cursorLeft = cursor2.cursorMin = newposPos;
			cursor1.cursor.style.left = cursor1.cursorLeft;
			cursor1.label.style.left = cursor1.cursorLeft - ( 2 * cursor1.cursorSize );
			
			var price = ( browserO ? cursor1.cursor : cursor1.price );
			ruler.firstSelectedElement = price.innerHTML = ruler.calculatePrice( parseFloat( cursor1.cursorLeft ) + cursor1.posErr );
			
			cursor1.mouseLeft = ( newposPos == pos ? evt.clientX : evt.clientX + ( newposPos - pos ) );
		}
		else if( cursor2.cursorMove )
		{	// cursor2 move
			if( cursor2.mouseLeft == 0 ) cursor2.mouseLeft = evt.clientX;
			
			var pos = parseFloat( cursor2.cursorLeft ) + ( evt.clientX - cursor2.mouseLeft );
			var newposPos = pos > cursor2.cursorMin ? pos < cursor2.cursorMax ? pos : cursor2.cursorMax : cursor2.cursorMin;
			
			cursor2.cursorLeft = cursor1.cursorMax = newposPos;
			cursor2.cursor.style.left = cursor2.cursorLeft;
			cursor2.label.style.left = cursor2.cursorLeft - ( 2 * cursor2.cursorSize );
			
			var price = ( browserO ? cursor2.cursor : cursor2.price );
			ruler.lastSelectedElement = price.innerHTML = ruler.calculatePrice( parseFloat( cursor2.cursorLeft ) + cursor2.posErr );
			
			cursor2.mouseLeft = ( newposPos == pos ? evt.clientX : evt.clientX + ( newposPos - pos ) );
		}
	}
	
	/* 
	Init the price bar elements
	*/
	function initPriceBar()
	{
		cursor1 = new Cursor( "cursor1", "label1", "price1" );
		cursor1.posErr = cursor1.cursorSize / 2;
		cursor2 = new Cursor( "cursor2", "label2", "price2" );
		cursor2.posErr = cursor1.cursorSize + ( cursor2.cursorSize / 2 );
		
		cursor1.cursorLeft = cursor1.cursor.style.left -= cursor1.posErr;
		cursor2.cursorMin = cursor1.cursorMin = cursor1.cursorLeft;
		
		cursor2.cursorLeft = cursor2.cursor.style.left += ( ruler.rulerSize - cursor2.posErr );
		cursor1.cursorMax = cursor2.cursorMax = cursor2.cursorLeft;
		
		cursor1.cursorLeft = cursor1.cursor.style.left = ruler.initPrice( ruler.firstSelectedElement ) - cursor1.posErr;
		cursor2.cursorMin = cursor1.cursorLeft;
		
		cursor2.cursorLeft = cursor2.cursor.style.left = ruler.initPrice( ruler.lastSelectedElement ) - cursor2.posErr;
		cursor1.cursorMax = cursor2.cursorLeft;
		
		cursor1.label.style.left = cursor1.cursorLeft - ( 2 * cursor1.cursorSize );
		cursor2.label.style.left = cursor2.cursorLeft - ( 2 * cursor2.cursorSize );
		
		cursor1.cursor.onmousedown = function(evt) { cursor1.cursorMove=true; if(!evt) var evt = window.event; moveCursor(evt); };
		cursor2.cursor.onmousedown = function(evt) { cursor2.cursorMove=true; if(!evt) var evt = window.event; moveCursor(evt); };

		document.body.onmousemove = moveCursor;
		document.body.onmouseup = function() { cursor1.cursorMove=false; cursor1.mouseLeft = 0; cursor2.cursorMove=false; cursor2.mouseLeft = 0; };
	}
	
	/* 
	Create the price bar elements
	*/	
	function createPriceBar()
	{
		ruler = new	Ruler();
		
		document.write( "<div style=\"position:relative; top:13px; width:" + ruler.rulerSize + ";\">" );
		document.write( "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td style=\"width:100%; height:11px; background-image:url(/resources/images/catalogo_new/grey_line.gif);\"></td></tr></table>" );
		document.write( "</div>" );
	
		document.write( "<span id=\"cursor1\" align=\"center\" unselectable=\"on\" onselectstart=\"return false;\" class=\"cursor\">" );
		if( browserO )
		{	document.write( ruler.firstSelectedElement );
		}
		else if( browserF )
		{	document.write( "<span id=\"price1\" class=\"innerCursor\">" + ruler.firstSelectedElement + "</span>" );
		}
		else
		{	document.write( "<table style=\"width:100%; height:100%;\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td id=\"price1\" class=\"priceLabel\">" + ruler.firstSelectedElement + "</td></tr></table>" );
		}
		document.write( "</span>" );
		
		document.write( "<span id=\"cursor2\" align=\"center\" unselectable=\"on\" onselectstart=\"return false;\" class=\"cursor\">" );
		if( browserO )
		{	document.write( ruler.lastSelectedElement );
		}
		else if( browserF )
		{	document.write( "<span id=\"price2\" class=\"innerCursor\">" + ruler.lastSelectedElement + "</span>" );
		}
		else
		{	document.write( "<table style=\"width:100%; height:100%;\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td id=\"price2\" class=\"priceLabel\">" + ruler.lastSelectedElement + "</td></tr></table>" );
		}
		document.write( "</span>" );
		
		document.write( "<img id=\"label1\" src=\"/resources/images/catalogo_new/cursor.gif\" width=\"79\" height=\"25\" style=\"position:relative; z-index:40;\">" );
		document.write( "<img id=\"label2\" src=\"/resources/images/catalogo_new/cursor.gif\" width=\"79\" height=\"25\" style=\"position:relative; z-index:40;\">" );
		
		initPriceBar();
		}
	
		function pop_up(price){
			window.open("/html/pop_detrazione/pop_detrazione.htm?detrazione="+price,"garanzia","width=300,height=200,scrollbars=no,resizable=no");
		}
		
		function openPopConsDiff(giorni) {	
			window.open("/html/supporto_clienti/consegna_differita_popup.html?giorni="+giorni, "Consegna_Differita", "width=390,height=330,scrollbars=no");
		}
		
		function openPopKyoto() {	
			window.open("/webapp/wcs/stores/servlet/LoadHtml?storeId=20000&catalogId=20000&languageId=-1&content=/offerte/progreen_new/sez1.html", "Kyoto","scrollbars=yes,width=1020,height=600");
		}
		
		function openCoCoCo() {	
			window.open("/webapp/wcs/stores/servlet/LoadHtml?storeId=20000&content=/html/offerte/pc_cococo/pc_cococo2008.htm","CoCoCo", "scrollbars=yes,width=1020,height=600");
		}
		
		function openUMTS() {	
			window.open("/html/promo/UMTS.html","3","scrollbars=yes,width=1020,height=600");
		}
		
		function openProgreen() {	
			window.open("/webapp/wcs/stores/servlet/LoadHtml?storeId=20000&catalogId=20000&languageId=-1&content=/offerte/progreen_new/sez1.html","Progreen","scrollbars=yes,width=1020,height=600");
		}
		
		function openFinanziaria() {	
			window.open("/webapp/wcs/stores/servlet/LoadHtml?storeId=20000&content=/html/offerte/finanziaria_2008/finanziaria_2008.htm","Finanziaria2008","scrollbars=yes,width=1020,height=600");
		}
		
		function openTasso(sProductPrice, sRate12_Value, sRate12_TotalPrice, sRate18_Value, sRate18_TotalPrice, sRate24_Value, sRate24_TotalPrice){	
			document.getElementById('sProductPrice').innerHTML = sProductPrice;
			document.getElementById('sRate12_Value').innerHTML = sRate12_Value;
			document.getElementById('sRate12_TotalPrice').innerHTML = sRate12_TotalPrice;	
			document.getElementById('sRate18_Value').innerHTML = sRate18_Value;
			document.getElementById('sRate18_TotalPrice').innerHTML = sRate18_TotalPrice;	
			document.getElementById('sRate24_Value').innerHTML = sRate24_Value;
			document.getElementById('sRate24_TotalPrice').innerHTML = sRate24_TotalPrice;						
			window.open("/html/pop_vero_tasso_24/pop_vero_tasso_24.htm","","width=720,height=350,toolbar=no,status=no,scrollbars=no,resizable=no");
		}
		
		function putFoto3D(title, pId){
			var nome = 'photo3D'+pId;
			var links = document.getElementById(nome);
			var url = linksFoto3D[pId];
			if(links != null && links != 'undefined' && url != null && url != 'undefined'){
				var nuovohtml = '<a href="javascript:openWinVideo(\'VideoProductView?kiave='+pId+'&amp;storeId=20000&amp;titolo='+title+'\')">Foto 3D</a>';
				links.innerHTML = nuovohtml;
			}
		}
		
		function openPopRAEE() {	
			window.open("/html/pop_raee/pop_raee.html", "raee", "scrollbars=yes,width=530,height=520");
		}
		
		function openPopupAvailability() {	
			window.open("/html/pop_availability/pop_availability.html", "disponibilita", "scrollbars=no,width=390,height=330");
		}			
