		// This script is intended for use with a minimum of Netscape 4 or IE 4.
		// First we detect the browser type
		if(document.getElementById) { // IE 5 and up, NS 6 and up
			var upLevel = true;
			}
		    else if(document.layers) { // Netscape 4
			var ns4 = true;
			}
		    else if(document.all) { // IE 4
			var ie4 = true;
			}
		    function showObject(obj) {
			if (ns4) {
				obj.visibility = "show";
				}
			else if (ie4 || upLevel) {
				obj.style.visibility = "visible";
				}
			}
		    function hideObject(obj) {
			if (ns4) {
				obj.visibility = "hide";
				}
			if (ie4 || upLevel) {
				obj.style.visibility = "hidden";
				}
			}

function Popup(url,pagename,width,height) 
{
    if (pagename=='AddToCart')
    {
       props2=window.open(url,pagename,'toolbars=0, scrollbars=1, location=0, statusbars=0, menubars=0, resizable=1, width='+width+', height='+height+', left=440, top=180');
    }
    else
    {
       props2=window.open(url,pagename,'toolbars=0, scrollbars=1, location=0, statusbars=0, menubars=0, resizable=1, width='+width+', height='+height+', left=100, top=10');
    }
}		

function SupmitCategory(filt)
{
    var keycode;
    if (window.event) keycode = window.event.keyCode;
    else if (e) keycode = e.which;
    else return true;
    if (keycode == 13)
    {
    	document.location.href='/searchresults.aspx?adv=1&txtSearch='+document.getElementById('txtSearch3').value+' '+filt+'&sn='+document.getElementById('txtSearch3').value;
        return false;
    }
    else
        return true;
}

function SupmitBrand(vendorname)
{
    var keycode;
    if (window.event) keycode = window.event.keyCode;
    else if (e) keycode = e.which;
    else return true;
    if (keycode == 13)
    {
    	document.location.href='/searchresults.aspx?adv=1&txtSearch='+document.getElementById('txtSearch3').value+'&vendorname='+vendorname+'&sn='+document.getElementById('txtSearch3').value;
        return false;
    }
    else
        return true;
}
		
function SupmitVendorFilter2(vendorname)
{
	document.body.style.cursor='wait';				
    displayProgress();
  	document.location.href='/brands/default.aspx?b='+document.getElementById('VendorFilter2').value;
}

function Supmit()
			{
				document.body.style.cursor='wait';				
                displayProgress();
				document.location.href='/SearchResults.aspx?adv=1&txtSearch='+document.getElementById('txtSearch2').value+'&sn='+document.getElementById('txtSearch2').value;
			}
            var ProgressIndicator = new function()
            {
	            var _anchorId;
	            var _inProgress;
            	// ----------------------------------------------------------------	
	            function get_anchorId()         { return _anchorId; }
	            function set_anchorId(value)    { _anchorId = value; }
            	// ----------------------------------------------------------------	
	            function get_inProgress()       { return _inProgress; }
	            function set_inProgress(value)  { _inProgress = value; }
            	// ----------------------------------------------------------------
	            this.display = function(anchorId)
	            {
		            /* By default re-entrancy is not allowed. If you want to allow simultaneous Ajax calls, replace "return" below
		               with a call to this.hide(). */		   
		            if (get_inProgress())
			            return;		
		            var progress = document.getElementById ('progress-area');
		            var x = 0, y =0;
		            var h = 0, w = 0;
		            if (!progress)
		            {
			            progress = document.createElement ('div');
			            progress.setAttribute ('id', 'progress-area');			
			            progress.style.position     = 'absolute';
			            progress.style.border       = '1px solid #e0e0e0';
			            progress.style.zIndex		= 9999;			
			            document.body.appendChild (progress);		
		            }
            		if (!anchorId)
		            {
		                // I'm padding the image to make it noticeable
			            w = 130 + 40;
			            h = 60 + 40;
			            var scrollX = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft;
			            var scrollY = window.pageYOffset || document.documentElement.scrollTop  || document.body.scrollTop;			
			            var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
			            var windowWidth  = window.innerWidth  || document.documentElement.clientWidth  || document.body.clientWidth;			
			            x = Math.round (windowWidth/2 - w/2) + scrollX;
			            y = Math.round (windowHeight/2 - h/2) + scrollY;
		            }
		            else
		            {
			            var m = document.getElementById (anchorId);			
			            if (!m)
			            {
				            var msg = 'Unable to find an element with id=' + anchorId;
				            var err = new Error (msg);
				            if (!err.message) err.message = msg;
				            throw err;
			            }			
			            h = m.offsetHeight, w = m.offsetWidth;
			            var element = m;	
			            do {
				            y += element.offsetTop  || 0;
				            x += element.offsetLeft || 0;
				            element = element.offsetParent;
			            } while (element);
   		                m.style.visibility = 'hidden';
			            set_anchorId (anchorId);
		            }		
		            progress.style.background   = '#fff url(/loading.gif) 50% 50% no-repeat';
		            progress.style.width        = w + 1 + 'px';
		            progress.style.height       = h + 1 + 'px';
		            progress.style.left         = x + 'px';
		            progress.style.top          = y + 'px';
		            progress.style.display      = '';		
		            set_inProgress (true);
	            }	
	            // ----------------------------------------------------------------
	            this.hide = function()
	            {
		            if (!get_inProgress())
			            return;
	                var progress = document.getElementById ('progress-area');
		            if (progress) progress.style.display = 'none';
		            var anchorId = get_anchorId();
		            if(anchorId)
		            {
			            var m = document.getElementById (anchorId);
			            if (m) m.style.visibility = '';
		            }
		            set_anchorId (null);
       set_inProgress (false);
   }
}

function displayProgress(anchorId)
{
   /* This is only a simulation of a somewhat long callback. */
   ProgressIndicator.display(anchorId);	
}
            
function addSearchProvider()
{
    window.external.AddSearchProvider("/searchProviderXML.aspx");
}

function Logout(s)
{
    if (confirm(s) == true) 
    {
	    location.href = "logout.aspx";
	}
}
