function showProgressBar() {
	hideProgressBar();
		var o=$('<div id="progressBar">'+		
		'</div>').css({border: 'solid 1px black', height: $(document).height()+'px',width: $(document).width()+'px',position:'absolute',left:0,top:0,'z-index': 999,  opacity: 0.5, 'background-color': 'black'}); 
	o.prependTo("body");	
	
	var pb=$('<div id="progressBar_ImgContainer" style="width: 250px; height: 50px; padding-top: 25px; padding-left: 30px;">'+
		'<img src="images/progressbar.gif" id="progressBar_img"/>'+
		'</div>');
	pb.prependTo("body");
	var it=$("#progressBar_ImgContainer");
	it.css("position", "absolute").css({
		top: ($("#progressBar").height()/2-it.height()/2)+"px",
		left: ($("#progressBar").width()/2-it.width()/2)+"px",
		opacity: 2.0,
		"z-index": 1100,
		"background-color": "white"
	});
}

function hideProgressBar() {
	$("#progressBar").hide();
	$("#progressBar_ImgContainer").hide();
}

function cshared() {

	this.isCSS=function() {return ((document.body && document.body.style) ? true : false);}
	this.isIE4=function() {return ((this.isCSS() && document.all) ? true : false);}
	this.isNN4=function() {return (document.layers ? true : false);}
	this.isIE6CSS=function() {return ((document.compatMode && document.compatMode.indexOf("CSS1") >= 0) ? true : false);}


	this.getRawObject=function (obj) {
    	if (typeof obj == "string") { return document.getElementById(obj);
    		} else { return obj;}
	}

	// Retrieve the x coordinate of a positionable object
	this.getObjectPosition_old=function (obj)  {
    	var elem = this.getRawObject(obj);
		var pos=new Object();    
    	var offsetTrail = elem;
    	var offsetLeft = 0;
    	var offsetTop = 0;
    	// account for IE 6 CSS compatibility mode
   		while (offsetTrail) {
        	offsetLeft += offsetTrail.offsetLeft;
        	offsetTop += offsetTrail.offsetTop;
        	offsetTrail = offsetTrail.offsetParent;
    	}
   		if (navigator.userAgent.indexOf("Mac") != -1 && 
        	typeof document.body.leftMargin != "undefined") {
        	offsetLeft += document.body.leftMargin;
        	offsetTop += document.body.topMargin;
    	}
		pos.x=offsetLeft;
		pos.y=offsetTop;
    	return pos;
	}
	
	this.getObjectPosition=function(obj) {	
		var curleft = curtop = 0;
		var elem = this.getRawObject(obj);
		if (elem.offsetParent) {
			curleft = elem.offsetLeft
			curtop = elem.offsetTop
			while (elem = elem.offsetParent) {
				curleft += elem.offsetLeft
				curtop += elem.offsetTop
			}
		}
		var pos=new Object();
		pos.x=curleft;
		pos.y=curtop;
		return pos;
	}
	
	
	this.hideObject=function (obj) {
		var elem = this.getObject(obj);
		elem.display='none';
	}
	
	this.showObject=function (obj) {
		var elem = this.getObject(obj);
		elem.display='block';
	}	
   
   
	// Retrieve the rendered width of an element
	this.getObjectSize=function (obj)  {
    	var elem = this.getRawObject(obj);
		//alert(elem.name);
    	var size=new Object();
    	if (elem.offsetWidth) {
        	size.x = elem.offsetWidth;
			size.y = elem.offsetHeight;
    	} else if (elem.clip && elem.clip.width) {
        	size.x = elem.clip.width;
			size.y = elem.clip.height;
    	} else if (elem.style && elem.style.pixelWidth) {
        	size.x = elem.style.pixelWidth;
			size.y = elem.style.pixelHeight;
    	}
    	return size;
	}
   
   this.moveTo=function(obj, pos) {
		//alert(obj+': '+pos.x+';'+pos.y);
   		var elem = this.getRawObject(obj);		
    	if (elem) {
        	if (this.isCSS) {
			elem.style.position="absolute";
            elem.style.left = pos.x+"px";
            elem.style.top = pos.y+"px";
        	} 
    	}		
   }
   
   this.showObj1UnderObj2=function(Obj1, Obj2) {
   	 var pos=this.getObjectPosition(Obj2);
   	 var size=this.getObjectSize(Obj2);
   	 pos.y=pos.y+size.y;
   	 this.moveTo(Obj1, pos);
   	 this.showObject(Obj1);
   	 
   }
   
   this.getObject=function (obj) {
    	var theObj = this.getRawObject(obj);
    	if (theObj && this.isCSS) {theObj = theObj.style;}
    	return theObj;
	}
	
	this.showObjectInCenter=function(obj) {
		var size=this.getObjectSize(obj);
		var wc=this.getWindowCoordinate();
		var pos=new Object();
		pos.x=(wc.right-wc.left)/2+wc.left-size.x/2;
		pos.y=(wc.bottom-wc.top)/2+wc.top-size.y/2;
		this.moveTo(obj, pos);
	}
	
	this.getWindowCoordinate= function () {
		  var myWidth = 0, myHeight = 0;
		  if( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
		  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
		  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
		  }
		  
		  var scrOfX = 0, scrOfY = 0;
		  if( typeof( window.pageYOffset ) == 'number' ) {
			//Netscape compliant
			scrOfY = window.pageYOffset;
			scrOfX = window.pageXOffset;
		  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
			//DOM compliant
			scrOfY = document.body.scrollTop;
			scrOfX = document.body.scrollLeft;
		  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
			//IE6 standards compliant mode
			scrOfY = document.documentElement.scrollTop;
			scrOfX = document.documentElement.scrollLeft;
		  }
		  
		  var obj=new Object();
		  obj.top=scrOfY;
		  obj.left=scrOfX;
		  obj.right=scrOfX+myWidth;
		  obj.bottom=scrOfY+myHeight
		  return obj;
	}
}

//alert(1);
var shared=new cshared();