<!--

// *** Price Specials ***
// see lines 310, 364
// see also cart.js
 var wlspl = 25
 var hsspl = 10

var itemList = new Array()
var listText = ''
var itemType = ''
var pp1 = 0; var pp2 = 0; var pp3 = 0
var f1 = 0; var f2 = 0
var numOfPriceBoxes = 1
var helpItem = 1

// 'd' is name of text box, contains the text to search for
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 = "../sr/search.html"
}

function toggleCounter (x) {

  if (x == 'on') { document.getElementById('counter').className = 'showCount' }
  if (x == 'off') { document.getElementById('counter').className = 'hideCount' }
}

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(page) {

  var text = '<div id="logo">'
         + '<a class="pics" href="../../index.html" title="Headset Factory Logo">'
	     + '<img src="../pics/logo.jpg" /></a>'
         + '<img id="flag2" class="flag" src="../pics/flag.jpg" title="Canadian Dollars">'
         + '<img id="flag1" class="flag" src="../pics/flag.jpg" title="Canadian Dollars">'
         + '</div>'

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

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

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

         + '<div class="icons items">'
         + '<a class="pics" href="../cart.html" title="Display Shopping Cart">Items<br />'
	     + '<script type="text/javascript">numberOfItems()</script>'
		 + '<br />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" src="../pics/go.gif"></a>'
		 + '</form></div>'

  // write what we have so far...
  document.write(text)
		 
  // build product page list
  var entry = '<div id="pageTextBox"><p id="text1">'		 
  var pgList = 'Wireless,Corded,Computer,'
             + 'Accessories,'
			 + 'wb,cd,co,ac'		 
  var pgArray = pgList.split(",");				 
  for (i = 0; i < 4; i++) {
    var pgName = pgArray[i];
	var titleText = 'Display ' + pgName + ' Product Page' 
    var pg = pgArray[i + 4]
    var start = '<a class="pageList" href="../'
    var end = pg + '/' + pg + '.html" title="' + titleText + '">'
    var anchor = start + end
    if (pg == page) { anchor = '<a class="currentPage">' }
    entry += anchor + pgName + ' </a>'
	if (i == 4) { entry += '<br />' }
  }		
  document.write(entry + '</p></div></div>')  
}

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 />'
//           + '<p id="messageBox" class="hideMe">Item(s) placed in Shopping Cart</p><br />'
		   
  document.write(text)
}

