﻿/*
var count = 0;
function Anthem_PreCallBack() { 
    count++;
    setTimeout("CallBackStarted()", 500); 
}
function Anthem_PostCallBack() { CallBackFinished(); }

function CallBackStarted() {
  if (count > 0){  
    var item = document.getElementById('wait');
    if ((!window.XMLHttpRequest) && (document.documentElement)){
      item.style.position = 'absolute';
      //code to make ie6 behave
      if (document.documentElement.scrollTop){
        item.style.top = document.documentElement.scrollTop + 15;
      }
      else{ item.style.top = 15; }      
      item.style.right = 15;
    }
    item.style.display = 'block';    
  }
}
 
function CallBackFinished(){
  count--;
  if (count == 0){
    var item = document.getElementById('wait');
    if (item != null){
        item.style.display = 'none';
    }
  }
}
*/

$(function() {
    $(".sidemenu a").each(function(i, a) {
        if (window.location.href.indexOf($(a).attr("href")) > 0)
            $(a).addClass("selected");
    });

    $(".product-menu ul ul").hide();

    $(".menu-trigger").click(function(e) {
        var ul = $(this).next().toggle("fast");
    });

    $("#search-submit").click(doSearch);

    $("#search-text").bind('keypress', function(e) {
        var code = e.keyCode || e.which;
        if (code == 13) doSearch();
    });
});
    
function doSearch(e) {
    if (e) e.preventDefault();
    window.location.href = '/search.aspx?keyword=' + encodeURIComponent($("#search-text").val());
    return false;
};


function GoToRegister() {
    var f = $("#regForm");
    
    if (f.length == 0) {
        var html = "<form id='regForm' action='http://67.51.125.164/net/EZ006' method='post'>";
        html += "<input type='hidden' name='XXUSER' value='WARRANTY' />";
		html += "<input type='hidden' name='XXPSWD' value='1499974' />";
		html += "<input type='hidden' name='XXRCSV' value='Y' />";
		html += "<input type='hidden' name='XXACTN' value='EZ048' />";
		html += "</form>";
		f = $(html);
		f.appendTo("body");
    }
    f.trigger("submit");
}
