﻿function getBodyScrollTop(){  return self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop);}function addHandler(object, event, handler){  if (typeof object.addEventListener != 'undefined')    object.addEventListener(event, handler, false);  else if (typeof object.attachEvent != 'undefined')    object.attachEvent('on' + event, handler);  else    throw "Incompatible browser";}function getleft(elem){s=elem.style.left;v=s.substring(0,s.indexOf("p"));v1=eval(v);return(v1);}function hint_table(cont,hide,corn){var ret="<table cellspacing=0 cellpadding=0 class='popup_table'><tr><td class='popup_table11'><\/td><td class='popup_table12'><\/td><td class='popup_table"+corn+"'><\/td><\/tr><tr><td class='popup_table21'><\/td><td class='popup_table22'>";ret+="<img src=\"images/popclose.jpg\" class=\"popup_hide\" onclick=\""+hide+"\">"+cont;ret+="<\/td><td class='popup_table23'><\/td><\/tr><tr><td class='popup_table31'><\/td><td class='popup_table32'><\/td><td class='popup_table33'><\/td><\/tr><\/table>";return ret;}function gallery_popup(elm,varn){var varname=varn;var phpp=elm;var cur_item=0;var x=500;var y=375;var images=new Array();this.add_item=function(itm){images[images.length]=new Image(x,y);images[images.length-1].src=itm;}this.show=function(i){cur_item=i;this.show_item(0);var leftt=((document.body.clientWidth-x)/2-getElementPosition(phpp.offsetParent).left);var topp=((document.body.clientHeight-y)/2+getBodyScrollTop()-getElementPosition(phpp.offsetParent).top);phpp.style.left=leftt+'px';phpp.style.top=topp+'px';phpp.style.visibility='visible';}this.init=function(px,py,ix,iy){phpp.innerHTML=hint_table("<img id=\"popimg\" src=\"images/Cinema.jpg\" style=\"width:"+ix+"px;height:"+iy+"px\" align=\"center\"/><br/><br/><img id='imgprev' src='images/popleft.png' onclick='"+varname+".show_item(-1);' /><img id='imgnext' src='images/popright.png' onclick='"+varname+".show_item(1)' />",varname+".hide()",13);phpp.style.width=px+'px';phpp.style.height=py+'px';y=py;x=px;}this.show_item=function(i){cur_item+=i;if(cur_item<=0){cur_item=0;document.getElementById('imgprev').style.visibility='hidden';}else document.getElementById('imgprev').style.visibility='visible';if(cur_item>=images.length-1){cur_item=images.length-1;document.getElementById('imgnext').style.visibility='hidden';}else document.getElementById('imgnext').style.visibility='visible';document.getElementById('popimg').src=images[cur_item].src;}this.save_item=function(){w1=window.open();w1.location.href=images[cur_item].src;w1.close;}this.hide=function(){phpp.style.visibility='hidden';document.getElementById('imgprev').style.visibility='hidden';document.getElementById('imgnext').style.visibility='hidden';}}function getElementPosition(elem){//    var w = elem.offsetWidth;//    var h = elem.offsetHeight;	    var l = 0;    var t = 0;	    while (elem)    {        l += elem.offsetLeft;        t += elem.offsetTop;        elem = elem.offsetParent;    }//    return {"left":l, "top":t, "width": w, "height":h};    return {"left":l, "top":t};}function getElementComputedStyle(elem, prop){  if (typeof elem!="object") elem = document.getElementById(elem);    // external stylesheet for Mozilla, Opera 7+ and Safari 1.3+  if (document.defaultView && document.defaultView.getComputedStyle)  {    if (prop.match(/[A-Z]/)) prop = prop.replace(/([A-Z])/g, "-$1").toLowerCase();    return document.defaultView.getComputedStyle(elem, "").getPropertyValue(prop);  }    // external stylesheet for Explorer and Opera 9  if (elem.currentStyle)  {    var i;    while ((i=prop.indexOf("-"))!=-1) prop = prop.substr(0, i) + prop.substr(i+1,1).toUpperCase() + prop.substr(i+2);    return elem.currentStyle[prop];  }    return "";}function text_popup(elm,varn){var varname=varn;var phpp=elm;var x=500;var y=375;var txt=new String();this.show=function(i,e){this.txt=i;phpp.style.right='0px';phpp.style.bottom='0px';phpp.innerHTML=hint_table(this.txt,varname+".hide()",34);var topp;if(getElementPosition(e.target).left>0)left=getElementPosition(e.target).left-getElementPosition(phpp.offsetParent).left-phpp.clientWidth+10;elseleft=e.clientX-getElementPosition(phpp.offsetParent).left-phpp.clientWidth;if(getElementPosition(e.target).top>0)topp=getElementPosition(e.target).top-getElementPosition(phpp.offsetParent).top-phpp.clientHeight+55;elsetopp=e.clientY-getElementPosition(phpp.offsetParent).top-phpp.clientHeight+70;//alert(getElementPosition(e.target).top+"-"+getElementPosition(phpp.offsetParent).top+"-"+phpp.clientHeight+"="+topp);//}phpp.style.visibility='visible';phpp.style.left=left+'px';phpp.style.top=topp+'px';//alert(phpp.style.left);}this.init=function(px,py){this.x=px;this.y=py;phpp.style.width=px+'px';phpp.style.height=py+'px';phpp.style.right='0px';phpp.style.bottom='0px';}this.hide=function(){phpp.style.visibility='hidden';phpp.style.right='0px';phpp.style.bottom='0px';}}
