// JScript source code
function menus()
{
	this.menus = new Array();
}


menus.prototype.add = function(mnu)
{
	try
	{
		this.menus[this.menus.length] = mnu;
	}
	catch(ex)
	{
//		alert(ex.message);
	}
}

menus.prototype.clear = function()
{
	try
	{
		for(var i=0; i < this.menus.length; i++)
		{
			this.menus[i].style.display = 'none';
		}
	}
	catch(ex)
	{
	}
}


menus.prototype.shoMenu = function(mnus,x,y)
{
	try
	{
	
	var mnuid = mnus;
	
	//if(mnus != '') mnuid = mnu.id;
	
	for(var i=0; i < this.menus.length; i++)
	{
		if(this.menus[i].id != mnuid) 
		{
			this.menus[i].style.display = 'none';
		}
		else
		{
		//	alert(document.body.offsetWidth);
			var newX = x;
			
			if(x < 0) 
			{
				newX = 10 + Math.round(document.body.offsetWidth / 8) * i;
				if(i > 3) newX -= 20;
			}
			//ogin.innerText = msg;
			this.menus[i].style.left = newX + "px";
			this.menus[i].style.right= y + "px";
			this.menus[i].style.display = 'block';
		}
	}
	
	}
	catch(ex)
	{
		//alert("LN127:" + ex.message);
	}
}

function reEval(mnu,evt)
{

	try{
	
		//if(!mnu.contains(window.event.toElement && mnu != par))
		if(!mnu.contains(window.event.toElement) && String(navigator.vendor).indexOf("Apple") < 0)
		{
			mnu.style.display = 'none';
		}	
	
	}
	catch(ex)
	{
		//alert(ex.message);
	}

	try
	{
		var sobCls = String(evt.relatedTarget.className);
		if(sobCls != "ml1" && sobCls != "ml2")
		{		
			mnu.style.display = 'none';
		}
	}
	catch(ex)
	{
		//alert(ex.message);
	}

}


function shoCartSum()
{  
	var xmlHttp;
	try
    {    // Firefox, Opera 8.0+, Safari    
		xmlHttp=new XMLHttpRequest();    
    }
	catch (e)
    {    // Internet Explorer    
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	    }
	    catch (e)
		{
		      try
				{
				    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
				}
				catch (e)
				{        
					//alert("Your browser does not support AJAX!");        
					return false;
				}      
		}    
	}  


	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			try
			{
			//document.myForm.time.value=xmlHttp.responseText;
			var valStr = xmlHttp.responseText;
			var vals = valStr.split("|");
			if(vals.length > 0)
			{
				document.getElementById("hCartSum").innerHTML = vals[0];
			
				if(String(vals[1]) != "undefined" && String(vals[1]) != "null")
				{
					document.getElementById("sWelcome").innerHTML = ", " + vals[1];
				}
				if(String(vals[2]) != "undefined") 
				{
					document.getElementById("hLogin").href = "/mb/accinfo.asp?cartId=" + vals[2];
				}
			//hLogin.innerText
			//document.getElementById("allbrands").style.display='block';
			}
			else
			{
				document.getElementById("sWelcome").innerHTML = "";
			}
			}
			catch(ex)
			{
			}
		}
	}

	try
	{
		xmlHttp.open("GET","/mb/includes/cartsum.asp?" + new Date().getTime() ,true);
		xmlHttp.send(null);
	}
	catch(ex)
	{
		top.status = ex.message;
	}
    
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function rotator()
{
	this.ads = new(Array);
	this.curIdx = 0;
	this.iterations = 0;
	this.delay = 3000;
	this.bUseWingDings = String(navigator.appName) == "Microsoft Internet Explorer";
	
	this.ctrlStyle1 = "cursor:hand;background-color:yellow;font-weight:bold;color:black;";
	this.ctrlStyle2 = "cursor:hand;background-color:black;font-weight:bold;color:yellow;";
	
}

rotator.prototype.add = function(html)
{
	this.ads[this.ads.length] = html;
}

rotator.prototype.list = function(divId, idx) {
    var html = "";

    try {
        var styl2 = "cursor:hand;background-color:white;font-weight:bold;color:red;border:3px white";

        for (var i = 0; i < this.ads.length; i++) {
            var styl = (i == idx) ? this.ctrlStyle2 : this.ctrlStyle1;
            html += '<span style="' + styl + '" onclick="oShow.jump(' + i + ')">&nbsp;' + String(i + 1) + ' </span>&nbsp';
        }

        if (this.bUseWingDings) {
            if (this.iterations < 500) {
                html += '<span title="pause" style="' + this.ctrlStyle1 + ';font-family:Webdings" onclick="oShow.pause()">&nbsp;;</span>&nbsp';
            }
            else {
                html += '<span title="play" style="' + this.ctrlStyle1 + ';font-family:Webdings" onclick="oShow.play()">&nbsp;4</span>&nbsp';
            }

        }
        else {
            if (this.iterations < 500) {
                html += '<span title="pause" style="' + this.ctrlStyle1 + '" onclick="oShow.pause()">&nbsp;|| </span>&nbsp';
            }
            else {
                html += '<span title="play" style="' + this.ctrlStyle1 + '" onclick="oShow.play()">&nbsp;&gt; </span>&nbsp';
            }

        }

        document.getElementById(divId).innerHTML = html;

    }
    catch (ex) {
    }
  

}

rotator.prototype.rotate = function()
{
	if(this.curIdx >= this.ads.length)
	{
		 this.curIdx = 0;
		 this.iterations++;
	}
	//window.status = this.iterations + " " + this.curIdx;
	this.list("divExp",this.curIdx);
	if(this.iterations < 500)
	{
		document.getElementById("divVwr").innerHTML = this.ads[this.curIdx++];
	
		window.setTimeout("oShow.rotate();",this.delay);
	}
}

rotator.prototype.jump = function(idx)
{
	document.getElementById("divVwr").innerHTML = this.ads[idx];
}

rotator.prototype.pause = function(idx)
{
	this.iterations = 501;
}

rotator.prototype.play = function(idx)
{
	this.iterations = 0;
	this.rotate();
}


