function jsShare(type,url,name)
{
	switch(type)
	{
		case "facebook":
/*			urle="http://www.facebook.com/share.php?u="+encodeURIComponent(url)+"&t="+encodeURIComponent(name);*/
			urle="http://www.facebook.com/sharer.php?u="+encodeURIComponent(url)+"&t="+encodeURIComponent(name);
			window.open(urle,'share', 'toolbar=0,status=0,width=850,height=436');
			break;
		case "twitter":
			if(type.length<141){
				urle="http://twitter.com/home?status="+encodeURIComponent(name)+" - "+encodeURIComponent(url);
				window.open(urle,'share', 'toolbar=0,status=0,width=850,height=436');
			}else{
				alert("El tweet execede los 140 caracteres, no se puede publicar en Twitter");
			}
		break;
		case "delicious":
			urle="http://delicious.com/post?url="+encodeURIComponent(url)
				+"&title="+encodeURIComponent(name)
				+"&notes="+encodeURIComponent(name)
			window.open(urle,'share', 'toolbar=0,status=0,width=850,height=436');
		break;
	}
}

var modalWindow = {
    parent:"body",
    windowId:null,
    content:null,
    width:null,
    height:null,
    close:function()
    {
        jQuery(".modal-window").remove();
        jQuery(".modal-overlay").remove();
    },
    open:function()
    {
        var modal = "";
        modal += "<div class=\"modal-overlay\"></div>";
        modal += "<div id=\"" + this.windowId + "\" class=\"modal-window\" style=\"width:" + this.width + "px; height:" + this.height + "px; margin-top:-" + (this.height / 2) + "px; margin-left:-" + (this.width / 2) + "px;\">";
        modal += this.content;
        modal += "</div>";   

        jQuery(this.parent).append(modal);

        jQuery(".modal-window").append("<a class=\"close-window\"></a>");
        jQuery(".close-window").click(function(){modalWindow.close();});
        jQuery(".modal-overlay").click(function(){modalWindow.close();});
    }
};
var openMyModal = function(source)
{
    source+="&popup=popup";
    modalWindow.windowId = "myModal";
    modalWindow.width = 640;
    modalWindow.height = 600;
    modalWindow.content = "<iframe width='640' height='600' frameborder='0' scrolling='no' allowtransparency='true' src='" + source + "'></iframe>";
    modalWindow.open();
};
