
initMenu = function() {
	var navMenu = document.getElementById("menu");
	if (navMenu) {
		var lis = navMenu.getElementsByTagName((navMenu.id == "menu") ? "li" : "li");
		for (var i=0; i<lis.length; i++) {
			lis[i].onmouseover = function() {
				this.className = "hover";
			}
			lis[i].onmouseout = function(){
				this.className = this.className.replace("hover", "");
			}
		}
	}
}

if (document.all && window.attachEvent) {
	attachEvent("onload", initMenu);
} else {
	window.addEventListener("load", initMenu, false);
}

function openAjax() {
	var ajax;
	try{
    ajax = new XMLHttpRequest();
	}catch(ee){
    try{
      ajax = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
      try{
        ajax = new ActiveXObject("Microsoft.XMLHTTP");
      }catch(E){
        ajax = false;
      }
    }
	}
	return ajax;
}

function produto(id) {
	if (document.getElementById('produto')) { 
		var exibeResultado=document.getElementById('produto');
		exibeResultado.style.display='';
		var ajax = openAjax();
		ajax.open("GET", 'getproduto.aspx?id='+id, true);
		ajax.onreadystatechange = function() {
			if (ajax.readyState == 1) { 
				exibeResultado.innerHTML = '<center><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p><img src="images/loading.gif" border="0"></p></center>';
			}
			if(ajax.readyState == 4) {
				if(ajax.status == 200) {
					var resultado = ajax.responseText; 

					exibeResultado.innerHTML = resultado;
				} else {
					exibeResultado.innerHTML = "Ocorreu um erro. Tente novamente mais tarde. ";
				}
			}
		}
		ajax.send(null);
	}
}

function addFav(){
    var url      = "http://www.bocril.com.br";
    var title    = "Bocril - Artefatos de Borracha";
    if (window.sidebar) window.sidebar.addPanel(title, url,"");
    else if(window.opera && window.print){
        var mbm = document.createElement('a');
        mbm.setAttribute('rel','sidebar');
        mbm.setAttribute('href',url);
        mbm.setAttribute('title',title);
        mbm.click();
    }
    else if(document.all){window.external.AddFavorite(url, title);}
}

function setAsHomePage() {
	document.body.style.behavior='url(#default#homepage)';
	document.body.setHomePage('http://www.bocril.com.br');
}