/* 
*  Developed by CJ Amodeo (cjamodeo@gmail.com)
*  Page should be XHTML 1.0 Transitional
*  evokeModalDialog functions:
*  get/setBgColor(color) -default:#000000,
*  get/setOpacity(val) -default:0.6,
*  show(id, appendToNodeID) -ID of obj to display as modal -will remove the object and append it to the sepcified node, 
*  hide() -hides modal
*  get/setHideOnOutsideClick(bool) -setting to true will hide the dialog when the gray area is clicked
*  attachClickEvent/detachClickEvent -register/unregister a function that is called when the gray area is clicked
*  get/setLeft(left), get/setTop(top) -sets the left/top coordinate, overiding the automatic centering, set to -1 to restore centering
*/
var evokeModalDialog=(function(){var f="#000000";var g=0.6;var n=null;var a=0;var m=0;var x="evoModPopDivGrayout";var e=null;var y=window.navigator.userAgent.toLowerCase();var c=(y.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1];var l=/msie/.test(y);var r=(l&&(parseInt(c)>=6));var q=(l&&(parseInt(c)>=7));var b=0;var s=0;var k=true;var z={x:-1,y:-1};function u(){var A=0;if(l){if(r){A=document.documentElement.clientWidth}else{A=document.body.clientWidth}}else{A=window.innerWidth}return A}function j(){var A=0;if(l){if(r){A=document.documentElement.clientHeight}else{A=document.body.clientHeight}}else{A=window.innerHeight}return A}function p(){if(z.x>-1){if(l){return z.x+i()}else{return z.x}}else{var A=0;if(l){if(r){A=(document.documentElement.clientWidth-a)/2+i()}else{A=(document.body.clientWidth-a)/2+i()}}else{A=(window.innerWidth-a)/2}if(!l){A-=10}if(A<0){A=0}return A}}function o(){if(z.y>-1){if(l){return z.y+h()}else{return z.y}}else{var A=0;if(l){if(r){A=((document.documentElement.clientHeight-m)/2)+h()}else{A=((document.body.clientHeight-m)/2)+h()}}else{A=(window.innerHeight-m)/2}if(!l){A-=10}if(A<0){A=0}return A}}function i(){var A=0;if(l){if(r&&!q){A=document.documentElement.scrollLeft}else{if(q){A=0}else{A=document.body.scrollLeft}}}else{A=0}return A}function h(){var A=0;if(l){if(r&&!q){A=document.documentElement.scrollTop}else{if(q){A=0}else{A=document.body.scrollTop}}}else{A=0}return A}function d(B,A){if(!document.getElementById){return}var C=B.style[A];if(!C){if(B.currentStyle){C=B.currentStyle[A]}else{if(document.defaultView){C=document.defaultView.getComputedStyle(B,"").getPropertyValue(A)}}}return C}function v(A,B){if(l){window.attachEvent("on"+A,B)}else{window.addEventListener(A,B,false)}}function t(){var A=document.getElementById(n);if(A!=null){A.style.left=p()+"px";A.style.top=o()+"px"}e.style.width=u()+"px";e.style.height=j()+"px";e.style.left=i()+"px";e.style.top=h()+"px"}function w(){}w.getHideOnOutsideClick=function(){return k};w.setHideOnOutsideClick=function(A){k=false};w.getBgColor=function(){return f};w.setBgColor=function(A){f=A;if(document.getElementById(x)!=null){document.getElementById(x).style.backgroundColor=f}};w.getOpacity=function(){return g};w.setOpacity=function(A){g=A};w.setTop=function(A){z.y=parseInt(A)};w.setLeft=function(A){z.x=parseInt(A)};w.getTop=function(){return z.y};w.getLeft=function(){return z.x};w.show=function(C,F){if(F!=undefined){try{var G=document.getElementById(F).getElementById(C);if(G!=null){document.getElementById(F).removeChild(document.getElementById(F).getElementById(C))}}catch(D){}var H=document.getElementById(C);var I=H.parentNode;I.removeChild(H);document.getElementById(F).appendChild(H)}if(r&&!q){b=h();s=i()}if(e==null){e=document.getElementById(x)}n=C;a=parseInt(d(document.getElementById(n),"width"));m=parseInt(d(document.getElementById(n),"height"));e.style.display="inline";var A=document.getElementById(n);A.style.display="inline";A.style.zIndex=99;if(r&&!q){A.style.position="absolute";e.style.position="absolute";if(r&&!q){var B=document.getElementsByTagName("select");for(var E=0;E<B.length;E++){B[E].style.visibility="hidden"}B=A.getElementsByTagName("select");for(var E=0;E<B.length;E++){B[E].style.visibility="visible"}}}else{A.style.position="fixed";e.style.position="fixed"}t()};w.hide=function(){document.getElementById(n).style.display="none";e.style.display="none";e.style.width="0px";e.style.height="0px";if(r&&!q){var A=document.getElementsByTagName("select");for(var B=0;B<A.length;B++){A[B].style.visibility="visible"}}};w.outsideClick=function(){if(k){w.hide()}};w.attachClickEvent=function(A){var B=document.getElementById(x);if(B.attachEvent){B.attachEvent("onclick",A)}else{B.addEventListener("click",A,false)}};w.detachClickEvent=function(A){var B=document.getElementById(x);if(B.detachEvent){B.detachEvent("onclick",A)}else{B.removeEventListener("click",A,false)}};w.eventLoad=function(){var F=parseFloat(g).toFixed(2)*100;var E="position:fixed;left:0px;top:0px;width:0px;height:0px;display:none;background-color:"+f+";z-index:98;filter:alpha(opacity="+F+");opacity:"+g+";";if(document.createStyleSheet){var C=document.createStyleSheet();C.addRule("#"+x,E)}else{if(y.indexOf("opera")!=-1){var C=document.createElement("style");var H="#"+x+" { "+E+" }";C.innerHTML=H;document.body.appendChild(C)}else{var B=document.getElementsByTagName("head")[0];var C=document.createElement("style");C.type="text/css";C.media="all";B.appendChild(C);var A=0;if(document.styleSheets.length>0){A=document.styleSheets.length-1}C=document.styleSheets[A];var H="#"+x+" { "+E+" }";C.insertRule(H,0)}}var G=document.createElement("div");G.setAttribute("id",x);document.body.appendChild(G);var D=document.getElementById(x);if(D.attachEvent){D.attachEvent("onclick",function(){evokeModalDialog.outsideClick()})}else{D.addEventListener("click",function(){evokeModalDialog.outsideClick()},false)}};w.eventScroll=function(){if(n!=null){if(document.getElementById(n).style.display=="inline"){if(r&&!q){document.documentElement.scrollTop=b;document.documentElement.scrollLeft=s}}}};w.eventResize=function(){if(n!=null){if(document.getElementById(n).style.display=="inline"){a=parseInt(d(document.getElementById(n),"width"));m=parseInt(d(document.getElementById(n),"height"));t()}}};v("load",w.eventLoad);if(r&&!q){v("scroll",w.eventScroll)}if(!l){window.captureEvents(Event.RESIZE)}v("resize",w.eventResize);return w})();
