//<SEOINTEL> 20060912: Used to create JavaScript links to pages on the site that we don't want to link directly and discourage spiders from following
function topwin(page) {
	window.location = page;
}
function statOn(page) {
	window.status = page;
}
function statOff() {
	window.status = ' ';
}
//</SEOINTEL>

function gup(name) {
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp(regexS);
  var tmpURL = window.location.href;
  var results = regex.exec(tmpURL);
  if(results == null) {
    return "";
  } else {
    return results[1];
  }
}

function deselectOthers(ignore, formName) {
  var f = document.getElementById(formName);
  for(i=0; i<f.length; i++) {
    if (f.elements[i] != ignore && f.elements[i].length > 1) {
      f.elements[i].value = f.elements[i].options.selectedIndex.value = '';
    }
  }
  return true;
}

function _getId(s) {
  var match = '([0-9]+)\]?$';
  var regex = new RegExp(match);
  var results = regex.exec(s);
  if(results == null) {
    return '';
  } else {
    return results[1];
  }
}

function salesAlerts() {
  var e = document.getElementById('salesAlert');
  e.style.visibility=(e.style.visibility=='hidden') ? 'visible' : 'hidden';
  if(e.style.visibility=='visible')document.sales_alerts.from.value='enter email address';
}


function liveHelpStatus()
{
  var ajaxLiveHelpStatus = new XMLHttp();
  ajaxLiveHelpStatus.sendRequest('livehelp_status.php', '');
  ajaxLiveHelpStatus.response = function()
  {
    if(ajaxLiveHelpStatus.http.status==200)
    {
      if(ajaxLiveHelpStatus.http.responseText==1)
      {
        document.getElementById('liveHelp').innerHTML='<a href="javascript:ShopTogether.preInitializeAndOpen(\'Customer\');">Live Help is Online</a> &nbsp;&nbsp;&nbsp;';
        if(document.getElementById('liveHelp_pi')) document.getElementById('liveHelp_pi').style.display='';
        setTimeout('liveHelpStatus();', 3000);
      }
      else
      {
        document.getElementById('liveHelp').innerHTML='';
        if(document.getElementById('liveHelp_pi')) document.getElementById('liveHelp_pi').style.display='none';
      }
    }
  }
}


function XMLHttp()
{
  this.createRequestObject = function()
  {
    if (typeof XMLHttpRequest == 'function')
    {
      return new XMLHttpRequest();
    }
    else if (window.ActiveXObject)
    {
      //var aVersions = ['MSXML2.XMLHttp.4.0','MSXML2.XMLHttp.3.0', 'MSXML2.XMLHttp','Microsoft.XMLHttp'];
      var aVersions = ['Microsoft.XMLHttp'];
      for (var i = 0; i < aVersions.length; i++)
      {
        try
        {
          return new ActiveXObject(aVersions[i]);
        }
        catch(e) {}
      }
    }
    throw new Error('XMLHttp object could be created.');
  }

  this.sendRequest = function(url, param, method)
  {
    method = (method) ? method.toUpperCase() : 'GET';
    if (method == 'GET')
    {
      url = url + '?' + param;
    }
    self.http.open(method, url, true);
    self.http.onreadystatechange = self.handleResponse;
    if (method == 'POST') self.http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    self.http.send((method == 'POST') ? param : null);
  }

  this.handleResponse = function()
  {
    if ((self.http.readyState == 4) && (typeof self.response == 'function')) self.response();
    if ((self.http.readyState == 1) && (typeof self.wait == 'function')) self.wait();
  }

  var self = this;
  this.http = this.createRequestObject();

  var response = null;
  var wait = null;
}


function bodyOnClick()
{
  if(typeof tracker.hideAll == 'function') tracker.hideAll();
  if(typeof refinableDisplayHide == 'function') refinableDisplayHide();
}



