jQuery(function(){
	jQuery('.destaque ul li').hover(function(){
		jQuery(this).find('.border').addClass('borderOnPeq');
	},function(){
		jQuery(this).find('.border').removeClass('borderOnPeq');
	});

	jQuery('.boxEsq ul li').hover(function(){
		jQuery(this).find('.border').addClass('borderOn');
	},function(){
		jQuery(this).find('.border').removeClass('borderOn');
	});
	
	jQuery('#listagem-produtos li').hover(function(){
		jQuery(this).find('.border').addClass('borderOn');
	},function(){
		jQuery(this).find('.border').removeClass('borderOn');
	});
	
	jQuery('#listagem-produtos.busca li').hover(function(){
		jQuery(this).find('.border').addClass('borderOn');
	},function(){
		jQuery(this).find('.border').removeClass('borderOn');
	});
	
	jQuery('.boxColecao li').hover(function(){
		jQuery(this).find('.border').addClass('borderOn');
	},function(){
		jQuery(this).find('.border').removeClass('borderOn');
	});
	
	if (jQuery('.boxMenuEsq').outerHeight(true)+55 < (jQuery('.boxDetalhePrd').outerHeight(true) + 
		jQuery('#destaques-pequeno').outerHeight(true) +
		jQuery('#destaque-maior').outerHeight(true) +
		jQuery('.caminhoPao').outerHeight(true))) {
		
			jQuery('.boxMenuEsq').height(jQuery('.boxDetalhePrd').outerHeight(true) + 
			jQuery('#destaques-pequeno').outerHeight(true) +
			jQuery('#destaque-maior').outerHeight(true) +
			jQuery('.caminhoPao').outerHeight(true) - 55);
			
	}
	
	jQuery('.listaOver li').hover(function(){
		jQuery(this).addClass('overLinha');
	},function(){
		jQuery(this).removeClass('overLinha');
	});

});


// fim do jquery


function menuSize(height) {
	//Altera tamanho do elemento EMBED
    var embed = document.getElementById("audio_icon").firstChild;
    embed.style.height = height + "px";
}

function checkEmail(email) {
   var regex = /^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
   return regex.test(email);
}

function linksanalytics() {
    if (!document.getElementsByTagName) return;
    var anchors = document.getElementsByTagName("a");
    for (var i=0; i<anchors.length; i++) {
	var anchor = anchors[i],
	    href = anchor.getAttribute("href");
	if (anchor.getAttribute("href")!="#"  && anchor.getAttribute("rel")=="external"){
	    anchor.target = "_blank";
	    anchor.onclick = "_gaq.push(['_trackEvent','external-link','click',"+href+"])";
	}else if(href!="#" && href!=""){
	    anchor.onclick = "_gaq.push(['_trackEvent','internal-link','click',"+href+"])";
	}
    }
}
window.onload = linksanalytics;

/*var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
function tracker(name){
	try {
		var pageTracker = _gat._getTracker("UA-1104786-1");
		pageTracker._trackPageview(name);
	} catch(err) {} 
}*/

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-18221518-3']);
_gaq.push(['_trackPageview']);
_gaq.push(['old._setAccount', 'UA-1104786-2']);
_gaq.push(['old._setDomainName', 'gremiomania.com.br']);
_gaq.push(['old._trackPageview']);
(function(){
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

function printpage() {
  window.print();
}

function closeLayer() {
	$('layer').hide();
}

jQuery(document).ready(function(){
    jQuery("#tooltipVaca").hide();

    jQuery("#FacaVaca").mouseover(function(event){
	    jQuery("#tooltipVaca").fadeIn();
    });

    jQuery("#FacaVaca").mouseout(function(event){
	    jQuery("#tooltipVaca").fadeOut();
    });
    jQuery("fieldset.envio a.info").mouseover(function(){
        jQuery(this).next().stop(1,1).show();
    })
    .bind("mouseout",function(){
        jQuery(this).next().stop(1,1).hide();
    });
    
    jQuery("#btGiftcard").click(function(){
        if (jQuery("#giftCard_number1").val() != '' && jQuery("#giftCard_number2").val() != '' && 
            jQuery("#giftCard_number3").val() != '' && jQuery("#giftCard_number4").val() != '' && jQuery("#giftCard_pin").val()) 
        {
            _gaq.push(['_trackEvent', 'Comprar', 'Cartao Presente', 'Sucesso']);
            _gaq.push(['_setCustomVar', 1, 'Pagamento', 'Cartao Presente', 2]);            
        }        
    });
});


