(function($) {
  $.fn.downloadr = function() {
  	return this.each(function() {
  	
  	function returnBrowserTest(){
				
					var dlBrowser = $.browser.browser();
					
					var dlString = '';
					
					switch(dlBrowser){
					
						case "Safari":
						
						dlString = 'Da click derecho en el icono y escoja en el menu <strong>Guardar el archivo como...</strong> o <strong>Guardar el enlace como...</strong>';
						
						break;
						
						case "Firefox":
						
						dlString = 'Da click derecho en el icono y escoje en el menu <strong>Guardar enlace como...</strong>'
						
						break;
						
						case "Msie":
						
						dlString = 'Da click derecho en el icono y escoje en el menu <strong>Guardar enlace como...</strong>';
						
						break;
						
						default:
						
						dlString = 'Da click derecho en el icono y escoje en el menu <strong>Guardar enlace como...</strong>';
					}
					
					
					return dlString;
				}	
				
				var element = this;
			  
			  	$(element).addClass("download_link2");
			  	
			  	var theTitle = $(element).attr('title');
			  				  	
				var theLink = $(element).attr('href');
	
			  	$(element).bind('click',function(e){
			  	
			  		e.preventDefault();

				  	var html = "";
				  	
				  	html += "<h2>Descarga tu " + theTitle + "</h2>";
				  	html += "<p>Para descargar '" + theTitle + "', simplemente " + returnBrowserTest() + "</p>";
				  	html += "<p style='text-align:center;'><a href='" + theLink + "'><img height='215' width='310' src='" + theLink + "' alt='Right click and save as to download' id='download_file'/></a></p>";
				  	html += "<p>Si quieres abrir el archivo en tu explorador, da click <strong><a href='" + theLink + "'>aquí</a></strong>.</p>";
				  	
				  	jQuery.facebox(html);
			  		
			  	});
			  	});

  }
})(jQuery);
