﻿document.write("<div id='divEvent' class='' style='z-index:1000;display:none;position:absolute;border-style:solid;background-color:transparent;padding: 5px;width:350px;height:auto'></div>");    
document.write("<div id='divMsg' class='' style='display:none;position:absolute;border-style:solid;background-color: white;padding: 5px;'></div>");    
//document.write("<div style='visibility:hidden; border: 1px solid #C4A251; height: auto; min-width: 65px; background-color: #FFF5CE; clip: rect(auto, auto, auto, auto); position: absolute; z-index: 1000;' id='divMsg'></div>");
      
        //var rootdomain = "http://localhost:8077/Presentation/"
        
        function ajaxpage(url, hiddenField) {

            var page_request = false;
            if (window.XMLHttpRequest) // if Mozilla, Safari etc
                page_request = new XMLHttpRequest();
            else if (window.ActiveXObject) { // if IE
                try {
                    page_request = new ActiveXObject("Msxml2.XMLHTTP");
                    //page_request = new XMLHttpRequest();;                                           
                }
                catch (e) {
                    try {

                        page_request = new ActiveXObject("Microsoft.XMLHTTP");
                    }
                    catch (e) { }
                }
            }
            else
                return false;

            document.getElementById('div_' + hiddenField).innerHTML = '<img width="16px" height="16px" src="' + absolutePath + '/images/checking.gif"/>'; //"checking...";
            page_request.onreadystatechange = function() {
                loadpage(page_request, hiddenField);
            }
            page_request.open('GET', url, true);
            page_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            page_request.send(null);

        }

        function loadpage(page_request, hiddenField) {
            if (page_request.readyState == 4 && (page_request.status == 200 || window.location.href.indexOf("http") == -1)) {
                var str = page_request.responseText; // here you get the response
                var arr = str.split('@');
                if (arr[1] == '0') {
                    window['var_' + hiddenField] = '';
                    flag_SCID = 0; //if flag_SCID=0 then invalid if flag_SCID=1 then valid also defined in customevalidation.cs
                } else
                    flag_SCID = 1;
                
                document.getElementById('div_' + hiddenField).innerHTML = arr[0]; //page_request.responseText; // here you get the response              
                page_request = false;
            }
        }
        var cX = 0; var cY = 0; var rX = 0; var rY = 0;
        function UpdateCursorPosition(e) { cX = e.pageX; cY = e.pageY; }
        function UpdateCursorPositionDocAll(e) { cX = event.clientX; cY = event.clientY; }
        if (document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
        else { document.onmousemove = UpdateCursorPosition; }
        function AssignPosition(d) {
            if (self.pageYOffset) {
                rX = self.pageXOffset;
                rY = self.pageYOffset;
            }
            else if (document.documentElement && document.documentElement.scrollTop) {
                rX = document.documentElement.scrollLeft;
                rY = document.documentElement.scrollTop;
            }
            else if (document.body) {
                rX = document.body.scrollLeft;
                rY = document.body.scrollTop;
            }
            if (document.all) {
                cX += rX;
                cY += rY;
            }
            d.style.left = (cX + 10) + "px";
            d.style.top = (cY + 10) + "px";
        }
        function HideContent(d) {
            if (d.length < 1) { return; }
            document.getElementById(d).style.display = "none";
        }
        function ShowContent(d) {
            if (d.length < 1) { return; }
            var dd = document.getElementById(d);
            AssignPosition(dd);
            dd.style.display = "block";
        }
        function ReverseContentDisplay(d) {
            if (d.length < 1) { return; }
            var dd = document.getElementById(d);
            AssignPosition(dd);
            if (dd.style.display == "none") { dd.style.display = "block"; }
            else { dd.style.display = "none"; }
        }

//        // Detect if the browser is IE or not.
//        // If it is not IE, we assume that the browser is NS.

//        var IE = document.all ? true : false;

//        // If NS -- that is, !IE -- then set up for mouse capture
//        if (!IE) document.captureEvents(Event.MOUSEMOVE);

//        // Set-up to use getMouseXY function onMouseMove
//        document.onmousemove = getMouseXY;

//        // Temporary variables to hold mouse x-y pos.s
//        var tempX = 0;
//        var tempY = 0;

//        // Main function to retrieve mouse x-y pos.s

//        function getMouseXY(e) {
//            if (IE) { // grab the x-y pos.s if browser is IE
//                tempX = event.clientX + document.body.scrollLeft;
//                tempY = event.clientY + document.body.scrollTop;
//            } else {  // grab the x-y pos.s if browser is NS
//            tempX = e.pageX;
//            tempY = e.pageY;
//            }
//            // catch possible negative values in NS4
//            if (tempX < 0) {tempX = 0; }
//            if (tempY < 0) {tempY = 0;}
//            // show the position values in the form named Show
//            // in the text fields named MouseX and MouseY
//            return true;
//        }

        //-->
        function ShowDiv(msg) {
//            //alert('this is the function alert!');
//            var div = document.getElementById('divMsg');
//            //            div.style.zIndex = 1000;
//            //            div.style.position = 'absolute';

//            //  alert('id='+obj.id+' top=' + div.style.top + ' left=' + div.style.left);
//            //            if(IE)
//            //            {
//            //            div.style.top = tempY-65;//getPosition(e).y - 65;
//            //            div.style.left = tempX+10;//getPosition(e).x + 10;
//            //            }
//            //            else
//            //            {
//            //            alert(tempY);
//            //               div.style.offsetTop = tempY-65;//getPosition(e).y - 65;
//            //            div.style.offsetLeft = tempX+10;//getPosition(e).x + 10;
//            //            }

//            // div.style.top = getRealTop(obj);
//            // div.style.left = getRealLeft(obj) + 25;
//            document.getElementById('divMsg').style.visibility = 'visible';
//            //  div.style.visibility = 'visible';
//            //  div.style.display = '';
//            document.getElementById('divMsg').innerHTML = msg;
//            //  div.innerHTML = 'hello';
//            document.getElementById('divMsg').className = 'text_maroon_10';



//            if (IE) {
//                var top = tempY - 10; //- divMsg.offsetHeight - 3;
//                var left = tempX + 10; //- divMsg.offsetWidth - 3;
//                document.getElementById('divMsg').style.top = top + 'px';
//                document.getElementById('divMsg').style.left = left + 'px';
//            }
//            else {
//                try {
//                    var top = tempY - 10; //- document.getElementById('divMsg').offsetHeight - 3;
//                    var left = tempX + 10; //- document.getElementById('divMsg').offsetWidth - 3;
//                    document.getElementById('divMsg').style.top = top + 'px';
//                    document.getElementById('divMsg').style.left = left + 'px';
//                    document.getElementById('divMsg').height = 100;
//                }
//                catch (Ex) {
//                    alert(Ex);
//                }
//            }

            //            // div.className = 'text_maroon_10';
            document.getElementById('divMsg').innerHTML = msg;
            ShowContent('divMsg');

        }

        function hideDiv() {
            HideContent('divMsg');
//            var div = document.getElementById('divMsg');
//            if (div.style.visibility == 'visible') {
//                div.style.visibility = 'hidden';
//                //  div.style.display = 'none';

//            }
        } 

//    <%--  <script type="text/javascript"  language="JavaScript">
//function richToolTip(WinMsg, e)
//{
//var xCoord = 0;
//var yCoord = 0;
//var oScreenWidth = 0;
//var oScreenHeight = 0;
//var myElement;

//if (document.layers)
//{
//// old Netscape versions
//var myElement = document.getElementById('divMsg');
////myElement = document.divMsg;
////if ((myElement == null) || (myElement == "undefined"))
////{ myElement = document.getElementById('divMsg'); }

//oScreenWidth = window.innerWidth;
//oScreenHeight = window.innerHeight;

//xCoord = e.pageX + 15;
//yCoord = e.pageY + 15;

//if (xCoord + 200 + 5 > oScreenWidth)
//{ xCoord = xCoord - 225; }
//if (yCoord + 120 + 15 > oScreenHeight)
//{ yCoord = yCoord - 150; }
//}
//else
//{
//// IE and newer versions of Netscape
// myElement = document.getElementById('divMsg');

//if (myElement != null && myElement != "undefined")
//{
//oScreenWidth = document.body.clientWidth;
//oScreenHeight = document.body.clientHeight;

//xCoord = e.clientX + document.body.scrollLeft +
//document.documentElement.scrollLeft + 15;
//yCoord = e.clientY + document.body.scrollTop +
//document.documentElement.scrollTop + 15;

//if (e.clientX + 200 + 5 > oScreenWidth)
//{ xCoord = xCoord - 225; }
//if (e.clientY + 120 + 15 > oScreenHeight)
//{ yCoord = yCoord - 150; }
//}
//}
//if (xCoord != 0 && yCoord != 0 && myElement != null && myElement !=
//"undefined")
//{
//myElement.innerHTML = WinMsg;
//if (document.layers)
//{

//if (typeof myElement.style.top != 'number')
//{ eval("myElement.moveTo(xCoord, yCoord)"); }
//else
//{ myElement.style.top = yCoord;
//myElement.style.left = xCoord; }

//if ((myElement.style.visibility == null) ||
//(myElement.style.visibility == "undefined"))
//{ myElement.visibility = 'visible'; }
//else
//{ myElement.style.visibility = 'visible'; }

//}
//else
//{
//myElement.style.top = yCoord;
//myElement.style.left = xCoord;
//myElement.style.visibility = 'visible';
//}
//}
//}

//function hideToolTip()
//{
//if (document.layers)
//{
//// old Netscape versions
//var myElement = document.getElementById('divMsg');
////var myElement = document.divMsg;
////if ((myElement == null) || (myElement == "undefined"))
////{ myElement = document.getElementById('divMsg'); }
//if ((myElement.style.visibility == null) ||
//(myElement.style.visibility == "undefined"))
//{ myElement.visibility = 'hidden'; }
//else
//// IE and newer versions of Netscape
//{ myElement.style.visibility = 'hidden'; }
//}
//else
//{ document.getElementById('divMsg').style.visibility = 'hidden'; }
//}
//</SCRIPT>--%>

//   

