<!--

var itemList = new Array()
var listText = ''

// refresh num of items in cart (1000 = 1 sec)
function reFresh() { 
  var x = document.getElementById('numItems')
  if (x) { numberOfItems() }
}  
window.setInterval("reFresh()", 1000);

function embedVideo() {
  var text = ''
  text = '<OBJECT classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="250" '
       + 'height="300" codebase="http://www.apple.com/qtactivex/qtplugin.cab">'
	   + '<param name="src" value="movie.mov">'
	   + '<param name="autoplay" value="true">'
	   + '<param name="controller" value="false">'
	   + '<param name="loop" value="false">'
	   + '<EMBED src="movie.mov" width="250" height="300" '
	   + 'href="store/wb/wb.html?item=21" '
	   + 'target="_self" '
	   + 'autoplay="true" controller="false" loop="false" '
	   + 'pluginspage="http://www.apple.com/quicktime/download/">'
	   + '</EMBED></OBJECT>'
  
    document.write(text)
//  document.getElementById('indImage').innerHTML = text    
}

// 'd' is name of text box
function search_form() {

  var text = document.jse_Form.d.value
  var xx = text.length
  document.cookie = 'd=null; path=/'
  if (xx > 0) { document.cookie = "d=" + text + "; path=/" }
  window.location.href = "store/sr/search.html"
}

function maleUs() {

  a = '<a id="email" hre'; b = 'f="mai'; c = 'lto:'; d = 'sales@'; e = 'etfacto'
  var text = a + b + c + d + 'heads' + e + 'ry.com'
      + '?subject=Online Inquiry&body= ">'
  document.write(text)
  var text =  d + 'heads' + e + 'ry.com</a>'
  document.write(text)
}

function fonUs(x) {

  if (x == 1) { 
    a = '40'; b = '26'; c = '7'; d = '3'; e = '6'
    var text = a + d + '-5' + c + '1-3' + e + b
  }
  if (x == 2) { 
    a = '58'; b = '7'; c = '88-6'; d = '9'; e = '07'
    var text = '8' + c + e + '-' + a + '7' + d
  }
  if (x == 3) { 
    a = '0-2'; b = '00-'; c = '35'; d = '2'; e = '8'
    var text = e + b + '39' + a + d + c
  }
  document.write(text)
}

function siteExit() {

  var x = 0 - history.length
  history.go(x)  
}

function searchKey(e) {

  var key = window.event ? e.keyCode : e.which

  // trap alpha upper case key presses
  if (key >= 65 && key <= 90) { return }  

  // trap alpha lower case key presses
  if (key >= 97 && key <= 122) { return }  

  // trap keyboard and num pad key presses
  if (key >= 48 && key <= 57) { return }  

  // trap space key press
  if (key == 32) { return }  

  // trap enter key press
  if (key == 13) { search_form() }  

  return false  
}

function displayHeader() {

  var text = '<div id="logo">'
         + '<a class="pics" href="index.html" title="Headset Factory Company Logo">'
	     + '<img src="store/pics/logo.jpg" /></a></div>'

	     + '<div id="iconBox">'
         + '<div class="icons">'
         + '<a class="pics" href="index.html" title="Display Headset Factory Home Page">'
	     + '<img src="store/pics/house.gif" /><br />'
	     + 'Home</a></div>'

         + '<div class="icons">'
         + '<a class="pics" href="javascript:helpInfo(24)" title="Display Contact Page">'
	     + '<img src="store/pics//mail.gif" /><br />'
	     + 'Contact</a></div>'

         + '<div class="icons">'
		 + '<a class="pics" href="ch.html" title="Display Help Page">'
	     + '<img src="store/pics/help.gif" /><br />'
	     + 'Help</a></div>'

         + '<div class="icons">'
		 + '<a class="pics" href="sl.html" title="Display Site Map/Links Page">'
	     + '<img src="store/pics/globe.gif" /><br />'
		 + 'Map/Links</a></div>'

         + '<div class="icons items">'
         + '<a class="pics" href="store/cart.html" title="Display Shopping Cart">Items'
	     + '<span id="numItems">0</span>in Cart</a></div>'

		 + '<div id="searchBox">'
		 + '<form name="jse_Form" onsubmit="return false">'
         + '<input type="text" name="d" size="18" id="search" value="Search" '
         + 'onFocus="this.value=&quot;&quot;" onkeypress="return searchKey(event)">'
         + '<a href="javascript:search_form()">'
         + '<img id="goPic" border="0" src="store/pics/go.gif"></a>'
		 + '</form></div>'

		 + '<div id="pageTextBox">'
         + '<p id="text1">'
	     + '<a class="pageList" href="store/wb/wb.html" title="Wireless Headset Page">Wireless </a>'	     
		 + '<a class="pageList" href="store/cd/cd.html" title="Corded Headset Page">Corded </a>' 
 
	     + '<a class="pageList" href="store/co/co.html" title="Computer Headset Page">Computer </a>'
		 + '<br />' 
	     + '<a class="pageList" href="store/ac/ac.html" title="Accessories Page">Accessories</a>'
         + '</p></div></div>'

  document.getElementById('header').innerHTML = text
}

