// 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.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)
{
	try{
		//if(!mnu.contains(window.event.toElement && mnu != par))
		//if(!mnu.contains(window.event.toElement) && String(navigator.vendor).indexOf("Apple") < 0)
		if(!mnu.contains(window.event.toElement))
		{
			mnu.style.display = 'none';
		}	
	
	}
	catch(ex)
	{
		//alert(ex.message);
	}
}

function ckMenu(sMnu)
{
	var mnu = ocument.getElementById(sMnu);
	try{
		//if(!mnu.contains(window.event.toElement && mnu != par))
		//if(!mnu.contains(window.event.toElement) && String(navigator.vendor).indexOf("Apple") < 0)
		if(!mnu.contains(window.event.toElement))
		{
			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)
		{
			//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")	document.getElementById("sWelcome").innerHTML = ", " + vals[1];
			if(String(vals[2]) != "undefined") document.getElementById("hLogin").href = "/mb/accinfo.asp?cartId=" + vals[2];
			}
			else
			{
				document.getElementById("sWelcome").innerHTML = "";
			}
			//hLogin.innerText
			//document.getElementById("allbrands").style.display='block';
			
		}
	}

	xmlHttp.open("GET","http://www.musiciansbuy.com/mb/includes/cartsum.asp?" + new Date().getTime() ,true);
	xmlHttp.send(null);
    
}

function rotator()
{
	this.ads = new(Array);
	this.curIdx = 0;
	this.iterations = 0;
	this.delay = 3000;
}

rotator.prototype.add = function(html)
{
	this.ads[this.ads.length] = html;
}


rotator.prototype.rotate = function()
{
	if(this.curIdx >= this.ads.length)
	{
		 this.curIdx = 0;
		 this.iterations++;
	}
	//window.status = this.iterations + " " + this.curIdx;
	document.getElementById("divVwr").innerHTML = this.ads[this.curIdx++];
	if(this.iterations < 500)	window.setTimeout("oShow.rotate();",this.delay);
}

rotator.prototype.jump = function(idx)
{
	document.getElementById("divVwr").innerHTML = this.ads[idx];
}




