function get(id) {return document.getElementById(id)}
function $(id) {return document.getElementById(id).style}
function val(e) {var n = parseInt(e); return n == null || isNaN(n) ? 0 : n }

function getScroll() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}

function getSize() {

  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return [ myWidth, myHeight ];
}

function ecenter(id,w,h) {

siz = getSize()
pos = getScroll()

asd = $(id)

asd.left = -18 + (siz[0] - val(asd.width))/2 + 'px'
asd.top = pos[1]+(siz[1] - val(asd.height))/2 + 'px'

if (val(asd.top) < pos[1] + 10)
asd.top = pos[1] + 10 + 'px'
}

function eanim(id,prop,a,b,inc,unit,speed,exec) {
i = 0
if (a==0) $(id).display="block";

if (a<b) 
while (a<b) {
setTimeout("$('"+id+"')."+prop+"="+a+"+'"+unit+"';"+exec,speed*i)
a += inc;i++
}

else if (a>b) 
while (a>b) {
setTimeout("$('"+id+"')."+prop+"="+a+"+'"+unit+"';"+exec,speed*i)
a -= inc;i++
}

if (b==0)
setTimeout("$('"+id+"').display='none'",speed*(i+1))

return speed*i
}

function eimg(url) {

var IE7 = false /*@cc_on || @_jscript_version <= 5.7 @*/;

var IE8 = false /*@cc_on || @_jscript_version > 5.7 @*/;

if(IE7||IE8) {
window.open(url,null,"top=0,left=0,width=1024,height=768,status=no,toolbar=no,menubar=no,location=no,resizable=1,scrollbars=1");
}
else {

//$('eimg_back').height=(window.innerWidth + window.scrollMaxY) +'px'

//opacity:0.4;filter:alpha(opacity=40)
//-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";  // IE8

delay = eanim('eimg_back','opacity',0,0.8,0.05,'',10)

$('eimg_load').display='block'
$('eimg_load').opacity=1

$('eimg_front').width='32px'
$('eimg_front').height='32px'

ecenter('eimg_front')

setTimeout("eanim('eimg_front','opacity',0,1,0.05,'',10)",delay)

setTimeout("delay = eanim('eimg_front','opacity',0,1,0.05,'',10); setTimeout(\"eimg_load('"+url+"')\",delay)",delay)

}}


function eimg_load(url) {
img = new Image();
		
img.onload=function(){

p = val($('eimg_front').padding)

w = img.width+p;
h = img.height+p;

eanim('eimg_load','opacity',1,0,0.05,'',10)

eanim('eimg_front','width',32,w,10,'px',10,'ecenter("eimg_front")')
delay = eanim('eimg_front','height',32,h,10,'px',10,'ecenter("eimg_front")')

setTimeout("get('eimg_img').src='"+img.src+"'",delay)
setTimeout("eanim('eimg_img','opacity',0,1,0.05,'',10)",delay)
}
img.src = url;
}


function eimg_close() {

eanim('eimg_img','opacity',1,0,0.05,'',10)

setTimeout("delay = eanim('eimg_front','opacity',1,0,0.05,'',10); setTimeout(\"eanim('eimg_back','opacity',0.8,0,0.05,'',10);\",delay)",delay)

}