/**************************************************
 * Radio.blog Tools : Detach Button
 * detach.js
 * 30.05.2006
 * Version : 0.2
 * Author : astro @ mubility
 * Blog : blog.mubility.com
 **************************************************/

// ======= DETACH BUTTON =========================================================================================================================
RadioBlog.detachButton = function(id,text) {
    document.write('<a href="javascript:RadioBlog.detach(\''+id+'\');">'+text+'</a>');
}

RadioBlog.detach = function(id) {
	    var obj = document.getElementById(id);
	    var popupHTML = obj.innerHTML;
        var width = obj.offsetWidth;
        var height = obj.offsetHeight;
	    RadioBlog.save = obj.innerHTML;
        var popupWin = window.open('','radioblog'+id,'width='+(parseInt(width))+',height='+(parseInt(height))+',toolbar=no,scrollbars=no,resizable=yes');
        popupWin.document.write('<html><head><title>'+this.title+'</title></head>'
                                +'<body onbeforeunload="window.opener.RadioBlog.undetach(\''+id+'\')" style="background:'+this.color.body+'">'+popupHTML+'</body></html>');
        popupWin.document.close();
        obj.innerHTML = '';
}

RadioBlog.undetach = function(id) {
	    var obj = document.getElementById(id);
	    obj.innerHTML = RadioBlog.save;
}