// this is the java script which writes the 
// generic link header html for all site pages


//the following bypasses all this stuff when executed from a "family"
//page. this means no family pages have the icons at the top
// this is done becuase the family pages are linked to from ebay
// and a pop up window comes up, with no icons on top of the page
//it displays better getting the viewer right to the listings!
var urlName = new String(window.location);
var pageStrPointer = urlName.lastIndexOf("/");
var pageNameString = urlName.substr(pageStrPointer+1,3);
if (pageNameString == "fam" || pageNameString == "FAM") {
   //do nothing
    
  }else{
   

// the following functions are for onclick events of icons
// and load the appropriate page when the icon is clicked
 function loadCosmicClosetHomePage()
 {
  window.location="../home/home.htm";   
 }
 function loadRecordHomePage()
 {
  window.location="../records/rechome.htm";   
 }
function loadRareRecordingsHomePage()
 {
  window.location="../audio/audhome.htm";   
 }
 function loadVideoHomePage()
  {
   window.location="../videos/vidhome.htm";   
 }
 function loadMagPaperHomePage()
  {
   window.location="../paper/maghome.htm";   
 }
 function loadVideoConversionHomePage()
  {
   window.location="../videos/conv.htm";   
 }
function loadMailPage()
  {
   // window.open("../popups/email.htm", "" , "width=400, height=300 windowFeatures ");
   window.open("../popups/email.htm", "" , "width=400, height=375 ");
}

// this function decides which 'navigation icon' to display on the page
// the navigation icon represents the icon the user clicked to get to 
// the current page and is used to let the user know where he is at all times

function navigationImage()
{
  var urlName = new String(window.location);
  var pageStrPointer = urlName.lastIndexOf("/");
  var pageNameString = urlName.substr(pageStrPointer);

  if (pageNameString == "/home.htm")   
   { 
      document.write( " <img src='../images/home.gif' onmouseup='loadNavBarHome()' alt='welcome to the Cosmic Closet home page' width='31' height='29' /> " );
   };   
    
  if (pageNameString == "/rechome.htm") 
   { 
     document.write( "<img src='../images/lp.gif' onmouseup='loadNavBarRecords()' alt='welcome to the records home page'         width='32' height='32' /> ")
   };
   
  if (pageNameString == "/audhome.htm") 
   {
     document.write( "<img src='../images/recrdr1.gif' onmouseup='loadNavBarRareRecordings()' alt='welcome to the rare recordings home page' width='31' height='32' />")
   };
  
  if (pageNameString == "/vidhome.htm") 
   {
     document.write( "<img src='../images/vidcam02.gif' onmouseup='loadNavBarVideos()' alt='welcome to the videos home page '         width='31' height='31' /> ")
   };
  
  if (pageNameString == "/maghome.htm") 
   {
     document.write( "<img src='../images/newspap2.gif' onmouseup='loadNavBarMagPaper()' alt='welcome to the magazines and papers home page' width='32' height='32' ")
   };
  
  if (pageNameString == "/conv.htm")    
   {
     document.write( "<img src='../images/wand2.gif'  onmouseup='loadNavBarVideoConv()'    alt='welcome to the video conversions home page'    width='32' height='32' /> ")
   };
  
  if (pageNameString == "/about.htm")    
   {
     document.write( "<img src='../images/peace.gif'  onmouseup='loadNavBarAbout()'    alt='welcome to the Cosmic Closet About page'    width='32' height='32' /> ")
   };

if (  pageNameString == "/ordering.htm" || pageNameString == "/ordering.htm#audio" || pageNameString == "/ordering.htm#video")    
   {
     	document.write( "<img src='../images/clipbrd.gif'  onmouseup='loadNavBarOrdering()'    alt='welcome to the ordering instructions page'    width='24' height='30' /> ")
   };
   
if (pageNameString == "/shipping.htm")    
   {
     document.write( "<img src='../images/usmail2.gif'  onmouseup='loadNavBarShipping()'    alt='welcome to the shipping page'    width='37' height='61' /> ")
   };

if (pageNameString == "/guarantee.htm")    
   {
     document.write( "<img src='../images/check3.gif'   onmouseup='loadNavBarGuarantee()'   alt='welcome to the Cosmic Closet guarantee page'    width='32' height='31' /> ")
   };

if (pageNameString == "/auctions.htm")    
   {
     document.write( "<img src='../images/gavel.gif'    onmouseup='loadNavBarAuctions()'  alt='welcome to the auctions how to page'    width='27' height='25' /> ")
   };
if (pageNameString == "/wantlist.htm")    
   {
     document.write( "<img src='../images/moon.gif'    onmouseup='loadNavBarWantlist()'  alt='welcome to the want list page'    width='32' height='32' /> ")
   };

if (pageNameString == "/shitlist.htm")    
   {
     document.write( "<img src='../images/paproll.gif'  onmouseup='loadNavBarShitlist()'    alt='welcome to the sh*t list page'    width='33' height='32' /> ")
   };

if (pageNameString == "/links.htm")    
   {
     document.write( "<img src='../images/target.gif'   onmouseup='loadNavBarLinks()'   alt='welcome to the links page'    width='31' height='31' /> ")
   };
 
}


// the NavBar is located to te right of the Navigation icon
// its use is not as a navigation bar as such, the icons above are for that
// an icon is loaded into the navbar to indicate to the user where hw is at all times
// we use this nav bar to display a responce to the user clicking on the navigation icon.
// usage of the DOM allows us to access the text using the getElementById function
// ith id 'navbartext is assigned to the <p> element , hence its first child is the text object
// whose data property is what we change
function loadNavBarHome()
 {
  document.getElementById('navbartext').firstChild.data = "Welcome to the Cosmic Closet Home Page!";
 }
function loadNavBarRecords()
 {
  document.getElementById('navbartext').firstChild.data = "Welcome to the Cosmic Closet Records Page!";
 }
function loadNavBarRareRecordings()
 {
  document.getElementById('navbartext').firstChild.data = "Welcome to the Cosmic Closet Rare Recordings Page!";
 }
function loadNavBarVideos()
 {
  document.getElementById('navbartext').firstChild.data = "Welcome to the Cosmic Closet Video Page!";
 }
function loadNavBarMagPaper()
 {
  document.getElementById('navbartext').firstChild.data = "Welcome to the Cosmic Closet Magazines and Music Papers Page!";
 }
function loadNavBarVideoConv()
 {
  document.getElementById('navbartext').firstChild.data = "Welcome to the Visions Imaging at the Cosmic Closet!";
 }

function loadNavBarAbout()
 {
  document.getElementById('navbartext').firstChild.data = "ABOUT the Cosmic Closet";
 }
function loadNavBarOrdering()
 {
  document.getElementById('navbartext').firstChild.data = "How to Order from the Cosmic Closet";
 }
function loadNavBarShipping()
 {
  document.getElementById('navbartext').firstChild.data = "Shipping Terms at the Cosmic Closet";
 }
function loadNavBarGuarantee()
 {
  document.getElementById('navbartext').firstChild.data = "the Cosmic Closet Guarantee";
 }
 function loadNavBarAuctions()
  {
   document.getElementById('navbartext').firstChild.data = "How Auctions work at the Cosmic Closet";
 }
 function loadNavBarWantlist()
  {
   document.getElementById('navbartext').firstChild.data = "the Cosmic Closet Want List";
 }
 function loadNavBarShitlist()
  {
   document.getElementById('navbartext').firstChild.data = "the Sh*t List!";
 }
 function loadNavBarLinks()
  {
   document.getElementById('navbartext').firstChild.data = "Welcome to the Cosmic Closet Links Page";
 }


// this is the actual javascript generated XHTML follows
document.write( " <table width='100%'> " ); 
document.write( " <thead> " );
 document.write( " <tr> " );
  document.write( " <th width= '12%' valign='middle'> " );
  document.write( " <img src='../images/door.jpg'   alt='cosmic closet door' width='75' height='120'  /> " );
  document.write( " </th> " );


   document.write( " <th width= '11%' valign='middle'> " );
   document.write( " <img src='../images/home.gif'  onmouseup='loadCosmicClosetHomePage()' alt='home' width='31' height='29'  /> " );
    document.write( " <br /> <a href='../home/home.htm'>home</a> " ); 
   document.write( " </th> " );
 
  document.write( " <th width= '11%' valign='middle'> " );
   document.write( " <img src='../images/lp.gif' onmouseup='loadRecordHomePage()' alt='records' width='32' height='32' /> " );
   document.write( " <br /><a href='../records/rechome.htm'>records</a> " );
  document.write( " </th> " );


document.write( " <th width= '11%' valign='middle'> " );
  document.write( " <img src='../images/recrdr1.gif' onmouseup='loadRareRecordingsHomePage()'  alt='rare recordings' width='31' height='32' /> " );
  document.write( "<br /> <a href='../audio/audhome.htm'>rare recordings</a> " ); 
  document.write( " </th> " );

// SEPT 2009  COMMENT OUT VIDEOS
//  document.write( " <th width= '11%' valign='middle'> " );
//  document.write( " <img src='../images/vidcam02.gif'  onmouseup='loadVideoHomePage()' alt='videos' width='31' height='31' /> " );
//  document.write( " <br /> <a href='../videos/vidhome.htm'>  videos  </a> " );
// document.write( " </th> " );

// SEPT 2009  COMMENT OUT PAPERS
//  document.write( " <th width= '11%' valign='middle'> " );
//  document.write( " <img src='../images/newspap2.gif' onmouseup='loadMagPaperHomePage()'  alt='magazines and papers' width='32' height='32' /> " );
//  document.write( " <br /> <a href='../paper/maghome.htm'>paper</a> " ); 
//  document.write( " </th> " );

// SEPT 2009 COMMENT OUR VID CONVERSIONS
//  document.write( " <th width= '11%' valign='middle'> " );
//  document.write( " <img src='../images/wand2.gif'  onmouseup='loadVideoConversionHomePage()' alt='video conversions' width='32' height='32' /> " );
//  document.write( " <br /> <a href='../videos/conv.htm'>video conversions</a> " );
//  document.write( " </th> " );

  document.write( " <th width= '11%' valign='middle'> " );
  document.write( " <img src='../images/mailbox1.gif'  onmouseup='loadMailPage()' alt='send e-mail' width='29' height='34' /> " );
  document.write( " <br /> <small> click on the mailbox to send an e-mail </small>" );
  document.write( " <br /> &nbsp" );
  document.write( " </th> " );

// SEPT 2009 COMMENT OUR TOGGLE BACKGROUND
// document.write( " <th width= '11%' valign='middle'> " );
//   document.write( "<img src='../images/slide2.gif' onmouseup='bgImageToggle()' alt='change theme' width='27' height='25' /> " );
//   document.write( " <br /> &nbsp" );
//   document.write( " </th> " );

document.write( " </thead> " );
document.write( " </table> " );

document.write( " <table> " );
document.write( " <tr> " );
// 8/2002 CHANGE BEGIN
////THIS HASE BEEN COMMENTED OUT SO ANY CALLERS WILL NOT DISPLAY THE BACK ARROW
//there is a problem when users last link was below and he used TOP arror, then
//using the back right arrow takes him down the same page again.. anyway
//navigation is quite simple using the top icons
//the following cell has the back arrow in it
//THE NAVIGATION ICON WAS MOVED INTO THIS CELL
//  8/2002 END CHANGE
// since this arrow is on all pages, the toparrow functions are not loaded in each page to speed up pages 
 document.write( " <th height='30pt' width='10%'> " );
// COMMENTED 8/2002 document.write( " <img src='..//images/warrowback.gif' onmouseup='history.back()' align='left'  alt='back' width='43' height='33'  /> " ); 
 navigationImage(); //ADDED 8/2002
 document.write( " </th> " );   
 
  // the following row displays the navagation image
 document.write( " <th height='30pt' width='10%'> " );
 //COMMENTED 8/2002 navigationImage();
 document.write( " </th> " );   
  
 // the following row is a padder
  document.write( " <th height='30pt' width='5%'> " );
  document.write( " &nbsp " );  
  document.write( " </th> " );   
 
 document.write( " <th colspan='8' width='75%'> " );
  // below is for usage of DOM to access the text of the <p> element for dynamically assigning text
 document.write( "   <h2> <p class='navbar' name='navbartext' id='navbartext'>  &nbsp  </p> </h2> " );
 document.write( " </th> " );
 
document.write( " </table> " );


};  //end of if page begins with fam
