/* 
*  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
*  setFunctionToShowDivs(func) -will execute the function specified here to display the divs. func must accept 2 parameters: grayoutDivID, divDialogID. returning false will use the default show
*  setFunctionToHideDivs(func) -will execute the function specified here to hide the divs. func must accept 2 parameters: grayoutDivID, divDialogID. returning false will use the default hide
*/
var evokeModalDialog=(function(){var h="#000000";var i=0.6;var p=null;var a=0;var o=0;var z="evoModPopDivGrayout";var g=null;var A=window.navigator.userAgent.toLowerCase();var c=(A.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1];var n=/msie/.test(A);var t=(n&&(parseInt(c)>=6));var s=(n&&(parseInt(c)>=7));var b=0;var u=0;var m=true;var B={x:-1,y:-1};var f=null;var d=null;function w(){var C=0;if(n){if(t){C=document.documentElement.clientWidth}else{C=document.body.clientWidth}}else{C=window.innerWidth}return C}function l(){var C=0;if(n){if(t){C=document.documentElement.clientHeight}else{C=document.body.clientHeight}}else{C=window.innerHeight}return C}function r(){if(B.x>-1){if(n){return B.x+k()}else{return B.x}}else{var C=0;if(n){if(t){C=(document.documentElement.clientWidth-a)/2+k()}else{C=(document.body.clientWidth-a)/2+k()}}else{C=(window.innerWidth-a)/2}if(!n){C-=10}if(C<0){C=0}return C}}function q(){if(B.y>-1){if(n){return B.y+j()}else{return B.y}}else{var C=0;if(n){if(t){C=((document.documentElement.clientHeight-o)/2)+j()}else{C=((document.body.clientHeight-o)/2)+j()}}else{C=(window.innerHeight-o)/2}if(!n){C-=10}if(C<0){C=0}return C}}function k(){var C=0;if(n){if(t&&!s){C=document.documentElement.scrollLeft}else{if(s){C=0}else{C=document.body.scrollLeft}}}else{C=0}return C}function j(){var C=0;if(n){if(t&&!s){C=document.documentElement.scrollTop}else{if(s){C=0}else{C=document.body.scrollTop}}}else{C=0}return C}function e(D,C){if(!document.getElementById){return}var E=D.style[C];if(!E){if(D.currentStyle){E=D.currentStyle[C]}else{if(document.defaultView){E=document.defaultView.getComputedStyle(D,"").getPropertyValue(C)}}}return E}function x(C,D){if(n){window.attachEvent("on"+C,D)}else{window.addEventListener(C,D,false)}}function v(){var C=document.getElementById(p);if(C!=null){C.style.left=r()+"px";C.style.top=q()+"px"}g.style.width=w()+"px";g.style.height=l()+"px";g.style.left=k()+"px";g.style.top=j()+"px"}function y(){}y.getHideOnOutsideClick=function(){return m};y.setHideOnOutsideClick=function(C){m=false};y.getBgColor=function(){return h};y.setBgColor=function(C){h=C;if(document.getElementById(z)!=null){document.getElementById(z).style.backgroundColor=h}};y.getOpacity=function(){return i};y.setOpacity=function(C){i=C};y.setTop=function(C){B.y=parseInt(C)};y.setLeft=function(C){B.x=parseInt(C)};y.getTop=function(){return B.y};y.getLeft=function(){return B.x};y.setFunctionToShowDivs=function(C){f=C};y.setFunctionToHideDivs=function(C){d=C};y.showGrayoutCallback=function(){};y.hideGrayoutCallback=function(){g.style.width="0px";g.style.height="0px"};y.show=function(E,H){if(H!=undefined){try{var I=document.getElementById(H).getElementById(E);if(I!=null){document.getElementById(H).removeChild(document.getElementById(H).getElementById(E))}}catch(F){}var J=document.getElementById(E);var K=J.parentNode;K.removeChild(J);document.getElementById(H).appendChild(J)}if(t&&!s){b=j();u=k()}if(g==null){g=document.getElementById(z)}p=E;a=parseInt(e(document.getElementById(p),"width"));o=parseInt(e(document.getElementById(p),"height"));var C=document.getElementById(p);C.style.zIndex=99;if(t&&!s){C.style.position="absolute";g.style.position="absolute";if(t&&!s){var D=document.getElementsByTagName("select");for(var G=0;G<D.length;G++){D[G].style.visibility="hidden"}D=C.getElementsByTagName("select");for(var G=0;G<D.length;G++){D[G].style.visibility="visible"}}}else{C.style.position="fixed";g.style.position="fixed"}v();if(f!=null){if(t&&!s){g.style.display="inline";C.style.display="inline"}else{var L=f(z,E);if(L==false){g.style.display="inline";C.style.display="inline"}}}else{g.style.display="inline";C.style.display="inline"}};y.hide=function(){if(d!=null){if(t&&!s){document.getElementById(p).style.display="none";g.style.display="none";g.style.width="0px";g.style.height="0px"}else{var C=d(z,p);if(C==false){document.getElementById(p).style.display="none";g.style.display="none";g.style.width="0px";g.style.height="0px"}}}else{document.getElementById(p).style.display="none";g.style.display="none";g.style.width="0px";g.style.height="0px"}if(t&&!s){var D=document.getElementsByTagName("select");for(var E=0;E<D.length;E++){D[E].style.visibility="visible"}}};y.outsideClick=function(){if(m){y.hide()}};y.attachClickEvent=function(C){var D=document.getElementById(z);if(D.attachEvent){D.attachEvent("onclick",C)}else{D.addEventListener("click",C,false)}};y.detachClickEvent=function(C){var D=document.getElementById(z);if(D.detachEvent){D.detachEvent("onclick",C)}else{D.removeEventListener("click",C,false)}};y.eventLoad=function(){var H=parseFloat(i).toFixed(2)*100;var G="position:fixed;left:0px;top:0px;width:0px;height:0px;display:none;background-color:"+h+";z-index:98;filter:alpha(opacity="+H+");opacity:"+i+";";if(document.createStyleSheet){var E=document.createStyleSheet();E.addRule("#"+z,G)}else{if(A.indexOf("opera")!=-1){var E=document.createElement("style");var J="#"+z+" { "+G+" }";E.innerHTML=J;document.body.appendChild(E)}else{var D=document.getElementsByTagName("head")[0];var E=document.createElement("style");E.type="text/css";E.media="all";D.appendChild(E);var C=0;if(document.styleSheets.length>0){C=document.styleSheets.length-1}E=document.styleSheets[C];var J="#"+z+" { "+G+" }";E.insertRule(J,0)}}var I=document.createElement("div");I.setAttribute("id",z);document.body.appendChild(I);var F=document.getElementById(z);if(F.attachEvent){F.attachEvent("onclick",function(){evokeModalDialog.outsideClick()})}else{F.addEventListener("click",function(){evokeModalDialog.outsideClick()},false)}};y.eventScroll=function(){if(p!=null){if(document.getElementById(p).style.display=="inline"){if(t&&!s){document.documentElement.scrollTop=b;document.documentElement.scrollLeft=u}}}};y.eventResize=function(){if(p!=null){if(document.getElementById(p).style.display=="inline"){a=parseInt(e(document.getElementById(p),"width"));o=parseInt(e(document.getElementById(p),"height"));v()}}};x("load",y.eventLoad);if(t&&!s){x("scroll",y.eventScroll)}if(!n){window.captureEvents(Event.RESIZE)}x("resize",y.eventResize);return y})();