/* 
Document: syncSupport.js
Purpose:  HPI Direct Local Connection support
Generate random number to assign to the local connection
Prevents local connection mix up if more than 1 browser of the same screen is up
Created:  04/MAY/2006
*/

var Found=false
var Current = new Array()
var MaxValue=1000 //(Example 2 is equal to: 0,1,2)
var NumUnique=1  //The number of unique numbers required
var Count=0
var Current = new Array(NumUnique)
GetUnique()

/*alert("The unique navID = " + Current[0])*/
sync_id = Current[0];
  function GetUnique(){
    for (i=0;Count<NumUnique;Count++){
      Found=false
      var rndValue = get_random()
      var j=0
      for (j=0;j<Current.length;j++){
        if (Current[j] == rndValue){
          Found=true
          break
        }
      }
      if (Found){
        Count--
      } else {
        Current[Count]=rndValue

      }
    }
  }
  function get_random(){
    var ranNum= Math.round(Math.random()*MaxValue);
    return ranNum;
  }
// End -->


/* 
Function: pageHistory()
Purpose:  HPI Direct hidden frame support. 
Usage:    When the browser is resized reload the current page in the top frame
          onresize called by the hiddenFrame.aspx
Created:  07/SEP/2006
*/
function pageHistory(n) {
	var pageURL = n;
	//alert("pageURL value passed = " + pageURL);
	switch(pageURL) {
	case 0 :
		curPage = "topFrame.aspx";
		break;
	case 1 :
		curPage = "experience.aspx";
		break;
	case 2 :
		curPage = "locations.aspx";
		break;
	case 3 :
		curPage = "supportCenter.aspx";
		break;
	case 4 :
		curPage = "merchandise.aspx";
		break;
	case 5 :
		curPage = "managedPrograms.aspx";
		break;
	case 6 :
		curPage = "customOrders.aspx";
		break;
	case 7 :
		curPage = "ourCustomers.aspx";
		break;
	case 8 :
		curPage = "contactUs.aspx";
		break;
	case 9 :
		curPage = "tour.aspx";
		break;
	default :
		break;
	}
}