function swfCode(f, w, h) {
	return '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+w+'" height="'+h+'"> <param name="movie" value="'+f+'"> <param name="quality" value="high"> <param name="allowScriptAccess" value="sameDomain"> <param name="wmode" value="transparent"> <param name="menu" value="false"> <embed src="'+f+'" width="'+w+'" height="'+h+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" menu="false" allowScriptAccess="sameDomain"></embed></object>';
}
function writeswf(filename, width, height) {
  document.write(swfCode(filename, width, height));
}
function addListener(element, event, listener, bubble) {
	if(element.addEventListener) {
		if(typeof(bubble) == "undefined") bubble = false;
		element.addEventListener(event, listener, bubble);
	} else if(this.attachEvent) {
		element.attachEvent("on" + event, listener);
	}
}
function voltar() {
	history.go(-1);
	return false;
}
function revistaPopup(url) {
	var w=window.open(url, 'PortalWoodsRevista', 'width=1000,height=750,scrollbars=no,status=no,location=no,toolbar=no,menubar=no');
	if (w.focus)
		w.focus();
	return false;
}
function bonusPrint(id) {
	var w=window.open('/bonus/impressao/'+id, 'PortalWoodsBonusImpressao', 'width=800,height=600,scrollbars=no,status=no,location=no,toolbar=no,menubar=no');
	if (w.focus)
		w.focus();
	return false;
}
function radioPopup(url) {
	var w=window.open(url, 'PortalWoodsRadio', 'width=410,height=315,scrollbars=no,status=no,location=no,toolbar=no,menubar=no');
	if (w.focus)
		w.focus();
	return false;
}
$(function(){
	$('#conteudo input.btn, #conteudo a.btn').addClass('woods-button borda-btn');

	$(".woods-button:not(.ui-state-disabled)")
		.hover(
			function(){$(this).addClass("ui-state-hover");},
			function(){$(this).removeClass("ui-state-hover");}
		)
		.mousedown(function(){
				$(this).parents('.woods-buttonset-single:first').find(".woods-button.ui-state-active").removeClass("ui-state-active");
				if( $(this).is('.ui-state-active.woods-button-toggleable, .woods-buttonset-multi .ui-state-active') ){ $(this).removeClass("ui-state-active"); }
				else { $(this).addClass("ui-state-active"); }
		})
		.mouseup(function(){
			if(! $(this).is('.woods-button-toggleable, .woods-buttonset-single .woods-button, .woods-buttonset-multi .woods-button') ){
				$(this).removeClass("ui-state-active");
			}
	});
});
