window.onload = function() {
	external_links();
}

// varre os links da página, modificando para _blank o target de todos aqueles 
// que têm rel="external"
function external_links() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && 
			anchor.getAttribute("rel") == "external")
			anchor.target = "_blank";
	}
}

// permite a exibição de conteúdo flash compatível com os principais
// navegadores, sem quebrar a validação W3C
function flash(caminho,largura,altura){
	document.write('<object type="application/x-shockwave-flash" data="'+caminho+'" width="'+largura+'" height="'+altura+'"> \n');
	document.write('<param name="movie" value="'+caminho+'"/>');
	document.write('<param name="wmode" value="transparent"/>');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('</object>');
}

function random_banner() 
{
	banners = Array();
	banners[1] = '/hpg/images/right-banners/banner_produtos_premiados.swf';
	banners[2] = '/hpg/images/right-banners/banner_cp.swf';
	rand = Math.ceil(Math.random() * 2);
	flash(banners[rand],'91','182');
}


//jquery
$(document).ready(function(){
	$('#nav li').hover(function(){
		$(this).children().next().css('display','block');
	},function(){                                  
		$(this).children().next().css('display','none');
	});

	$('.menu dd').hover(function(){
		$(this).children('ul').css('display','block');
	}, function(){
		$(this).children('ul').css('display','none');
	});   

	$('#acesso-rapido, #select-sistemas-web, #select-faq').change(function(){				
		$(location).attr('href', $(this).find('option').filter(':selected').attr('value'));
	});
	
	$('#more-card').toggle(function(){
		$('#card').slideDown();
	},function(){
		$('#card').slideUp();
	});
	
	$('#more-credito').toggle(function(){
		$('#credito').slideDown();
	},function(){
		$('#credito').slideUp();
	})
});

/*
startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
					node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}
window.onload=startList;
*/
