
function getWindowSize() {
  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;
  }
//  window.alert( 'Width = ' + myWidth );
//  window.alert( 'Height = ' + myHeight );
	return [myWidth, myHeight];
}


  function findPosX(obj)



  {



    var curleft = 0;



    if(obj.offsetParent)



        while(1) 



        {



          curleft += obj.offsetLeft;



          if(!obj.offsetParent)



            break;



          obj = obj.offsetParent;



        }



    else if(obj.x)



        curleft += obj.x;



    return curleft;



  }







  function findPosY(obj)



  {



    var curtop = 0;



    if(obj.offsetParent)



        while(1)



        {



          curtop += obj.offsetTop;



          if(!obj.offsetParent)



            break;



          obj = obj.offsetParent;



        }



    else if(obj.y)



        curtop += obj.y;



    return curtop;



  }







/* from http://www.howtocreate.co.uk/tutorials/javascript/browserwindow */







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 [ scrOfX, scrOfY ];



}







function closeFullPoster() {
document.getElementById("fullPosterDiv").style.visibility="hidden";
}







function showPosterForPrint() {



location.href="showimg.cfm?f="+	currentPosterName;



}







function XopenFullPoster(x, pTtitle) {

if (pTtitle==null) pTtitle="";
currentPosterName=x;
var y = getScrollXY(), img=document.getElementById("posterImg");
document.getElementById("posterDiv").style.top=y[1]+"px"; 
//img.style.opacity=0;
img.src=x;
document.getElementById("picTitle").innerHTML=pTtitle;
document.getElementById("fade").style.display="block";
//document.getElementById("posterDiv").style.display="block";
imgLoaded(img);
}

function openFullPoster(x, pTtitle) {
if (pTtitle==null) pTtitle="";
currentPosterName=x;
// workaround to force FireFox to expose image properties properly on first load
var pd=document.getElementById("picDiv");
pd.innerHTML="";
pd.innerHTML="<img id='posterImg' src='" + x + "'>";
var y = getScrollXY(), img=document.getElementById("posterImg");
document.getElementById("posterDiv").style.top=y[1]+"px"; 
//img.style.opacity=0;
img.src=x;
document.getElementById("picTitle").innerHTML=pTtitle;
document.getElementById("fade").style.display="block";
//document.getElementById("posterDiv").style.display="block";
imgLoaded(img);
}


function closeLightBox() {
document.getElementById("fade").style.display="none";
document.getElementById("posterDiv").style.display="none";
document.getElementById("posterImg").src="transparent.gif";

}

function setLightboxBackgroundSize(xtra) {
if (xtra == null) xtra = 300;	
//document.getElementById("fade").style.height=(document.body.clientHeight+xtra)+"px"; 
document.getElementById("fade").style.height="4000px"; 
document.getElementById("fade").style.width=document.body.clientWidth+"px"; 
if (document.getElementById("posterDiv").style.display=="block") {
	 resizeImage(document.getElementById("posterImg"));
}	
}

function imgLoaded() {
var obj=document.getElementById("posterImg");
if (!obj.complete) {
	setTimeout("imgLoaded("+obj.id+")", 300);
	return;
}
resizeImage(obj);
document.getElementById("posterDiv").style.display="block";
var imgWidth=obj.width, scrWidth=document.body.clientWidth;
}

function resizeImage(img) {
var x=getWindowSize();
// Massive workabround for IE7, which doesn't return imnage .height property correctly
var newImageObj = new Image();
newImageObj.src = img.src;
var wHeight = x[1]-70;
//alert("window height: " + x[1]+ " object height "  + obj.height + " style.ofsetHeight " + obj.style.ofsetHeight);
if (newImageObj.height > wHeight) {
img.height=wHeight;
}
}











function fadeUp(){



curOpac += 0.1;



document.getElementById("posterImg").style.opacity = curOpac;



//alert(curOpac);



if (curOpac <=1) {



	setTimeout("fadeUp()",50);	



}



}











