function creatDrogDiv(){
	var DrogDiv_txt=""
	+"<div id=\"DrogDiv\" style=\"position:absolute;visibility:hidden; width:200px; height:115px; z-index:1; left: 0px; top: 100px; background-color: #58B5F0; layer-background-color: #FF0000; border: 1px none #000000;\">"
	+"<table width=100% border=0><tr><td align=right valign=middle><a href=# onClick='closeFloatingDiv();return false;'><b style='background-color:white;text-decoration: none;color:red; font-weight: bold; font-size: 20px'>&times;</b></a></td></tr></table>"
	+"<iframe "
	+"	id=\"PopupInnerPage\" "
	+"	name=\"PopupInnerPage\" "
	+"	src=\"\""
	+"	frameborder=\"1\" "
	+"	scrolling=\"no\" "
	+"	style=\"width:100px; height:100px; visibility:hidden;z-index:10000; \"> "
	+"</iframe>"
	+"</div>";
	
	if(!document.getElementById("DrogDiv")){
		document.write(DrogDiv_txt);
	}
}


function getXY(event){
		var evt=event;
		var coords = {x: 0, y: 0};
		if (typeof window.pageXOffset != 'undefined') {
			coords.x = window.pageXOffset + evt.clientX;
			coords.y = window.pageYOffset + evt.clientY;
		}
		else if (document.compatMode && document.compatMode != 'BackCompat') {
			coords.x = document.documentElement.scrollLeft + evt.clientX;
			coords.y = document.documentElement.scrollTop + evt.clientY;
		}
		else {
			coords.x = document.body.scrollLeft + evt.clientX;
			coords.y = document.body.scrollTop + evt.clientY;
		}
		return coords;
}
function drag(o,r){
if(o){
	o.onmousedown=function(a){
		var d=document;if(!a)a=window.event;
		var x=a.layerX?a.layerX:a.offsetX,y=a.layerY?a.layerY:a.offsetY;
		if(o.setCapture)
			o.setCapture();
		else if(window.captureEvents)
			window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);

		d.onmousemove=function(event){
		
			var coords=getXY(a);
			var tx=coords.x-x,ty=coords.y-y;

			o.style.left=tx;
			o.style.top=ty;
			
			o.style.filter='Alpha(opacity=70)';
			o.style.opacity='0.7';
			//o.style.width=o2.style.width;
			
			//o2.style.left=o.style.left.replace('px','');
			//o2.style.top=parseInt(o.style.top.replace('px',''))+30;
	
		};

		d.onmouseup=function(){
			if(o.releaseCapture)
				o.releaseCapture();
			else if(window.captureEvents)
				window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
			d.onmousemove=null;
			d.onmouseup=null;
			
			o.style.filter='Alpha(opacity=100)';
			o.style.opacity='1.0';	
		};
	};
}
}




function popupFloatingDiv(url,widnow_width,window_height){
	
	window.scroll(0,0);
	
	var f=document.getElementById("PopupInnerPage");

	//var widnow_width=600;
	//var window_height=300;
	var window_top;
	var window_left;
	window_top=((document.body.clientHeight-window_height)/2);
	window_left=((document.body.clientWidth-widnow_width)/2);
	
		f.style.width=widnow_width;
		f.style.height=window_height;
		f.style.top=window_top;
		f.style.left=window_left;  //150 is (300/2) is to avoid the fuction stretchRight() in 'mail.js',I'm not sure what this function is working for...
		f.style.visibility="visible";
		f.src=encodeURI(url); //set the URL of the page that you want include
	
	var d=document.getElementById("DrogDiv");
			
		d.style.width=f.style.width;
		d.style.height=f.style.height;
		d.style.top=parseInt(f.style.top.replace('px',''))-30;
		d.style.left=f.style.left;
		d.style.visibility="visible";

}

function closeFloatingDiv(){

	var f=window.parent.document.getElementById("PopupInnerPage");

	f.style.width="0px";
	f.style.height="0px";
	f.style.top="0";
	f.style.left="0";
	//f.style.padding-left="0";
	//f.style.marginheight="0";
	f.src="";
	f.style.visibility="hidden";
	
	var d=window.parent.document.getElementById("DrogDiv");
	d.style.width="0px";
	d.style.height="0px";
	d.style.top="0";
	d.style.left="0";
	d.style.visibility="hidden";
	
	return false;
}



window.onload=function(){
	if(document.getElementById('DrogDiv')){
		drag(document.getElementById('DrogDiv'),[0,screen.availWidth ,0,screen.availHeight]);
	}
};
