﻿if(document.location.href.toString().indexOf("tecnologia.chleba.net") > -1){
    document.domain="tecnologia.chleba.net";
}


function initBoxSacola() {	
	//document).ready(function() {
        $("#ultimoItem").addClass("alt");                
        //$('#itensCarrinho').unbind("mouseenter");
        //$('#itensCarrinho').unbind("mouseleave");  
              
        //$('#itensCarrinho').unbind("click");
        $('.itens').unbind("click");        
        // Bind para os eventos mouse enter and mouse leave da div ultimoItem.
        //$( "#itensCarrinho" ).bind("mouseenter mouseleave", function( event ){        
        //$( "#itensCarrinho" ).bind("click", function( event ){
        $(".itens").bind("click", function(event) {
            $('#ultimoItem').slideToggle('medium', AtualizarBoxSacola(2));
            $("ul.listaProduto li").css('position', 'static'); //Fix para a lista de produtos "SPOT" não ficar por cima do box de preview.    
            return false;
        });      
				
	//};	
}

function initHeader() {
    if (parent.frHeader.document.getElementById("htm_header_sair") == null)
        setTimeout('initHeader()', 1000);
    else
        parent.frHeader.document.getElementById("htm_header_sair").onclick = LogOutHeader;
    
    if (parent.frHeader.document.getElementById("htm_header_logar") == null)
        setTimeout('initHeader()', 100);
    else
        parent.frHeader.document.getElementById("htm_header_logar").onclick = LoginHeader;

}
function LoginHeader() {
    window.open( GetUrlBase() + "MinhaConta/Identificacao.aspx", "_self");
}

function LogOutHeader() {

    var urlbase = GetUrlBase() + "rodape/rodape_logout.ashx";
    
    
    $.ajax({
        type: "POST",
        url: urlbase,
        data : {},
        dataType: "text",
        success: function(msg, status) {
            window.open(GetUrlBase() + "Default.aspx", "_self");
        },
        error: function(xhr, msg, e) {
        }
    });


}


