﻿// JScript File

function ShowHighlite(TheElement){
    var TheImagPath = TheElement.background;
    //alert(TheImagPath);
    
    if(TheImagPath == "Images/bg_sidebar_over.gif"){
        TheElement.background = "Images/bg_sidebar.gif";
    }else if(TheImagPath == "Images/bg_sidebar.gif"){
      TheElement.background = "Images/bg_sidebar_over.gif";
    }
    
}

    
function ViewPhoto(TheImage){    

    //PreLoadImages();
      
    var strImageSrc = TheImage.src;
    var arrPath = new Array();
    var newPath;
     
    arrPath = strImageSrc.split(".jpg");
    newPath = arrPath[0] + "_lg.jpg";
    
    var newImag = new Image();
    newImag.src = newPath;
          
    var winWidth = newImag.width;
    var winHeight = newImag.height;

    //alert(winWidth + " " + winHeight);
                
    if (self.innerWidth){
        frameWidth = self.innerWidth;
        frameHeight = self.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientWidth){
        frameWidth = document.documentElement.clientWidth;
        frameHeight = document.documentElement.clientHeight;
    }
    else if (document.body){
        frameWidth = document.body.clientWidth;
        frameHeight = document.body.clientHeight;
    }
    
    var winLeft = (frameWidth - winWidth) / 2;
    var winTop = (frameHeight - winHeight) / 2;
    
    //alert(self.innerWidth + ", " + document.documentElement.clientWidth + ", " +  document.body.clientWidth);
    //alert("frameWidth: " + frameWidth + "\nframeHeight: " + frameHeight + "\nwinWidth: " + winWidth + "\nwinHeight: " + winHeight + "\nwinTop: " + winTop + "\nwinLeft: " + winLeft);
    
    
    window.open(newPath,"PhotoWindow","width=" + winWidth + ",height=" + winHeight + ",top=" + winTop + ",left=" + winLeft);
    
}  

   
   

// Set the horizontal and vertical position for the popup

PositionX = 100;
PositionY = 100;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth  = 500;
defaultHeight = 500;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}                

if (self.innerWidth){
    frameWidth = self.innerWidth;
    frameHeight = self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientWidth){
    frameWidth = document.documentElement.clientWidth;
    frameHeight = document.documentElement.clientHeight;
}
else if (document.body){
    frameWidth = document.body.clientWidth;
    frameHeight = document.body.clientHeight;
}

LeftX = (frameWidth - 100) / 2;
TopY = (frameHeight - 100) / 2;

//alert(LeftX + " " + TopY);

var optNN='scrollbars=no,titlebar=no,status=no,location=no,directories=no,menubar=0,width='+defaultWidth+',height='+defaultHeight+',left=' + LeftX + ',top=' + TopY;
var optIE='scrollbars=no,titlebar=no,status=no,location=no,directories=no,menubar=0,width=100,height=100,left=' + LeftX + ',top=' + TopY;

function popImage(imageURL,imageTitle){

    if (isNN){
        imgWin=window.open('about:blank','win',optNN);
    }
    if (isIE){
        imgWin=window.open('about:blank','win',optIE);
    }
    
    with (imgWin.document){
        writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');
        writeln('<sc'+'ript>');
        writeln('   var isNN,isIE;');
        writeln('   if (parseInt(navigator.appVersion.charAt(0))>=4){');
        writeln('       isNN=(navigator.appName=="Netscape")?1:0;');
        writeln('       isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
        writeln('   function reSizeToImage(){');
        writeln('       if (isIE){');
        //writeln('           window.resizeTo(100,100);');
        writeln('           width = document.images[0].width + 10;');
        writeln('           height = document.images[0].height + 75;')
        writeln('           window.resizeTo(width,height);');
        writeln('           window.moveBy(((width / 2) * -1) + 10,((height / 2) * -1) + 150);}');
        writeln('       if (isNN){');       
        writeln('           window.innerWidth=document.images["Photo"].width + 10;');
        writeln('           window.innerHeight=document.images["Photo"].height + 10;}}');
        writeln('   function doTitle(){document.title="'+imageTitle+'";}');
        writeln('</sc'+'ript>');
        
        if (!AutoClose){
            writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
        }else{ 
            writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
        }
        
        writeln('<img name="Photo" src='+imageURL+' style="display:block"></body></html>');
        close();		
    }
}

        
        
      
        

    
