var isMozilla;
var objDiv = null;
var addHeader;
var msg = '';
var myWidth = 0, myHeight = 0;
var arrayvar = new Array();
	var    left = myWidth/2
	var    top = myHeight/2 ;

	var	   title = 'Microsoft Internet Explorer';
	var    width = 209;
	var    height = 126;

	var over;
addHeader = '<table cellspacing="0" cellpadding="0">' +
			'<tr><td ondblclick="void(0);" onmouseover="over=true;" onmouseout="over=false;" style="cursor:move;"><img src="images/alert_left.gif" border="0"></td><td><table cellpadding="0" cellspacing="0"><tr><td><img src="images/alert_top.gif" border="0"></td></tr><tr><td><a href="javascript:hiddenFloatingDiv(\'myalert\');void(0);"><img src="images/alert_button.gif" border="0"></a></td></tr><tr><td><img src="images/alert_bottom.gif" border="0"></td></tr></table></td><td><img src="images/alert_right.gif" border="0"></td></tr></table>';

document.write('<div align="center" style="width:209;height:126px;visibility:hidden;font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px;font-style:normal;position:absolute;z-index:100000000;top:'+top+';left:'+left+';" id="myalert">'+addHeader+'<table cellpadding="0" cellspacing="0"><tr><td align="left"><img src="images/alert_bottom_left.gif" height="120" width="3" border="0"></td><td bgcolor="#ECE9D8"><img src="images/1x1trans.gif" width="201" height="1" border="0"><br><center><font size = "2"><div id="mymsg">mymsg</div></font><br><form><input style="width:40px;font-size:50%;" type="button" value="OK" onclick="javascript:hiddenFloatingDiv(\'myalert\');"></form></center></td><td><img src="images/alert_bottom_right.gif" border="0" height="120" width="3"></td></tr><tr><td align="left"><img src="images/alert_bottom_bottom_left.gif" border="0"></td><td colspan="2"><img src="images/alert_bottom_bottom_middle.gif" border="0" width="201" height="3" ><img src="images/alert_bottom_bottom_right.gif" border="0"></td></tr></table></div>');

function myalert(msg){

  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    left = (myWidth/2)-(width/2)
	var    top = ((myHeight/4)*3)-(height/2)-12 ;

var over = false;
var num = document.forms.length;
	for (var f = 0; f < num; f++){
		var numelement = document.forms[f].elements.length;
		for (var e = 0; e < numelement; e++){
			if(document.forms[f].elements[e].type != 'submit'){
				if (document.forms[f].elements[e].options){
					var len = document.forms[f].elements[e].options.length;
					flag = 1;
					for (var i = 0; i < len; i++) {
						if(document.forms[f].elements[e].options[i].selected == true){
							tmphtml = "<input style='width:170px;height:22px;background-image:url(images/select_button.gif);background-position:right;' type='text' name='' value=' " + document.forms[f].elements[e].options[i].value + "'>";
							arrayvar['Form'+f+'Element'+e] = document.forms[f].elements[e].outerHTML;
							document.forms[f].elements[e].outerHTML = tmphtml;
							break;	
						}
					}
				}
			}
		}
	}
	document.getElementById('mymsg').innerHTML = msg;
	document.getElementById('myalert').style.top = top;
	document.getElementById('myalert').style.left = left;
	document.getElementById('myalert').style.visibility = "visible";


}


//
//
//
function hiddenFloatingDiv() 
{
	document.getElementById('myalert').style.visibility='hidden';
	for (key in arrayvar){
		var ar = key.match(/Form(\d+)Element(\d+)/);
		document.forms[RegExp.$1].elements[RegExp.$2].outerHTML = arrayvar[key];
	}
}
//
//
//
function MouseDown(e) 
{
    if (over)
    {
        if (isMozilla) {
            objDiv = document.getElementById('myalert');
            X = e.layerX;
            Y = e.layerY;
            return false;
        }
        else {
            objDiv = document.getElementById('myalert');
            objDiv = objDiv.style;
            X = event.offsetX;
            Y = event.offsetY;
        }
    }
}


//
//
//
function MouseMove(e) 
{
    if (objDiv) {
        if (isMozilla) {
            objDiv.style.top = (e.pageY-Y) + 'px';
            objDiv.style.left = (e.pageX-X) + 'px';
            return false;
        }
        else 
        {
            objDiv.pixelLeft = event.clientX-X + document.body.scrollLeft;
            objDiv.pixelTop = event.clientY-Y + document.body.scrollTop;
            return false;
        }
    }
}

//
//
//
function MouseUp() 
{
    objDiv = null;
}


//
//
//
function init()
{
    // check browser
    isMozilla = (document.all) ? 0 : 1;


    if (isMozilla) 
    {
        document.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);
    }

    document.onmousedown = MouseDown;
    document.onmousemove = MouseMove;
    document.onmouseup = MouseUp;

    // add the div
    // used to dim the page

}

// call init
init();
