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

// 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  = 900;
defaultHeight = 900;

// 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;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',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=100-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
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="George" src='+imageURL+' style="display:block"></body></html>');
close();		
}}



/*******************************************************************************************************************
Navigation
*******************************************************************************************************************/
var clockPage = '';
var clocksExist;
var pageDb = new Array();
window.onload = loadHandler;
function loadHandler()
{
    buildPageList();
    buildNavigation();
    if(clockPage != '')showButtons();
    document.clockForm.navigation.onchange = getClockPage;
    showEmptyMsg();
}
function pageItem(label,page)
{
    this.label = label;
    this.page = page;
}
function buildPageList()
{
    pageDb[pageDb.length] = new pageItem('Choose','');
    pageDb[pageDb.length] = new pageItem('Ansonia','ansonia-antique-clocks.php');
    pageDb[pageDb.length] = new pageItem('French','french-antique-clocks.php');
    pageDb[pageDb.length] = new pageItem('German','german-antique-clocks.php');
    pageDb[pageDb.length] = new pageItem('Gilbert W. L.','gilbert-antique-clocks.php');
    pageDb[pageDb.length] = new pageItem('Ingraham','ingraham-antique-clocks.php');
    pageDb[pageDb.length] = new pageItem('Ithaca','ithaca-antique-clocks.php');	
    pageDb[pageDb.length] = new pageItem('Kroeber','kroeber-antique-clocks.php');
    pageDb[pageDb.length] = new pageItem('New Haven','new-haven-antique-clocks.php');
    pageDb[pageDb.length] = new pageItem('Other Clocks','other-antique-clocks.php');
    pageDb[pageDb.length] = new pageItem('Sessions','sessions-antique-clocks.php');
    pageDb[pageDb.length] = new pageItem('Seth Thomas','seth-thomas-antique-clocks.php');
    pageDb[pageDb.length] = new pageItem('Time Clocks','antique-time-clocks.php');
    pageDb[pageDb.length] = new pageItem('Waterbury','waterbury-antique-clocks.php');
    pageDb[pageDb.length] = new pageItem('Welch E. N.','welch-antique-clocks.php');
}
function getClockPage()
{
    window.location.href =  document.clockForm.navigation.value;    
}
function navItem(page,label)
{
    this.page = page;
    this.label = label;
}
function buildNavigation()
{
    var navSelector = document.clockForm.navigation;
    for(var i=0;i<pageDb.length;i++)
    {
        navSelector.options[navSelector.options.length]= new Option(pageDb[i].label,pageDb[i].page);
    }
    navSelector.value = clockPage;        
}   
function nextPage()
{
    for(var i=0;i<pageDb.length;i++)
    {
        var gotoPage;
        if(pageDb[i].page == clockPage)
        {
            gotoPage = pageDb[i+1].page;
        }
    }
    if(gotoPage != '')
    {
        window.location.href = gotoPage;
    }
}
function lastPage()
{
    for(var i=0;i<pageDb.length;i++)
    {
        var gotoPage;
        if(pageDb[i].page == clockPage)
        {
            gotoPage = pageDb[i-1].page;
        }
    }
    if(gotoPage != '')
    {
        window.location.href = gotoPage;
    }
}
//Pass in current page to get the number of the page in the list
function getPageNum(findPage)
{
    for(var i=0;i<pageDb.length;i++)
    {
        if(pageDb[i].page == findPage)
        {
            return i;
        }
    }
}
function showButtons()
{
    var bottomCode = '';
    var topCode = '';
    var lastButtonBottom = '<a href="javascript:lastPage()"><img src="images/lastPage.gif" border="0" alt="View the previous page in the manufacturer list" /></a>';
    var nextButtonBottom = '<a href="javascript:nextPage()"><img src="images/nextPage.gif" border="0" alt="View the next page in the manufacturer list" /></a>';
    var lastButtonTop = '<a href="javascript:lastPage()"><img src="images/topLastPage.gif" border="0" alt="View the previous page in the manufacturer list" align="absmiddle" /></a>';
    var nextButtonTop = '<a href="javascript:nextPage()"><img src="images/topNextPage.gif" border="0" alt="View the next page in the manufacturer list" align="absmiddle" /></a>';
    var pageNum = getPageNum(clockPage);
    if(pageNum != 1) //This is one because the 0 = 'Choose Manufactuer'
    {
        bottomCode += lastButtonBottom;
        topCode += lastButtonTop;
    }
    if(pageNum != (pageDb.length-1))
    {
        bottomCode += nextButtonBottom;
        topCode += '&nbsp;'+nextButtonTop;
    }
    document.getElementById('bottomButtons').innerHTML = bottomCode;
    document.getElementById('topButtons').innerHTML = topCode;    
}
function showEmptyMsg()
{
    if(clockPage !='')
    {
        if(!clocksExist)
        {
            document.getElementById('ifEmpty').innerHTML = '<b>All clocks for this manufacturer have been sold</b>.<br />Please <a href="feedback.html">Contact the Clock Professor</a> if you have a request, or re-visit this page for updates.<br /><br /><br /><br /><br /><br />';
        }
    }
}


function popImageNew(myimage) {
 html = "<html><head><title>TheClockProfessor.com</title>" +
  "</head><body onblur='self.close()' style='background:#000000; margin:0px; padding:0px'>" 
  + "<img src='" + myimage + "' BORDER=0 NAME='image' style='margin:0px;padding:0px;font-size:0px'" 
  + "onload='window.resizeTo(document.image.width,document.image.height)'>"
  + "</body></html>";
 popup=
 window.open
  ('','image',
  'toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=1');
 popup.document.open();
 popup.document.write(html);
 popup.document.focus();
 popup.document.close()
 };