function checkURL(name) {

  var paraName = 'item'
  paraName = paraName.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]" + paraName + "=([^&#]*)";
  var regex = new RegExp(regexS);
  var paraValue = regex.exec(window.location.href);
  if (paraValue == null) { return }
  if (paraValue[1] == 'chk') { return paraValue[1] }
  document.cookie = name + '=' + paraValue[1] + '; path=/'
}

function lastView(page, x) {

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

function control(page, x) {

  if (!x || x == 'null' || x == 0) { x = 1 }

  // get and display description and prices
  document.getElementById('des').innerHTML = getDescription(x)
  
  // set horiz price position by changing class
  // numOfPriceBoxes is set in priceTable()
  var prodItem = 'item' + x
  newClass(numOfPriceBoxes, prodItem, page) 
  
  // get pic file name and diplay pic
  // info[] defined in 'page'.js file
  var itemInfo = info[x];    
  var itemArray = itemInfo.split(",");
  document.images.picture.src = itemArray[0]
  if (page == 'ac' || page == 'sp') { displayPicLabels(x) }
   
  // cookie current page
  lastView(page, x)
  
  // blink message text - see 345
  blinkCount = 0
  clearTimeout(t)
  blink()
  
  return
}

function newClass(x, y, page) {

  // change class to reposition price boxes 
  if (x == 2) { document.getElementById('priceBox').className = 'priceBox2' }
  if (x == 3) { document.getElementById('priceBox').className = 'priceBox3' }
  
  // change class to display current prod item in highlighted colour 
  var name = 'lastViewed' + page
  var c = 'item' + GetCookie(name)
  document.getElementById(c).className = 'prodList' 
  document.getElementById(y).className = 'currentItem' 
}

function showCords(yy) {

  if (yy != 'gn' && yy != 'pl') { return }
  if (yy == 'gn') { var x = 1 }
  if (yy == 'pl') { var x = 3 }
  document.cookie = 'lastViewedac=' + x + ';null;path=/'
  window.location.href = '../ac/ac.html'
}

function helpInfo(x) {

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

function priceLevel() {

  var y = GetCookie('priceLevel')
  if (!y || y == 1) { document.cookie = 'priceLevel=2;;path=/' }
  else { document.cookie = 'priceLevel=1;;path=/' }
  window.location.reload(false)
}

function buildList(prodNum, bullets) {

  var items = ''; i = 1
  
  // itemList array is filled in 'page' .js file
  for (i == 1; i <= bullets; i++) {
    items += '<li>' + itemList[i] + '</li>'
  }
  var text = '<div id="itemTxt"><ul>' + items + '</ul></div><br />'

  return text
}

function priceTable(x, page) {

  itemType = ''
  var itemInfo = info[x];   // info[] defined in 'page'.js file
  var itemArray = itemInfo.split(",");
	
  if (page != 1 && page != 2 && page != 3) { page = 0 }
  if (page == 3) {
    page = 0
    var picPath = itemArray[0]
	var picPathArray = picPath.split('/')
	if (picPathArray[2] == 'pl') { page = 2 }
  }	
 
  var xx = itemArray[1];
  if (!xx || xx == 0) { xx = 1 }
  numOfPriceBoxes = xx
	
  pp1 = itemArray[2]; 
  p1 = getPrice(pp1)
	  
  ppp2 = itemArray[3]; 
  pp2 = getPrice(ppp2); 
  p2 = parseInt(p1) + parseInt(pp2)
  if (page == 1) { p2 = pp2 }
	  
  ppp3 = itemArray[4]; 
  pp3 = getPrice(ppp3); 
  p3 = parseInt(p1) + parseInt(pp3)
  if (page == 1) { p3 = pp3 }
	  
  t1 = itemArray[5]; 
  t2 = itemArray[6]; 
  t3 = itemArray[7];
	
  f1 = itemArray[8]; 
  f2 = itemArray[9];

  var addCart = '<button class="buyButton" title="Place item in Shopping Cart" '
  text = '<div id="priceBox" class="priceBox1">'
       + '<div class="cart"><a href="../cart.html" title="Display Shopping Cart">' 
       + '<img border="0" src="../pics/cart1.gif" /></a></div>'
	   
       + '<div class="pBox">' + t1 
	   + '<p class="price">$' + p1 + '</p>'
	   + addCart + 'onclick="AddToCart(pp1,0,0)">Put in Cart</button>'
	   + '</div>'

  if (xx == 2 || xx == 3) {	
    var addParam = 'onclick="AddToCart(pp1,f1,0)"'
    if (page == 1) { addParam = 'onclick="AddToCart(ppp2,0,0)"' }  
    text += '<div class="pBox">' + t2
          + '<p class="price">$' + p2 + '</p>'
          + addCart + addParam + '>Put in Cart</button>'
          + '</div>'
  }
  if (xx == 3) {		  
    var addParam = 'onclick="AddToCart(pp1,0,f2)"'
    if (page == 1) { addParam = 'onclick="AddToCart(ppp3,0,0)"' }  
    text += '<div class="pBox">' + t3
	      + '<p class="price">$' + p3 + '</p>'
          + addCart + addParam + '>Put in Cart</button>'
	      + '</div>'
  }
  text += '<div class="cart" ><a href="../cart.html" title="Display Shopping Cart">' 
        + '<img border="0" src="../pics/cart2.gif" /></a>'
	    + '</div></div>'
  
  // display specials message (also top, 364)
  var messText = '** Discount prices on Wireless and Corded headsets **'
  if (itemType == 'wl') { 
    messText = '** Discount. A $' + wlspl + ' discount will be applied in Shopping Cart **'				
  }
  if (itemType == 'hs') {   
    messText = '* Discount. $' + hsspl + ' off each headset and amp applied in Cart *'
	if (t1 == 'GN 1000' || t1 == 'CS Lifter' || t1 == 'Savi Lifter' || 
	    t1 == 'PL V-Pro' || t1 == 'PL 975' || t1 == 'PL 835') {
      messText = '** Discount. A $' + hsspl + ' discount will be applied in Shopping Cart **'				
	}	 
  }
  message = '<p id="spMess" class="message">' + messText + '</p>'
  
  helpItem = 1
  if (itemArray[6] == 'w/ Amp') { helpItem = 10 }
  if (itemArray[6] == 'w/ Lifter') { helpItem = 12 }

  var howToLink = '<a class="grayLink">' 
  if (helpItem > 1) { 
    howToLink = '<a class="infoLink" href="javascript:helpInfo(helpItem)" '
              + 'title="Display Help Info on Headset Selection">' 
  } 
  howTo = '<p class="link" id="howTo">How to...' + howToLink
  	    + '&#160;&#160;Select a Headset</a>' + "&#160;/&#160;"
        + '<a class="infoLink" href="javascript:helpInfo(15)" '
        + 'title="Display Help Info on Price Quotes">' 
  		+ 'Print a Quote</a></p>'
			
  var text1 = message + text + howTo
  return (text1)
}

// -------- blink message text - initiated line 182 ------

  var blinkCount = 0; var t
function blink() {	
  clearTimeout(t)
  var cc = document.getElementById('spMess').style.visibility
//  if (itemType != 'wl' && itemType != 'hs') { return }
  if (cc == 'visible') { 
	document.getElementById('spMess').style.visibility = 'hidden'
  } else {
    document.getElementById('spMess').style.visibility = 'visible' 
  }
  t = setTimeout('blink()', 400)
  blinkCount += 1
  if (blinkCount == 7) { blinkCount = 0; clearTimeout(t) }
}

// ----- Get and display item price -------

function getPrice(item) {

  if (item == 0) { return }
  var itemInfo = GetItemInfo(item)
  var itemArray = itemInfo.split(",");
  var type = itemArray[0]
  if (type == 'wl') { itemType = 'wl' } // used to display specials message (also top, 310)
  if (type == 'hs' && itemType != 'wl') { itemType = 'hs' } // used to display specials message
  var price = itemArray[3];  // web pricing is 2, instore is 3
  
  return (price)
}

// -------- Item Info Database ----------

function GetItemInfo(Index) {

  // GN Netcom
  if (Index < 1000) {
    idx = new Array()
 
    idx[1] = "wl,Jabra GN 9125NC wireless system w/ noise cancel headset,375,360"
    idx[2] = "wl,Jabra GN 9125 Duo binaural noise cancel wireless headset,395,375"
    idx[3] = "wl,Jabra GN 9330e wireless system for use w/ phone set,380,350"
    idx[4] = "wl,Jabra GN 9330 USB wireless system for use w/ computer,380,345"
    idx[5] = "wl,Jabra GN 9350e wireless system for use w/ phone and computer,445,425"
    idx[6] = "wl,Jabra Pro 9460 convertible wireless headset system,475,435"
    idx[7] = "wl,Jabra Pro 9460 Duo binaural wireless headset system,495,435"

    idx[21] = "hs,Jabra GN 2010ST monaural sound tube headband headset,,98"
    idx[22] = "hs,Jabra GN 2020NC monaural noise cancel headband headset,,130"
    idx[23] = "hs,Jabra GN 2015ST binaural sound tube headset,,140"
    idx[24] = "hs,Jabra GN 2025NC binaural noise cancel headset,,150"
	
    idx[25] = "hs,Jabra GN 2110ST monaural sound tube headset w/ headband,115,98"
    idx[26] = "hs,Jabra GN 2120NC monaural noise cancel headset w/ headband,150,130"
    idx[27] = "hs,Jabra GN 2115ST binaural sound tube headset,140,120"
    idx[28] = "hs,Jabra GN 2125NC binaural noise cancel headset,175,148"
    idx[29] = "hs,Jabra GN 2117ST monaural sound tube headset w/ ear hook,120,98"
    idx[30] = "hs,Jabra GN 2127NC monaural noise cancel headset w/ ear hook,150,130"
    idx[31] = "hs,Jabra GN 2124NC monaural 4-in-1 noise cancel headset,175,152"
    idx[32] = "hs,Jabra GN 2119ST monaural 3-in-1 sound tube headset,140,135"
    idx[33] = "hs,Jabra Biz 2400 monaural 3-in-1 noise cancel headset,175,170"
    idx[34] = "hs,Jabra Biz 2420 monaural noise cancel headband headset,175,165"
    idx[35] = "hs,Jabra Biz 2425 binaural noise cancel headset,190,180"

    idx[51] = "hs,Jabra GN 8000 multi-purpose amplifier,145,135"
    idx[52] = "hs,Jabra GN 8050 phone/computer switching amplifier,145,135"
    idx[53] = "hs,Jabra GN 1000 remote handset lifter,115,98"
    idx[54] = " "
    idx[55] = "hs,Jabra GN 8110 USB computer headset adaptor,130,115"
    idx[56] = "cd,Jabra GN 1200 Smart Cord - direct connect adaptor cord,45,35"
    idx[57] = " "
    idx[58] = "cd,Jabra GN extention cord,45,35"
    idx[59] = "ac,Jabra GN 2.5mm adaptor cord,25,18"
    idx[60] = "ac,Jabra GN 2.5mm adaptor cord with extention,62,53"
    idx[61] = " "
    idx[62] = "cd,Jabra GN supervisor Y cord,50,40"
    idx[63] = "ac,Replacement lower cord for Jabra MPA amplifier,45,35"
    idx[64] = "ac,Replacement lower cord for Jabra GN 8000 amplifier,45,35"
    idx[65] = "ac,Replacement battery for Jabra GN 9120 series,40,35"
    idx[66] = "ac,Replacement battery for GN Netcom 9300 Series,50,45"
  }

  // Plantronics
  if (Index > 1000) {
  Index -= 1000
  idx = new Array()

    idx[1] = "wl,Plantronics CS55 1.9ghz wireless headset system,365,345"
    idx[2] = "wl,Plantronics CS70N wireless system w/ earbud headset,395,360"
    idx[3] = "wl,Plantronics Savi WO100 wireless convertible headset,425,395"
    idx[4] = "wl,Plantronics Savi WO200 wireless on-ear headset,425,395"
    idx[5] = "wl,Plantronics CS351N monaural wireless w/ noise cancel headset,395,360"
    idx[6] = "wl,Plantronics CS361N binaural wireless w/ noise cancel headset,405,375"
    idx[7] = "wl,Plantronics CS50 USB wireless headset system for computer,385,360"
    idx[8] = " "
    idx[9] = "hs,Plantronics Voyager Pro bluetooth headset,135,115"
    idx[10] = "hs,Plantronics Discovery 975 bluetooth headset,145,145"
    idx[11] = "ac,Plantronics Explorer 390 bluetooth headset,75,70"
    idx[12] = "hs,Plantronics Voyager 835 bluetooth headset,0,110"
    idx[13] = "wl,Plantronics Savi WO300 wireless headband headset,425,410"
    idx[14] = "wl,Plantronics Savi WO350 wireless binaural headset,425,430"

    // supra, encore series stared at index 21
    idx[31] = "hs,Plantronics H81N Tristar ear bud noise cacnel headset,165,140"
    idx[32] = "hs,Plantronics H141N Duoset monaural noise cancel 2-in-1 headset,130,125"
    idx[33] = " "
    idx[34] = "hs,Plantronics H171N DuoPro monaural noise cancel 2-in-1 headset,165,150"
    idx[35] = "hs,Plantronics H251 SupraPlus monaural voice tube headset,120,100"
    idx[36] = "hs,Plantronics H251N SupraPlus monaural noise cancel headset,135,118"
    idx[37] = "hs,Plantronics H261 SupraPlus binaural voice tube headset,135,115"
    idx[38] = "hs,Plantronics H261N SupraPlus binaural noise cancel headset,155,135"

    idx[60] = "hs,Plantronics HL10 Lifter for Savi series wireless,115,95"
    idx[61] = "hs,Plantronics HL10 Lifter for CS series wireless,115,95"
    idx[62] = "ac,Plantronics Online indicator for CS series wireless,45,35"
    idx[63] = "hs,Plantronics DA60 USB computer adaptor,185,155"
    idx[64] = "hs,Plantronics M22 multi-purpose amplifier,150,135"
    idx[65] = "hs,Plantronics MX10 phone/computer switcher amplifier,,210"
    idx[66] = "ac,Plantronics Online indicator for Savi series wireless,45,35"
    idx[67] = "cd,Plantronics direct connect A10 cord,60,50"
    idx[68] = "cd,Plantronics extention cord,45,35"
    idx[69] = "ac,Replacement battery for Plantronics CS55,50,50"
    idx[70] = "ac,Plantronics 2.5mm adaptor cord,25,18"
    idx[71] = "cd,Plantronics 2.5mm adaptor cord with extention,65,53"
    idx[72] = "cd,Plantronics supervisor Y cord,60,50"
    idx[73] = "ac,Replacement lower cord for Plantronics M12 amp,45,35"
    idx[74] = "ac,Replacement short cord for Plantronics M12 amp,15,10"
    idx[75] = "ac,Plantronics foam wind screen,4,3"
    idx[76] = "ac,Plantronics foam ear cushion,4,3"
    idx[77] = " "
    idx[78] = " "
    idx[79] = "ac,Plantronics 29960-01 voice tube for Tristar Encore etc,10,8"
    idx[80] = "ac,Plantronics 17593-01 voice tube for Supra & Mirage,10,8"
    idx[81] = "ns,Plantronics 18709-01 2-prong to modular adaptor,10,20"

  }
	data = idx[Index];
	return (data)
}

//-->

