function get(eid) {
var d = document;
var r = d.getElementById(eid);
return r;

}function popImg(open, iref, title) {
if (open) {
// top for popup image 10 pixels
// below corresponding thumb
//var top = (10 +
//var ps = window.pageYOffset;
//var ph = document.window.clientHeight;

//Here I check to see how far user has scrolled down

var ps = 0;
ps = getScrollXY();


if (ps == 0) 
{
var top = (190 + 'px');
}

if (ps > 0 && ps < 40)
{
ps2 = 195 - ps/2;

var top = (ps2 + 'px');
}
if (ps > 40)
{
ps2 = 175;

var top = (ps2 + 'px');
}
if (ps > 175)
{
ps2 = 220;

var top = (ps2 + 'px');
}
top = 175+'px';
//alert(ps);


//iref.offsetHeight +
//iref.offsetTop) +
'px';
// left for popup image is aligned
// with left of thumbnail
//var left = iref.offsetLeft + 'px'; 
var left = 200 + 'px';
// use same source file for popup
// as thumbnail

// Here screen resolution is determined and
// howBIg set the image size

var howBig = ' height="500" width="667" border="2">';

if (screen.height < 800){
howBig = ' height="350" width="467" border="2">';

}
if (screen.height < 601){
howBig = ' height="225" width="300" border="2">';

}
if (screen.height > 1000){
howBig = ' height="600" width="800" border="2">';
}

var stile = '<font color="#000099" size="+1"><class="pic2">';

var img = stile+title+'<br><img src="'+ iref.src +'"'+ howBig+'<br>'+'<class>';

var d = document;
// if popup hasn't yet been added,
// create and append to body
if (null == get('popImg')) {
var pop = d.createElement('DIV');
pop.id = 'popImg';
pop.style.position = 'fixed';
if(navigator.appName == "Microsoft Internet Explorer")
{
  pop.style.position = 'absolute';
var el = get('tor');
el.style.display = 'none';
}
//pop.height = '300';
//pop.width = '400';
//pop.height = '100';
//pop.width = '200';


d.body.appendChild(pop);



}


// get reference to popup image
// container div
var pop = get('popImg');
// set image element into div
pop.innerHTML = img;
// position relative to thumbnail


/////////// TOP of popup IMAGE ///////////////////

var ps = 0;
ps = getScrollXY();
ps2 = parseInt(ps);



pop.style.top = top;
var el = get('tor');
el.style.display = 'none';
if(navigator.appName == "Microsoft Internet Explorer")
{
  pop.style.position = 'absolute';

 if (ps2 > 170)
{
pop.style.top = ps2+20+'px';
}

}

 
pop.style.left = left;
pop.height = "300";
pop.width = "400";

// show the div and its image
pop.style.display = 'block';


}
else {
// since request was for close,
// (open==false), hide the div -
// don't destroy it, since it can
// be recycled cheaper
var pop = get('popImg');
pop.style.display = 'none';
var el = get('tor');
el.style.display = 'block';
if(navigator.appName == "Microsoft Internet Explorer")
{

var el = get('tor');
el.style.display = 'block';


}
}

}

function getScrollXY() {
  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 [ scrOfY ];
}


function Epopup(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=420,height=500,left = 362,top = 184');");
}

