// Div Pop-up Functions
var posx;var posy;
window.onMouseMove = mouser;
function mouser(event){posx = event.clientX;posy = event.clientY;}
function divpopup(meth,url,qStr,divID,toclick,doload,rload){if(!rload){if(GetElm(divID)){return;}}if(meth.length==0||url.length==0||divID.length==0){return;}else{CreatePopDiv(divID);}if(toclick){MoveDivToClick(divID);}var xmlhttp=null;if(window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}if(window.ActiveXObject){xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}if(xmlhttp==null){alert("Your browser does not support XMLHTTP!");return;}xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==1){if(doload){dispload(divID,"","w");}else{if(GetPopDivElm('popDivTtl_'+divID)){GetPopDivElm('popDivTtl_'+divID).innerHTML='<table cellpadding="2" cellspacing="0" border="0"><tr><td><b>Loading...</b></td><td><img src="popdiv/images/loading_small.gif" border="0"/></td></tr></table>';}}}if(xmlhttp.readyState==4){GetPopDivElm(divID).innerHTML=xmlhttp.responseText;}};xmlhttp.open(meth,url+'?d='+divID+qStr,true);xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.send();}
function CreatePopDiv(divID){if(!GetPopDivElm(divID)){$("body").append("<div id=\"" + divID + "\" name=\"" + divID + "\" class=\"PopDiv\"></div>");}BringToFront(divID);}
function dispload(divID,Msg,dw){var loadingpic = '<center><div class="loadingpic"></div></center>';var loadingwindow = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" onmousedown=\"javascript:BringToFront('" + divID + "');\">";loadingwindow += "<tr><td class=\"PopDivFrameTopLeft\"></td><td class=\"PopDivFrameTop\"></td><td class=\"PopDivFrameTopRight\"></td></tr>";loadingwindow += "<tr><td class=\"PopDivFrameLeft\">&nbsp;&nbsp;&nbsp;</td><td class=\"PopDivFrameBg\">";loadingwindow += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"width: 100%;\">";loadingwindow += "<tr><td class=\"popDivTopBar\" onmousedown=\"return MoveDiv('" + divID + "');\" onmouseup=\"return StopDiv('" + divID + "');\">";loadingwindow += "<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" style=\"width: 100%;\">";loadingwindow += "<tr><td style=\"text-align: left; font-size: 14px; color: #000000;\"><b>Loading...</b></td>";loadingwindow += "<td style=\"text-align: right;\"><input type=\"button\" class=\"popDivCloseBut\" value=\" \" title=\"close\" onclick=\"javascript:ClosePopDiv('" + divID + "');\" /></td></tr>";loadingwindow += "</table>";loadingwindow += "</td></tr>";loadingwindow += "<tr><td style=\"width: 200px; height: 100px; vertical-align: middle; text-align: center;\">" + loadingpic + "</td></tr>";loadingwindow += "</table>";loadingwindow += "</td><td class=\"PopDivFrameRight\">&nbsp;&nbsp;&nbsp;</td></tr>";loadingwindow += "<tr><td class=\"PopDivFrameBottomLeft\"></td><td class=\"PopDivFrameBottom\"></td><td class=\"PopDivFrameBottomRight\"></td></tr>";loadingwindow += "</table>";if(dw=="d"){GetPopDivElm(divID).innerHTML = "<center>" + loadingpic + "<br/><b>" + Msg + "</b></center>";}else if(dw=="w"){GetPopDivElm(divID).innerHTML = loadingwindow;}}
function dispload_small(divID){var loadingpic = '<div class="loadingpic_small"></div>';GetPopDivElm(divID).innerHTML = loadingpic;}
function MoveDivToClick(divID){if (!posx){posx = 150;}if (!posy){posy = 50;}var moveX = posx;var moveY = posy;GetPopDivElm(divID).style.left = moveX + "px";GetPopDivElm(divID).style.top = moveY + "px";}
function BringToFront(divID){DropDivsZIndex();GetPopDivElm(divID).style.zIndex = 778;}
function DropDivsZIndex(){var divs = document.getElementsByTagName('div');for (var i=0;i<divs.length;i++){if (divs[i].className == 'PopDiv'){var d_ID = divs[i].id;GetPopDivElm(d_ID).style.zIndex = 777;}}}
function MoveDiv(divID){dsblSlct(document.body,divID);var DivClkLft = posx - GetPopDivElm(divID).offsetLeft;var DivClkRgt = posy - GetPopDivElm(divID).offsetTop;document.onmousemove = MovemyDiv;function MovemyDiv(){var moveX = posx - DivClkLft;var moveY = posy - DivClkRgt;GetPopDivElm(divID).style.left = moveX + "px";GetPopDivElm(divID).style.top = moveY + "px";}}
function StopDiv(divID){enblSlct(document.body,divID);document.onmousemove = function(){return;};}
function ClosePopDiv(divID){$('div').remove('#' + divID);}
function ClearPopDivs(){$("div").remove(".PopDiv");}
function dsblSlct(trgt,divID){if (typeof trgt.onselectstart!="undefined"){trgt.onselectstart=function(){return false};}else if (typeof trgt.style.MozUserSelect!="undefined"){trgt.setAttribute("class","moznone");GetPopDivElm(divID).setAttribute("class","PopDivNotSelect");}else{trgt.onmousedown=function(){return false};trgt.style.cursor = "default";}}
function enblSlct(trgt,divID){if (typeof trgt.onselectstart!="undefined"){trgt.onselectstart=function(){return true};}else if (typeof trgt.style.MozUserSelect!="undefined"){trgt.setAttribute("class","moztext");GetPopDivElm(divID).setAttribute("class","PopDiv");}else{trgt.onmousedown=function(){return true};trgt.style.cursor = "select";}}
function GetPopDivElm(fld){return document.getElementById(fld);}
