var arrObjects=new Array();var interuptedpage="";function open_modal(c,b){if(b=="undefined"||b==null){b=this.rel;c=this.href;var a=c;if(b!="modal_image"){a=this.href.split("#")[1]}}else{var a=c;if(b!="modal_image"){a=c.split("#")[1]}}new_modal=new modal(a,true);new_modal.activate();arrObjects.push(new_modal);return false}function init_modal(){var c=document.getElementsByTagName("a");for(var a=0;a<c.length;a++){if(c[a].rel=="modal"||c[a].rel=="modal_image"){c[a].onclick=open_modal}}if(window.location.search!=""){if(window.location.search.indexOf("modal=")>=0){function b(f){f=f.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var g=new RegExp("[\\?&]"+f+"=([^&#]*)");var e=g.exec(window.location.href);if(e==null){return""}return e[1]}var d=b("modal");if(d!=""){if(document.getElementById(d)!=null){new_url_modal=new modal(d,false);new_url_modal.activate();arrObjects.push(new_url_modal)}}}}}function close_open_modals(){for(var a=0;a<arrObjects.length;a++){arrObjects[a].deactivate()}if(typeof stopVideoPlayer=="function"){stopVideoPlayer()}return false}function modal(b,a){this.obj=b;this.imgonly=false;this.overlayclick=a;this.setAttributes=true;this.isie=navigator.userAgent.toLowerCase().indexOf("msie");this.imgcontainer="modal_image";this.imgpreloader='<img src="/lib/img/loading.gif" alt="Loading Image" />';this.closebtn='<p class="close-image"><a href="#" rel="modal_close"><img src="/lib/img/close-image.gif" /></a></p>';this.overlay="overlay";this.yPos=0;if(b.indexOf(".jpg")>-1||b.indexOf(".png")>-1||b.indexOf(".gif")>-1){this.imgonly=true}modal.prototype.createoverlay=function(f,g){var d=document.getElementById(g);if(d==null){var e=document.createElement("div");e.id=g;document.getElementsByTagName("body")[0].appendChild(e);d=document.getElementById(g)}if(a==null||a==true){d.onclick=c}function c(){if(typeof stopVideoPlayer=="function"){stopVideoPlayer()}f.deactivate();return false}};modal.prototype.activate=function(){this.createoverlay(this,this.overlay);if(this.setAttributes){this.setMargins()}if(this.isie>-1){this.ieFunctions(0,"100%","hidden","hidden",true)}this.display("block");if(document.getElementById("interuptedpage")!=null&&interuptedpage!=""){document.getElementById("interuptedpage").href=interuptedpage;if(interuptedpagetarget=="_blank"){document.getElementById("interuptedpage").target=interuptedpagetarget}}};modal.prototype.deactivate=function(){if(this.isie>-1){this.ieFunctions(this.yPos,"auto","auto","visible",false)}this.display("none")};modal.prototype.display=function(c){document.getElementById(this.overlay).style.display=c;if(this.imgonly!=""&&this.imgonly==true){this.standalone(this,c)}else{document.getElementById(this.obj).style.display=c}if(c=="block"){this.closeOpenMore()}};modal.prototype.ieFunctions=function(j,c,h,f,g){if(g){if(document.documentElement&&document.documentElement.scrollTop){this.yPos=document.documentElement.scrollTop}else{if(document.body){this.yPos=document.body.scrollTop}}window.scrollTo(0,0)}document.getElementsByTagName("body")[0].style.height=c;document.getElementsByTagName("body")[0].style.overflow=h;var e=document.getElementsByTagName("select");for(var d=0;d<e.length;d++){e[d].style.visibility=f}if(!g){window.scrollTo(0,this.yPos)}};modal.prototype.closeOpenMore=function(){var c=document.getElementById(this.obj);var f=document.getElementsByTagName("a");if(c!=null){f=c.getElementsByTagName("a");for(var d=0;d<f.length;d++){if(f[d].rel=="modal_close"){f[d].onclick=close_open_modals}else{if(f[d].rel=="modal"||f[d].rel=="modal_image"){f[d].onclick=e}}}}else{for(var d=0;d<f.length;d++){if(f[d].rel=="modal_close"){f[d].onclick=close_open_modals}}}function e(){close_open_modals();open_modal(this.href,this.rel);return false}};modal.prototype.standalone=function(f,g){var c=this.imgcontainer;if(g=="none"){document.getElementById(c).style.display=g}else{var d;if(document.getElementById(c)==null){d=document.createElement("div");d.setAttribute("id",c);document.getElementsByTagName("body")[0].appendChild(d)}else{d=document.getElementById(c)}function e(h){var j=false;if(h!=""){if(window.XMLHttpRequest){j=new XMLHttpRequest()}else{if(window.ActiveXObject){try{j=new ActiveXObject("Msxml2.XMLHTTP")}catch(i){try{j=new ActiveXObject("Microsoft.XMLHTTP")}catch(i){}}}}j.onreadystatechange=function(){k(j,h)};j.open("GET",h,true);j.send(null);function k(n,m){if(n.readyState==4&&(n.status==200||window.location.href.indexOf("http")==-1)){var l=new Image();l.onload=function(){d.style.marginTop="-"+Math.ceil(l.height/2)+"px";d.style.marginLeft="-"+Math.ceil(l.width/2)+"px";document.getElementById(c).innerHTML='<a href="#" rel="modal_close"><img src="'+m+'" alt="" /></a>';f.closeOpenMore()};l.src=m}else{d.style.marginTop="-35px";d.style.marginLeft="-35px";document.getElementById(c).style.display="block";document.getElementById(c).innerHTML="<p>loading image</p><p>"+f.imgpreloader+"</p>"}}}}e(this.obj)}};modal.prototype.setMargins=function(){var d=document.getElementById(this.obj);if(d!=null){d.style.visibility="hidden";d.style.display="block";var e=d.clientHeight;var c=d.clientWidth;if(e>0){d.style.marginTop="-"+Math.ceil(e/2)+"px"}if(c>0){d.style.marginLeft="-"+Math.ceil(c/2)+"px"}d.style.visibility="";d.style.display="none"}}};
