


Element.implement({
    smartDispose: function() {

		var fnChain = new Chain();
		var ShadowId = this.options.id; 

		 
		fnChain.chain(function()
			{
				var myEffect = new Fx.Morph(ShadowId , {duration: 100, transition: Fx.Transitions.Sine.easeOut});
				myEffect.start(
		  		{  
		   			'left': 990
		  		}
		  		);
			}	
		 );
		 

		fnChain.callChain(); 
  		//fnChain.callChain.delay(1000, fnChain); 

	}, // end smartDispose
	dropShadow: function(options) {
	    // creates a shadow effect to a rectangular element

	    // define defaults
        this.options = $merge({
            id: "shadow_" + options.main_id,
            x: 8, // offset from parent
            y: 8,
            border: "1px solid #000",
            background: "#555",           
            opacity: .4,
            zIndex: this.getStyle("z-index").toInt() - 1 // behind parent
        }, options);

        // only apply shadow on absolutely positioned elements
        if (this.getStyle("position") != "absolute")
            return this;

        var c = this.getCoordinates();
		
		if ($( this.options.id)) {
	        $( this.options.id).destroy();
	    }
		
	//	alert(this.options.delta_x);
	
        new Element("div", {
            id: this.options.id,
            styles: {
                position: "absolute",
                left: this.options.main_left + this.options.x - this.options.delta_x,
                top: c.top + this.options.y - this.options.delta_y,
                width: c.width,
                height: c.height,
                background: this.options.background,
                zIndex: this.options.zIndex/*,
                border-radius: "15px"*/
            },
            opacity: 0
        }).injectBefore(this).fade(0, this.options.opacity);
	        
        $(this.options.id).setStyle('border-radius','15px');
        
	
       return this;
    } 
})



	//MOSTRA DIV CON EFFETTO IN ENTRATA
var g_id = null;
	function ShowDiv(id, name, short_desc, image_prod, weight, color, options)
	{
		if (g_id != null){
			HiddenDiv(g_id);
		}
	
	//	$(id).focus();
		
		var div_left = 200;
		var div_top = "NO";
		var delta_y = 170;
		var delta_x = 0;
		
		
		if(options != null)
		{
			if(options.left != null)
				div_left =  options.left; 
			
			if(options.top != null)
				div_top =  options.top; 			

			if(options.delta_y != null)
				delta_y =  options.delta_y; 
			
			if(options.delta_x != null)
				delta_x =  options.delta_x; 			

		}
		
		
		
		var myEffect = new Fx.Morph(id , {
			duration: 150, 
			transition: Fx.Transitions.Elastic.easeOut,
			onComplete: function(){
			
			//creo arrotondamenti
 					var opt = {
							radius : "10px"
						  }
				//	GoodCorners.round($(id),opt);			
					
				
 				
 				
 				
					
					$(id).dropShadow(
							{    'main_id': id
								, 'main_left':200
								, 'delta_y':delta_y
								, 'delta_x':delta_x
							}
							);
					
					


					
		//		location ="#" + id;//	alert("yes");
							
				}			
			});
		
		if(div_top != "NO")
			myEffect.start(
		  		{  
		   			'left':div_left
		   			,'top':div_top
		  		}  		
			);
		else
			myEffect.start(
			  		{  
			   			'left':div_left
			  		}  		
				);
			
  		
  		g_id = id;



		
	}
	
 
	
//NASCONDE DIV CON EFFETTO IN USCITA
function HiddenDiv(id)
	{
		g_id = null;
		var myEffect = new Fx.Morph(id , {duration: 100, transition: Fx.Transitions.Sine.easeOut});
		myEffect.start(
  		{  
   			'left': 990
  		}
  		);
  		


  		$(id).smartDispose();
		


	}

function StampaProdotto(id, name, short_desc, image_prod, weight, color)
{
	win =window.open();
	html_code = "<div id=\""  + id +"\"><div style=\"float:left;\"><img src=\"" + image_prod  +"\"></div><div>" + short_desc +"</div><div>cod: " + name + "</div><div>peso: "  +  weight + ".g</div><div>colore: " + color + "</div></div>";
	win.document.write(html_code);
	win.document.close();
	win.print();
	return false;
	
}

function InviaCodProdotto(indirizzocorrente, codiceprodotto)
{
	//var url_eccomerce = "https://ecommerce.newelfin.com/reserved/fancy?user=" + username + "&hash=" + password;

	//if(codiceprodotto!="")	
	//	url_eccomerce = "https://ecommerce.newelfin.com/reserved/fancy?user=" + username + "&hash=" + password + "&item=" + codiceprodotto;

	//window.alert (url_eccomerce);
   // 	mywindow = window.open(url_eccomerce, "ecommerce", "location=1, width=800, height=600, scrollbars=yes, resizable=yes");
    	//mywindow.moveTo(0, 0);
   // 	mywindow.focus();
	
	//SERVER IN LOCALE
	//var server = "http://192.168.0.1:800/php/Alessandro/joomla/";
	//index.php?option=com_content&view=article&id=58
	
	//SERVER IN REMOTO
	var server = "http://www.newelfin.com/";
	//index.php?option=com_content&view=article&id=70
	
	location = server + "index.php?option=com_content&view=article&id=70&item=" + codiceprodotto + "&returnaddress=" + indirizzocorrente;
	
}

var url_indiceprodotti_ita ="http://www.newelfin.com/it/prodotti";
var url_indiceprodotti_en ="http://www.newelfin.com/en/products";
var url_indiceprodotti_fr ="http://www.newelfin.com/fr/produits-index";
var url_indiceprodotti_de ="http://www.newelfin.net/index.php?option=com_content&view=article&id=55&Itemid=66&lang=de";
var url_indiceprodotti_es ="http://www.newelfin.net/index.php?option=com_content&view=article&id=55&Itemid=66&lang=es";
var url_indiceprodotti_pt ="http://www.newelfin.net/index.php?option=com_content&view=article&id=55&Itemid=66&lang=pt";
var winEcommerce=null;

