// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this notice.

// SETUPS:
// ===============================

// Set the horizontal and vertical position for the popup

PositionX = 20;
PositionY = 10;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

border_h = 20;
border_w = 37;
backcolor = '000000';

CloseMsgH = 30;

maxWidth = screen.width-border_w*2-PositionX-10;
maxHeight = screen.height-border_h*2-PositionY-CloseMsgH-40;

//<a href="#" onclick="window.open('newpage.html', '_blank', 'toolbar=yes,location=yes,directories=yes,resizable=yes,scrollbars=yes'); return false;">Link</a> 

//for index.htm, use:
//"   <SCRIPT LANGUAGE="JavaScript" SRC="pacn_scripts.js"></SCRIPT>" in <HEAD></HEAD>
//and "<a href="javascript:popImage('images/NAME.jpg','DESC')"><img src="thumbnails/NAME.jpg" alt="DESC" border="2"></a>" in the body

// ================================

function popImage(imageURL,imageTitle){
  imgWin=window.open('[Published] Adventures','','scrollbars=yes,location=yes,directories=yes,resizable=yes,menubar=no,toolbar=no,status=no,width=1000,height=700,left='+PositionX+',top='+PositionY);

  with (imgWin.document){
    writeln('<html><head><title>Loading...</title><style>body{margin-top:'+border_h+'px;text-align:center}</style>');
    writeln('<sc'+'ript>');

      writeln('function reSizeToImage(){');
        writeln('if (document.images["George"].width > '+maxWidth+' || document.images["George"].height > '+maxHeight+'){');
          writeln('if ((document.images["George"].width - '+maxWidth+') > (document.images["George"].height - '+maxHeight+')){');
            writeln('width='+maxWidth+'+'+border_w+'*2;');
            writeln('height=document.images["George"].height + '+border_h+' *2 + '+CloseMsgH+';');
            writeln('imgRatio='+maxWidth+'/document.images["George"].width;');
            writeln('imgHeight=document.images["George"].height;');
            writeln('imgWidth=document.images["George"].width * imgRatio;');
            writeln('winaddie=105;}');
          writeln('else {');
            writeln('width=document.images["George"].width+'+border_w+'*2;');
            writeln('height='+maxHeight+'+'+border_h+'*2+'+CloseMsgH+';');
            writeln('imgRatio='+maxHeight+'/document.images["George"].height;');
            writeln('imgHeight=document.images["George"].height * imgRatio;');
            writeln('imgWidth=document.images["George"].width;');
            writeln('winaddie=0;}}');
        writeln('else {');
          writeln('width=document.images["George"].width+'+border_w+'*2;');
          writeln('height=document.images["George"].height + '+border_h+' *2 + '+CloseMsgH+';');
          writeln('imgHeight=document.images["George"].height;');
          writeln('imgWidth=document.images["George"].width;');
          writeln('winaddie=95;}');
        writeln('height=height+winaddie;');
        writeln('window.resizeTo(width,height);}');

      writeln('function doTitle(){document.title="'+imageTitle+'";}');

    writeln('</sc'+'ript>');

    writeln('</head><body bgcolor='+backcolor+' onload="reSizeToImage();doTitle();self.focus()" ');
    if (AutoClose) writeln('onclick="self.close()"');
    writeln('><img name="George" src="'+imageURL+'" style="text-align:center, display:block"><p><br><font color="#666666">Click anywhere to close<font></body></html>');
    close();
  }
}



function currentOpac(id, opacEnd, millisec) { 
    //standard opacity is 100 
    var currentOpac = 100; 
     
    //if the element has an opacity set, get it 
    if(document.getElementById(id).style.opacity < 100) { 
        currentOpac = document.getElementById(id).style.opacity * 100; 
    } 

    //call for the function that changes the opacity 
    opacity(id, currentOpac, opacEnd, millisec) 
}

function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 






// Gradual-Highlight Image Script II- 
// By J. Mark Birenbaum (birenbau@ugrad.cs.ualberta.ca)
// Permission granted to Dynamicdrive.com to feature script in archive
// For full source to script, visit http://dynamicdrive.com

// object - image to be faded (actual object, not name);
// destOp - destination transparency level (ie 80, for mostly solid)
// rate   - time in milliseconds between transparency changes (best under 100)
// delta  - amount of change each time (ie 5, for 5% change in transparency)

nereidFadeObjects = new Object();
nereidFadeTimers = new Object();

function nereidFade(object, destOp, rate, delta){
  clearTimeout(nereidFadeTimers[object.sourceIndex]);
  if (isIE){
    if (!document.all)
     return
    if (object != "[object]"){  //do this so I can take a string too
      setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);
      return;
    }
    diff = destOp-object.filters.alpha.opacity;
    direction = 1;
    if (object.filters.alpha.opacity > destOp){
      direction = -1;
    }
    delta=Math.min(direction*diff,delta);
    object.filters.alpha.opacity+=direction*delta;
    if (object.filters.alpha.opacity != destOp){
      nereidFadeObjects[object.sourceIndex]=object;
      nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
    }
  }
  else {
    var element = document.getElementById(object);
    var opacity = element.style.opacity*100;
    diff = destOp-opacity;
    direction = 1;
    if (opacity > destOp){
      direction = -1;
    }
    delta=Math.min(direction*diff,delta);
    element.style.opacity=(opacity+direction*delta)/100;
    if (element.style.opacity*100 != destOp){
      nereidFadeObjects[object.sourceIndex]=object;
      nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
    }
  }
}