function displayFooter() { 

  // get current year
  var d = new Date()
  var year = d.getFullYear()
  var text = '<br />Photos derived from stock photos obtained from manufacturer '
		   + 'web sites. All logos copyright by the respective companies.<br />'
		   + 'This site design, layout, company logo, content copyright ' 
           + year + ' by Headset Factory.<br /><br />'
  
  document.write(text)
}

// ---------- Display # of items in cart ------------

function numberOfItems() { // used to display # of items in cart
  var num = GetCookie("NumberOrdered")
  if (!num || num == null) { num = 0 }
  document.getElementById("numItems").innerHTML = num
  return
}

// ---------- Execute site map selection ------------

function siteMap(mapPage, mapItem) {

  var cookName = 'lastViewed' + mapPage
  var newPage = 'store/' + mapPage + '/' + mapPage + '.html'
  document.cookie = cookName + '=' + mapItem + '; path=/'
  self.location.href = newPage
}

//---------------- Get last viewed product item ------------------

function lastHelpView(page, x) {

  var name = 'lastViewed' + page
  var c = GetCookie(name)
  if (!c || c == null) { document.cookie = 'lastViewed' + page + '=1; path=/' }
  if (x == 0) { c = GetCookie(name); control(page, c) }
  if (x > 0) { document.cookie = 'lastViewed' + page + '=' + x + '; path=/' }
}

function control(page, x) {  

  document.getElementById('topicTextBox').innerHTML = getDescription(x)
  
  // change class to display current prod item in highlighted colour 
  var name = 'lastViewed' + page
  var c = 'item' + GetCookie(name)
  var y = 'item' + x
  document.getElementById(c).className = 'chTopicItem' 
  document.getElementById(y).className = 'chCurrentItem' 
 
  lastHelpView(page, x)
  return
}

function helpInfo(x) {

  document.cookie = 'lastViewedch=' + x + '; path=/'
  window.location.href = 'ch.html'  
}

// -------- blink 'special' pic - initiated in index body tag ------

  var blinkCount = 0; var t
function blinkIt() {	

return

  clearTimeout(t)
  cc = document.getElementById('splPic').style.visibility
  if (cc == 'hidden') { 
	document.getElementById('splPic').style.visibility = 'visible'
    } else {
	document.getElementById('splPic').style.visibility = 'hidden'
  }
  t = setTimeout('blinkIt()', 500)
  blinkCount += 1
  if (blinkCount == 8) { blinkCount = 0; clearTimeout(t) }
}

// ------------------- Highlight Current Topic --------------------

function newClass(y) {

  // change class to display current prod item in highlighted colour 
  var name = 'lastViewedch'
  var c = 'item' + GetCookie(name)
  document.getElementById(c).className = 'prodList' 
  document.getElementById(y).className = 'currentItem' 
}

// ------------------- Get cookie value --------------------

function GetCookie(Name) {

  var search = Name + "=";
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search);
    if (offset != -1) { // if cookie exists
      offset += search.length;  // set index of beginning of value
      end = document.cookie.indexOf(";", offset);  // index of end of value
      if (end == -1) end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end));
    }
  }
  return returnvalue;
}

// -------------------- Remove all cookies from user's computer ---------------------

function DeleteAllCookies() {         
  NumberOfOrders = 0
  NumberOfOrders = GetCookie("NumberOrdered")
  for (i = 1; i <= NumberOfOrders; i++) {
	document.cookie = "Order" + i + "=0; path=/; expires=Thu, 01-Jan-70 00:00:01 GMT"
  }
  document.cookie = "NumberOrdered=0; path=/; expires=Thu, 01-Jan-70 00:00:01 GMT"
  document.cookie = "optBut=; path=/; expires=Thu, 01-Jan-70 00:00:01 GMT"
  document.cookie = "chkBox=; path=/; expires=Thu, 01-Jan-70 00:00:01 GMT"
  document.cookie = "coupon=; path=/; expires=Thu, 01-Jan-70 00:00:01 GMT"
  return
}

-->
