// Div Pop-up Functions
var animateTransIn = "fold";
var animateTransOut = "fold";
var animateOptionsIn = {};
var animateOptionsOut = {};
var animateSpeedIn = 500;
var animateSpeedOut = 500;
function divpopup(meth,url,qStr,divID,toclick,doload,rload,callBack){if(!callBack){var callBack = null;}if(!rload){if(GetPopDivElm('minimized-' + divID)){MaximizePopDiv(divID);return false;}if(GetPopDivElm(divID)){return false;}}var startwidth = 0;var startheight = 0;celldivID = 'popDivCell_' + divID;if(GetPopDivElm(celldivID)){startwidth = getPopDivStyle(GetPopDivElm(celldivID),'width');startwidth = (startwidth.replace('px','')) * 1;startheight = getPopDivStyle(GetPopDivElm(celldivID),'height');startheight = (startheight.replace('px','')) * 1;if(navigator.appName != 'Opera' && navigator.appName != 'Microsoft Internet Explorer'){if(navigator.userAgent.indexOf('Firefox') <= 0){var actWidth = GetPopDivElm(celldivID).clientWidth;var actHeight = GetPopDivElm(celldivID).clientHeight;var scrWidth = GetPopDivElm(celldivID).scrollWidth;var scrHeight = GetPopDivElm(celldivID).scrollHeight;if(actWidth < scrWidth){startheight+= 17;}if(actHeight < scrHeight){startwidth+= 17;}}}}if(meth.length==0||url.length==0||divID.length==0){return false;}else{if(!GetPopDivElm(divID)){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){return false;}xmlhttp.onreadystatechange=function(){BringToFront(divID);if(xmlhttp.readyState==1){var loadingpic_small = '<div class="loadingpic_small"></div>';if(doload){if(GetPopDivElm('minimized-' + divID)){dispload(divID,"","w");} else {if(GetPopDivElm('popDivTtl_'+divID)){GetPopDivElm('popDivTtl_'+divID).innerHTML='<table cellpadding="0" cellspacing="0" border="0"><tr><td><b>Loading...</b>&nbsp;&nbsp;&nbsp;</td><td>' + loadingpic_small + '</td></tr></table>';} else {dispload(divID,"","w");}}}else{if(GetPopDivElm('popDivTtl_'+divID)){GetPopDivElm('popDivTtl_'+divID).innerHTML='<table cellpadding="0" cellspacing="0" border="0"><tr><td><b>Loading...</b>&nbsp;&nbsp;&nbsp;</td><td>' + loadingpic_small + '</td></tr></table>';}}$("#" + divID).show("fade",200);}if(xmlhttp.readyState==4){function DisplayMyXMLData(){GetPopDivElm(divID).innerHTML = xmlhttp.responseText;if(GetPopDivElm('minimized-' + divID)){ClosePopDivMin('minimized-' + divID);BringToFront(divID);}if(GetPopDivElm('PopDivResizer_' + divID)){if(startwidth > 200){GetPopDivElm(celldivID).style.width = startwidth + 'px';}if(startheight > 100){GetPopDivElm(celldivID).style.height = startheight + 'px';}}$("#" + divID).show(animateTransIn,animateOptionsIn,animateSpeedIn,callBack);}$("#" + divID).hide("fade",200,DisplayMyXMLData);}};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").prepend("<div id=\"" + divID + "\" name=\"" + divID + "\" class=\"PopDiv\" style=\"display: none;\"></div>");}BringToFront(divID);}
function dispload(divID,Msg,dw){var loadingpic = '<center><div class="loadingpic"></div></center>';var loadingwindow = "";loadingwindow += "<div class=\"PopDivWrap\">";loadingwindow += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" onmousedown=\"javascript:BringToFront('" + divID + "');\">";loadingwindow += "<tr>";loadingwindow += "<td class=\"PopDivFrameBg\">";loadingwindow += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"width: 100%;\">";loadingwindow += "<tr>";loadingwindow += "<td class=\"popDivTopBar\" onmousedown=\"return MoveDiv('" + divID + "');\" onmouseup=\"return StopDiv('" + divID + "');\">";loadingwindow += "<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" style=\"width: 100%;\">";loadingwindow += "<tr>";loadingwindow += "<td class=\"popDivTopBarTextCell\"><b>Loading...</b></td>";loadingwindow += "<td style=\"text-align: right; vertical-align: bottom; width: 20px;\">";loadingwindow += "<a href=\"javascript:MinimizePopDiv('" + divID + "','Loading...');\" class=\"popDivMinimizeBut\" title=\"Minimize\"></a>";loadingwindow += "</td>";loadingwindow += "<td style=\"text-align: right; vertical-align: bottom; width: 20px;\">";loadingwindow += "<a href=\"javascript:ClosePopDiv('" + divID + "');\" class=\"popDivCloseBut\" title=\"Close\"></a>";loadingwindow += "</td>";loadingwindow += "</tr>";loadingwindow += "</table>";loadingwindow += "</td>";loadingwindow += "</tr>";loadingwindow += "<tr>";loadingwindow += "<td style=\"width: 200px; height: 100px; vertical-align: middle; text-align: center; border-top: none;\">";loadingwindow += "<div id=\"popDivCell_" + divID + "\" style=\"overflow: auto;\">" + loadingpic + "</div>";loadingwindow += "</td>";loadingwindow += "</tr>";loadingwindow += "</table>";loadingwindow += "</td>";loadingwindow += "</tr>";loadingwindow += "</table>";loadingwindow += "</div>";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_small = '<div class="loadingpic_small"></div>';GetPopDivElm(divID).innerHTML = loadingpic_small;}
function MoveDivToClick(divID){$("#" + divID).css("top",(posy - getPopDivPageScrollPosition()) + "px");$("#" + divID).css("left",posx + "px");}
function BringToFront(divID){DropDivsZIndex(divID);$("#" + divID).css({"z-index":7778});}
function getPopDivPageScrollPosition(){var yScroll;if (self.pageYOffset) {yScroll = self.pageYOffset;} else if (document.documentElement && document.documentElement.scrollTop) {yScroll = document.documentElement.scrollTop;} else if (document.body) {yScroll = document.body.scrollTop;}return yScroll;}
function DropDivsZIndex(divID){$(".PopDiv").each(function(){if($(this).attr("id") != divID){var DivZIndex = $(this).css('z-index');var newDivZIndex = DivZIndex - 1;$(this).css({"z-index":newDivZIndex});}});$(".PopDivMin").each(function(){if($(this).attr("id") != divID){var DivZIndex = $(this).css('z-index');var newDivZIndex = DivZIndex - 1;$(this).css({"z-index":newDivZIndex});}});}
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";document.onmouseup = function(){enblSlct(document.body,divID);document.onmousemove = function(){return;};};}}
function StopDiv(divID){enblSlct(document.body,divID);document.onmousemove = function(){return;};}
function ResizeDiv(divID){divID = 'popDivCell_' + divID;dsblSlct(document.body,divID);var currposx = posx;var currposy = posy;var startwidth = getPopDivStyle(GetPopDivElm(divID),'width');startwidth = (startwidth.replace('px','')) * 1;var startheight = getPopDivStyle(GetPopDivElm(divID),'height');startheight = (startheight.replace('px','')) * 1;if(navigator.appName != 'Opera' && navigator.appName != 'Microsoft Internet Explorer'){if(navigator.userAgent.indexOf('Firefox') <= 0){var actWidth = GetPopDivElm(divID).clientWidth;var actHeight = GetPopDivElm(divID).clientHeight;var scrWidth = GetPopDivElm(divID).scrollWidth;var scrHeight = GetPopDivElm(divID).scrollHeight;if(actWidth < scrWidth){startheight+= 17;}if(actHeight < scrHeight){startwidth+= 17;}}}document.onmousemove = ResizemyDiv;function ResizemyDiv(){var newposx = posx;var newposy = posy;var changedamtx = newposx - currposx;var changedamty = newposy - currposy;var newwidth = startwidth + changedamtx;var newheight = startheight + changedamty;if(newwidth > 200){GetPopDivElm(divID).style.width = newwidth + 'px';}if(newheight > 100){GetPopDivElm(divID).style.height = newheight + 'px';}document.onmouseup = function(){enblSlct(document.body,divID);document.onmousemove = function(){return false;};};}}
function MinimizePopDiv(divID,divTitle){var minimizedwindow = "";minimizedwindow += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" onmousedown=\"javascript:BringToFront('minimized-" + divID + "');\">";minimizedwindow += "<td class=\"PopDivFrameBgMin\">";minimizedwindow += "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"width: 100%;\">";minimizedwindow += "<tr><td class=\"popDivTopBarMin\">";minimizedwindow += "<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" style=\"width: 100%;\">";minimizedwindow += "<tr><td class=\"popDivTopBarMinTextCell\">" + divTitle + "</td>";minimizedwindow += "<td style=\"text-align: right; width: 20px;\">";minimizedwindow += "<a href=\"javascript:MaximizePopDiv('" + divID + "');\" class=\"popDivMaximizeBut\" title=\"Maximize\"></a>";minimizedwindow += "</td>";minimizedwindow += "<td style=\"text-align: right; width: 20px;\">";minimizedwindow += "<a href=\"javascript:ClosePopDiv('" + divID + "');ClosePopDivMin('minimized-" + divID + "');\" class=\"popDivCloseBut\" title=\"Close\"></a>";minimizedwindow += "</td>";minimizedwindow += "</tr>";minimizedwindow += "</table>";minimizedwindow += "</td></tr>";minimizedwindow += "</table>";minimizedwindow += "</td>";minimizedwindow += "</table>";var mycount = $(".PopDivMin").length;var mydist = mycount * 25;$("#" + divID).hide("fold",300,function(){$("body").append("<div id=\"minimized-" + divID + "\" class=\"PopDivMin\"></div>");GetPopDivElm('minimized-' + divID).style.left = "0px";GetPopDivElm('minimized-' + divID).style.bottom = mydist + "px";GetPopDivElm('minimized-' + divID).innerHTML = minimizedwindow;});}
function MaximizePopDiv(divID){ClosePopDivMin('minimized-' + divID);BringToFront(divID);$("#" + divID).show(animateTransIn,animateOptionsIn,animateSpeedIn);}
function ClosePopDiv(divID){if($('#' + divID).css('display') != 'none'){$('#' + divID).hide(animateTransOut,animateOptionsOut,animateSpeedOut,function(){$('#' + divID).remove();});}else{$('#' + divID).remove();}}
function ClosePopDivMin(divID){var thisDivBottom = parseFloat($('#' + divID).css('bottom'));$(".PopDivMin").each(function(){var DivBottom = parseFloat($(this).css('bottom'));if(DivBottom > thisDivBottom){var newDivBottom = DivBottom-25;}$(this).css({"bottom":newDivBottom+"px"});});$('div').remove('#' + divID);}
function ClearPopDivs(){$("div").remove(".PopDiv");}
function dsblSlct(trgt,divID){divID = divID.replace('popDivCell_','');if (typeof trgt.onselectstart!="undefined"){trgt.onselectstart=function(){return false};}else if (typeof trgt.style.MozUserSelect!="undefined"){trgt.setAttribute("class","moznone");}else{trgt.onmousedown=function(){return false};trgt.style.cursor = "default";}if(GetPopDivElm(divID)){GetPopDivElm(divID).setAttribute("class","PopDivNotSelect");}}
function enblSlct(trgt,divID){divID = divID.replace('popDivCell_','');if (typeof trgt.onselectstart!="undefined"){trgt.onselectstart=function(){return true};}else if (typeof trgt.style.MozUserSelect!="undefined"){trgt.setAttribute("class","moztext");}else{trgt.onmousedown=function(){return true};trgt.style.cursor = "select";}if(GetPopDivElm(divID)){GetPopDivElm(divID).setAttribute("class","PopDiv");}}
function GetPopDivElm(fld){return document.getElementById(fld);}
function getPopDivStyle(oElm, strCssRule){var strValue = "";if(document.defaultView && document.defaultView.getComputedStyle){strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);}else if(oElm.currentStyle){strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){return p1.toUpperCase();});strValue = oElm.currentStyle[strCssRule];}return strValue;}
