/*
 * FourthMedia Show Dialog base on BlcokUI
 * Version 1.0 (1 Dec 2008)
 * @requires jQuery v1.2.3 , JQuery BlcokUI 2.10 or later
 * Created By Brand HU
 */

function Addloading(theobjectID){
    var theobject = jQuery('#'+theobjectID);
    if(theobject){
      // var obj = document.getElementById(theobjectID)
      //theobject.parent().css("background", "yellow");
       var theparent = theobject.parent();
       var thewitdh = parseInt(theparent.attr("DWidth"))
       var theheight = parseInt(theparent.attr("DHeight"))
       var thestyle1 = theparent.css("padding-top");
       var thestyle2 = theparent.css("padding-right");
       var thestyle3 = theparent.css("padding-bottom");
       var thestyle4 = theparent.css("padding-left");
       var pt = 0
       var pr = 0
       var pb = 0
       var pl = 0
        if (thestyle1){
            pt = thestyle1.replace("px","")
        }
         if (thestyle2){
            pr = thestyle2.replace("px","")
        }
         if (thestyle3){
            pb = thestyle3.replace("px","")
        }
         if (thestyle4){
            pl = thestyle4.replace("px","")
        }
            if (thewitdh > 10){
                
            }else{
                thewitdh = theparent.innerWidth()-pl-pr;
            }
            if (theheight > 10){
            }else{
                theheight = theparent.innerHeight()-pt-pb;//getElementHeight(obj);
            }
       
       // alert(thewitdh + "  " + theheight )
        var theloadinglay = "<div class='pakiloadingoverlay' style='width:"+thewitdh+"px;height:"+theheight+"px;'></div><div class='pakiloadinginner' style='width:"+thewitdh+"px;height:"+theheight+"px;'></div>"
        var odlhtml = theobject.html();
        theobject.html(theloadinglay+odlhtml)
    }
}

function getElementHeight(obj){
	if (typeof obj.clip !== "undefined") {
		return obj.clip.height;
	} else {
		if (obj.style.pixelHeight) {
			return obj.style.pixelHeight;
		} else {
			return obj.offsetHeight;
		}
	}
}
function getElementWidth(obj){
	if (typeof obj.clip !== "undefined") {
		return obj.clip.width;
	} else {
		if (obj.style.pixelWidth) {
			return obj.style.pixelWidth;
		} else {
			return obj.offsetWidth;
		}
	}
}
