
    jQuery.fn.popupdiv = function(options, callback) {
	    var settings = {
		    popdovID        :null,
		    autoWidth       :true,
		    mouseoutClose   :true,
		    height          :230,
		    event           : 'click',
		    speed           : 'normal'
	    };

	    if(options) {
		    jQuery.extend(settings, options);
	    };
    	
	    var callback = callback || function() { };
    	
        var $inputobj =jQuery(this)[0];
        var $popdov;
        
        if (settings.popdovID){
	        $popdov = jQuery("#"+ settings.popdovID);
	    }
	    
	    jQuery("body").append($popdov);
	    var $needAddWidth = true;
	    var htmlLength = -1;
	    
	    jQuery(this)[settings.event](function(e) {
	        //alert("dd");
            $popdov.hide();
	       jQuery("body").bind( "mouseup", divmouseup );
	       
	        var self = this;
    		
		    function doNothing() {}; //empty function

		    if (settings.autoWidth){
		       if ( $popdov.width() < jQuery(this).width()){
		            $popdov.width(jQuery(this).width() + 2);
		       }
		    }
		    var height = parseInt(settings.height);
		    if (height > 0){
		    
		        var popdovHeight = 0;
		        var tempHtml = $popdov.html();
		        if (htmlLength != tempHtml.length){
		            var $tempDiv = jQuery("<div id='ddddddd'></div>");
		            htmlLength = tempHtml.length;
		            $tempDiv.html(tempHtml);
		            jQuery("body").append($tempDiv);
		            var popdovHeight = $tempDiv.height();
		            $tempDiv.remove();
		        }
		        
		       if ( popdovHeight > height){
		            $popdov.height(height);
		            if ( $needAddWidth){
		              $popdov.width($popdov.width() + 33);
		               $needAddWidth = false;
		             }
		       }
		    }
           
		    putcontainer();
    	    
		    function putcontainer() {

        		var st = document.documentElement.scrollTop;
                $popdov.css("top",$inputobj.getBoundingClientRect().top + st+ jQuery($inputobj).height());
                $popdov.css("left",$inputobj.getBoundingClientRect().left -2);
			    
			    $popdov.show();
		    }
    		
		    function hidedivs() 
		    {
		        jQuery("body").unbind( "mouseup", divclick );
		        $popdov.hide();//('slow');
		    }
		    
		    function divmouseup( e )
		    {
		        divclick(e);
		    } 
		    function divclick( e ) 
		    {
			    hidedivs();
    	    }
	        return false;
	    });
        return(this);
    }

 jQuery.fn.iframe = function(options) {
    return this.each(function() {
        var $this = jQuery(this);
        var cls = this.className;
        
        var opts = jQuery.extend({
            frameborder:  ((cls.match(/fb:(\d+)/)||[])[1]) || 0,
            marginwidth:  ((cls.match(/wm:(\d+)/)||[])[1]) || 0,
            marginheight: ((cls.match(/hm:(\d+)/)||[])[1]) || 0,
            width:        ((cls.match(/w:(\d+)/)||[])[1]) || 640,
            height:       ((cls.match(/h:(\d+)/)||[])[1]) || 480,
            scrolling:    ((cls.match(/sc:(\w+)/)||[])[1]) || "auto",
            version:     '1,0,0,0',
            cls:          cls,
            src:          $this.attr('href') || $this.attr('src'),
			id:			  $this.attr('id'),
            caption:      $this.text(),
            attrs:        {},
            elementType:  'div',
            xhtml:        true
        }, options || {});
        
        var endTag = opts.xhtml ? ' />' : '>';

        var a = ['<iframe src="' + opts.src + '"'];
		if(opts.id){
			a.push(' id="' + opts.id + '"');
		}else{
			a.push(' id="content_iframe"');
		}
		a.push(' frameborder="' + opts.frameborder + '"');
		a.push(' marginwidth="' + opts.marginwidth + '"');
		a.push(' marginheight="' + opts.marginheight + '"');
		a.push(' width="' + opts.width + '"');
		a.push(' height="' + opts.height + '"');
		a.push(' scrolling="' + opts.scrolling + '"');
		a.push(endTag);
        
        // convert anchor to span/div/whatever...
        var $el = jQuery('<' + opts.elementType + ' class="' + opts.cls + '"></' + opts.elementType + '>');
        $el.html(a.join(''));
        $this.after($el).remove();
    });
};