
var TopImageList = new Array ("/TopBarImages/USADKP004802.jpg", "/TopBarImages/USADKP004808.jpg", "/TopBarImages/USADKP004826.jpg", "/TopBarImages/USADRP003610.jpg", "/TopBarImages/USADRP003622.jpg", "/TopBarImages/USADRP003627.jpg", "/TopBarImages/USBAYP001116.jpg","/TopBarImages/USBIGP001209.jpg","/TopBarImages/USMNEP001615.jpg", "/TopBarImages/USMNEP001622.jpg", "/TopBarImages/USSHAP003707.jpg", "/TopBarImages/USVMTP003602.jpg","/TopBarImages/USVMTP003912.jpg", "/TopBarImages/USVMTP004104.jpg", "/TopBarImages/USVMTP004225.jpg","/TopBarImages/USVMTP004305.jpg");


function OpenPopup (c) 
{
	window.open(c,
	'window',
	'width=600,height=500,scrollbars=yes,status=yes');
}

		
var iToolBarHeight = 150; //This is an assumption. ToolBar+Menubar+Captionbar size	
var iFooterHeight = 5; //
var iCopyRightFontHeight = 15; //We should go down by these number of pixels from 'Container' before writing to the copyright text.
var LastWidth;
var iOrgWidth;
var iOrgHeight;
var iHbyW;
var bScroll;
var iUsableImageWidth;
var iUsableImageHeight;
var iContainerOffsetTop	=	70;//	TOP_LOGO11.height + <TABLE.TOP_LOGO11.border-bottom-width> 5px
var iStickyMenuOffset = 60; //This is the number pixel below the mouse pointer where sticky popmenu is shown. Size of the image is 100px; Border is 20px
var iMinimumHeightOfStickyPopMenu = 5;
var browser;
function	startList() 
{
	
	iUsableImageWidth = GetWidth()*0.82; 
	iUsableImageHeight = GetHeight()*0.75;
	
	if (document.all&&document.getElementById) 
	{
		navRoot = document.getElementById("nav");
		for (i=0; i<navRoot.childNodes.length; i++) 
		{
			node = navRoot.childNodes[i];
			for (j=0; j<node.childNodes.length; j++)
			{	
				node2=node.childNodes[j];
				for (k=0; k<node2.childNodes.length; k++)
				{
					node3=node2.childNodes[k];
					if (node3.nodeName=="LI") 
					{
						node3.onmouseover=function() 
						{
							this.className+=" over";	
						}
						node3.onmouseout=function() 
						{
							this.className=this.className.replace(" over", "");
						}
					}
				}
			}
			if (node.nodeName=="LI") 
			{
				node.onmouseover=function() 
				{
					this.className+=" over";
					//alert(this.className);
				}
				node.onmouseout=function() 
				{
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
	LastWidth = 0;
	
	
 	/*
	image1 = document.getElementById("IndividualImageID");
	
	if(image1)
	{
		//if (navigator.appName=="Microsoft Internet Explorer")
	  {
		   image1.title = "Tap gently, you might get a large image";
	  }
	
		iOrgWidth = image1.width;
		iOrgHeight = image1.height;
		
		iHbyW = iOrgHeight/iOrgWidth;
		
		if( image1.width  > iUsableImageWidth )
		{
			image1.height = iUsableImageWidth * iHbyW;
			image1.width = iUsableImageWidth;
		}
		if( image1.height  > iUsableImageHeight )
		{
			image1.width = iUsableImageHeight / iHbyW;
			image1.height = iUsableImageHeight;
		}
	}
	*/
}

function	FillBookDetails(innerHTML)
{
	if(document.getElementById)	  //gecko(NN6) + IE 5+
    	{
		var obj = document.getElementById("PopupStickyBookDetailsID");
		obj.innerHTML = innerHTML;
      		obj.style.visibility = "visible";
      		
      		
      		myTimer =	window.setTimeout('FillBookDetailsPopupStickyOffWithTimer(0)', 4000);
    	}
}

function FillBookDetailsPopupStickyOffWithTimer(index)
{
	var obj = document.getElementById("PopupStickyBookDetailsID");
      	obj.style.visibility = "hidden";
}

function	startList1() 
{
	/*document.images["TopBarImg"].src=TopImageList[0];*/
	if (document.all&&document.getElementById) 
	{
		
		navRoot = document.getElementById("nav");
		for (i=0; i<navRoot.childNodes.length; i++) 
		{
			node = navRoot.childNodes[i];
			for (j=0; j<node.childNodes.length; j++)
			{	
				node2=node.childNodes[j];
				for (k=0; k<node2.childNodes.length; k++)
				{
					node3=node2.childNodes[k];
					if (node3.nodeName=="LI") 
					{
						node3.onmouseover=function() 
						{
							this.className+=" over";	
						}
						node3.onmouseout=function() 
						{
							this.className=this.className.replace(" over", "");
						}
					}
				}
			}
			if (node.nodeName=="LI") 
			{
				node.onmouseover=function() 
				{
					this.className+=" over";
					//alert(this.className);
				}
				node.onmouseout=function() 
				{
					this.className=this.className.replace(" over", "");
				}
			}
		}
		
		//makes HOVER come for GalleryNavRowID
		navRoot1 = document.getElementById("GalleryNavRowID");
		
		for (i1=0; i1<navRoot1.childNodes.length; i1++) 
		{
			node1	=	navRoot1.childNodes[i1];
			if (node1.nodeName=="TD") 
			{
				node1.onmouseover=function() 
				{
					this.className+=" over";
					//alert(this.className);
					
				}
				node1.onmouseout=function() 
				{
					this.className=this.className.replace(" over", "");
					//alert(this.className);
				}
			}
		}
		
		
		navRoot2 = document.getElementById("GalleryNavRow5ID");
		for (i1=0; i1<navRoot2.childNodes.length; i1++) 
		{
			node6	=	navRoot2.childNodes[i1];
			if (node6.nodeName=="TD") 
			{
				node6.onmouseover=function() 
				{
					this.className+=" over";
				}
				node6.onmouseout=function() 
				{
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}



function	startList1Specail() 
{
	/*document.images["TopBarImg"].src=TopImageList[0];*/
	if (document.all&&document.getElementById) 
	{
		
		//makes HOVER come for GalleryNavRowID
		navRoot1 = document.getElementById("GalleryNavRowID");
		
		for (i1=0; i1<navRoot1.childNodes.length; i1++) 
		{
			node1	=	navRoot1.childNodes[i1];
			if (node1.nodeName=="TD") 
			{
				node1.onmouseover=function() 
				{
					this.className+=" over";
					//alert(this.className);
					
				}
				node1.onmouseout=function() 
				{
					this.className=this.className.replace(" over", "");
					//alert(this.className);
				}
			}
		}
		
		
		navRoot2 = document.getElementById("GalleryNavRow5ID");
		for (i1=0; i1<navRoot2.childNodes.length; i1++) 
		{
			node6	=	navRoot2.childNodes[i1];
			if (node6.nodeName=="TD") 
			{
				node6.onmouseover=function() 
				{
					this.className+=" over";
				}
				node6.onmouseout=function() 
				{
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}





function GetRandomNumber()
{
 var 	TotalImages = 10;


 var    FileNames = new Array (
                                "A friend is one before whom I may think aloud-Emerson",
                                "A hero is no braver than an ordinary man, but he is braver five minutes longer-Emerson",
                                "Character is higher than intellect... A great soul will be strong to live, as well as to think-Emerson",
                                "Do not go where the path may lead, go instead where there is no path and leave a trail-Emerson",
                                "Every hero becomes a bore at last",
                                "Insist on yourself; never imitate... Every great man is unique",
                                "Make yourself necessary to somebody. Do not make life hard to any",
                                "Nothing can bring you peace but yourself",
                                "Nothing is at last sacred but the integrity of your own mind.",
                                "Shallow men believe in luck. Strong men believe in cause and effect.",
                                "The ancestor of every action is a thought.",
                                "The end of the human race will be that it will eventually die of civilization.",
                                "The only way to have a friend is to be one.",
                                "The ornament of a house is the friends who frequent it.",
                                "Tis the good reader that makes the good book.",
                                "Truth is beautiful, without doubt; but so are lies.",
                                "When you strike at a king, you must kill him.",
                                "Whoso would be a man must be a nonconformist.",
                                "To be great is to be misunderstood.",
                                "Every artist was first an amateur.",
                                "As soon as there is life there is danger.",
                                "Every child is an artist. The problem is how to remain an artist once he grows up.",
                                "I shut my eyes in order to see.",
                                "All art is an imitation of nature.",
                                "Creative work is play. It is free speculation using materials of one's chosen form.",
                                "Rarely do great beauty and great virtue dwell together.",
                                "A fashion is nothing but an induced epidemic.",
                                "Hell is full of musical amateurs.",
                                "Patriotism is your conviction that this country is superior to all other countries because you were born in it",
                                "The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.",
                                "You'll never have a quiet world till you knock the patriotism out of the human race.",
                                "All great truths begin as blasphemies.",
                                "Liberty means responsibility. That is why most men dread it.",
                                "Take care to get what you like or you will be forced to like what you get.",
                                "There is no love sincerer than the love of food."
				);

  selected = Math.random();
  selected = Math.floor(selected * TotalImages);
  return	(FileNames[selected]);
 

}


var iLastIndex = -1;
///<PopupSticky> is the container for holding pPopupSticky. Bydefaualt its hidden.
///There will be a one instance of <PopupSticky> for each image.
///Each of these instance will have name(PopupStickyInstance0) with a numerical suffix starting from 0.
///Ex: ID="PopupStickyInstance0", ID="PopupStickyInstance1"
///On 'onMouseOver' event, we go throught every instance of <PopupSticky> and hide
///everything except one the raised 'onMouseOver' event. Thus we make sure that
///last PopupSticky is wiped.
function togglePopupSticky( index)
{
    //index - This is the suffix given to 'PopupStickyInstance' to indicate its instance.
    //This index starts from 0. If 'index' value is 4 then 'PopupStickyInstance4'  
    //is the instance to be made visible.
    
    //totalcount - This is the total number of <PopupSticky> instances
	
    //http://www.geocities.com/technofundo/tech/js/showhide.html#
    /* Do not need the popup menu. Oct 2007
    if (navigator.appName.indexOf("Microsoft") >= 0)
    {
	    if(document.layers)	   //NN4+
	    {
	    	
	    }
	    else if(document.getElementById)	  //gecko(NN6) + IE 5+
	    {
	    	if(iLastIndex!= -1)
	    	{
			var obj = document.getElementById("PopupStickyInstance" + iLastIndex );
		      obj.style.visibility = "hidden";
		}
		var obj = document.getElementById("PopupStickyInstance" + index);
	      	obj.style.visibility = "visible";
	      
	      	
	      	
	      	
	      	obj.style.top = document.body.scrollTop + window.event.clientY+(iStickyMenuOffset/2);	
	      	iLastIndex 	=	index;
		myTimer =	window.setTimeout('togglePopupStickyOffWithTimer(iLastIndex)', 4000);
	    }
	    else if(document.all)	// IE 4
	    {
	     
	    }
    }	
    */
}


///<PopupSticky> is the container for holding pPopupSticky. Bydefaualt its hidden.

function togglePopupStickyIndividualPage( )
{
    //index - This is the suffix given to 'PopupStickyInstance' to indicate its instance.
    //This index starts from 0. If 'index' value is 4 then 'PopupStickyInstance4'  
    //is the instance to be made visible.
    
    //totalcount - This is the total number of <PopupSticky> instances
	
    //http://www.geocities.com/technofundo/tech/js/showhide.html#
    /*
    if(document.layers)	   //NN4+
    {
    	
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
	var obj = document.getElementById("PopupStickyIndividualPageID");
      	obj.style.visibility = "visible";
      	myTimer =	window.setTimeout('togglePopupStickyOffWithTimerIndividual(iLastIndex)', 4000);
    }
    else if(document.all)	// IE 4
    {
     
    }
    */
    

    
}

function ShowScrollbar( e1 )
{
	/*
	//15% of the screen, on L-side is taken by 'nvigation' & 'description' blocks and so 85% is available for diplaying the image.
	//We need this 85%.
	var iImageWidth = GetWidth()*0.82; 
	var iImageHeight = GetHeight()*0.75;  
	
	//if  (navigator.appName=="Microsoft Internet Explorer")
	{
			if( iOrgWidth <= e1.width)
			{ //HIDE scroll bars
				if(bScroll == 1)
				{
					e1.width = iImageWidth;			
					//adjust the 'height' praportionately		 			
					e1.height = e1.width * iHbyW;		
					if( e1.height > iImageHeight)			 	
					{
						e1.height = iImageHeight;		
						//adjust the 'width' praportionately		 	
					  e1.width = e1.height / iHbyW;		
					}
				}
			}
			else if( iOrgHeight <= e1.height)			 	
			{
				if(bScroll == 1)
				{
					e1.height = iImageHeight;		
					//adjust the 'width' praportionately		 	
				  e1.width = e1.height / iHbyW;		
				  
				  if( e1.width > iImageWidth)			 	
					{
						e1.width = iImageWidth;			
						
						//adjust the 'height' praportionately		 			
						e1.height = e1.width * iHbyW;		
					}
				}
			}
			else if( iOrgHeight > e1.height )
			{
				e1.height = iOrgHeight; 
				e1.width = iOrgWidth;	
			  bScroll = 1;
			}
			else if( iOrgWidth > e1.width )
			{
				e1.width = iOrgWidth;		
				e1.height = iOrgHeight; 
				bScroll = 1;
			}
			else
			{
				e1.width = iOrgWidth;
			}
	}
	*/
	
}

function togglePopupStickyOffWithTimerIndividual(index)
{
	var obj = document.getElementById("PopupStickyIndividualPageID");
	obj.style.visibility = "hidden";
}

///<PopupSticky> is the container for holding pPopupSticky. Bydefaualt its hidden.
///There will be a one instance of <PopupSticky> for each image.
///Each of these instance will have name(PopupStickyInstance0) with a numerical suffix starting from 0.
///Ex: ID="PopupStickyInstance0", ID="PopupStickyInstance1"
///On 'onMouseOver' event, we go throught every instance of <PopupSticky> and hide
///everything except one the raised 'onMouseOver' event. Thus we make sure that
///last PopupSticky is wiped.
function togglePopupStickyOffWithTimer( index)
{
    //index - This is the suffix given to 'PopupStickyInstance' to indicate its instance.
    //This index starts from 0. If 'index' value is 4 then 'PopupStickyInstance4'  
    //is the instance to be made visible.
    
    //totalcount - This is the total number of <PopupSticky> instances
	
    //http://www.geocities.com/technofundo/tech/js/showhide.html#
    if(document.layers)	   //NN4+
    {
    	
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
    	if(index!= -1)
    	{
		var obj = document.getElementById("PopupStickyInstance" + index );
	      	obj.style.visibility = "hidden";
	      
	}
    }
    else if(document.all)	// IE 4
    {
     
    }
}


///<PopupSticky> is the container for holding pPopupSticky. Bydefaualt its hidden.
///There will be a one instance of <PopupSticky> for each image.
///Each of these instance will have name(PopupStickyInstance0) with a numerical suffix starting from 0.
///Ex: ID="PopupStickyInstance0", ID="PopupStickyInstance1"
///On 'onMouseOver' event, we go throught every instance of <PopupSticky> and hide
///everything except one the raised 'onMouseOver' event. Thus we make sure that
///last PopupSticky is wiped.
function togglePopupStickyOff( index)
{
    //index - This is the suffix given to 'PopupStickyInstance' to indicate its instance.
    //This index starts from 0. If 'index' value is 4 then 'PopupStickyInstance4'  
    //is the instance to be made visible.
    
    //totalcount - This is the total number of <PopupSticky> instances
	
    //http://www.geocities.com/technofundo/tech/js/showhide.html#
    
    /* commenting out after seeing glitches in Jacob's gallery 11-03-2007
    if(document.layers)	   //NN4+
    {
    	
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
    	if(iLastIndex!= -1)
    	{
		var obj = document.getElementById("PopupStickyInstance" + iLastIndex );
	      	obj.style.visibility = "hidden";
	      
	}
    }
    else if(document.all)	// IE 4
    {
     
    }
    */
}

function	LoadQuote() 
{
	alert('hello world!');
	/*document.images["TopBarImg"].src=TopImageList[0];*/
	if (document.all) 
	{
		//makes HOVER come for GalleryNavRowID
		var  newQuote = document.createTextNode("New List Item 1");
		newQuote.appendData("dfsfsf");
		navRoot1 = document.getElementById("GalleryNavRowID");
		navRoot1.appendChild(newQuote);
		
	}
}

//Got from http://www.howtocreate.co.uk/tutorials/javascript/browserwindow
function	GetWidth() {
  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;
  }
  
  return myWidth;
}

function swapsize(el) 
{ 
    if (el.width==800) { 
        el.width=400; 
        el.height=300; 
    } 
    else { 
        el.width=800; 
        el.height=600; 
    } 



} 
//Got from http://www.howtocreate.co.uk/tutorials/javascript/browserwindow
function	GetHeight() {
  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;
  }
  
  return myHeight;
}