function aplicaFlash(swf, width, height, wmode, cache, flashvars) {
	var noCache = "";
	if (cache == undefined || cache == '') {var noCache = "?" + new Date();}
	if (wmode != "opaque" && wmode != "transparent") {wmode = "transparent";}
	var monta_swf = "";


	monta_swf += "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='"+ width +"' height='"+ height +"' title=''>";
	monta_swf += "<param name='movie' value='"+ swf + noCache +"'>";
	monta_swf += "<param name='quality' value='high'>";
	monta_swf += "<param name='menu' value='0'>";
	monta_swf += "<param name='wmode' value='"+ wmode +"'>";
	monta_swf += "<param name='FlashVars' value='"+ flashvars +"'>";
	monta_swf += "<embed src='"+ swf + noCache +"' FlashVars='" + flashvars + "' name='" + swf + "' id='" + swf  + "' quality='high' wmode='"+ wmode +"' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+ width +"' height='"+ height +"'></embed>";
	monta_swf += "</object>";


	//alert(monta_swf);
	document.write(monta_swf);
}


function aplicaFlashEI(swf, caminho, width, height, wmode, cache, flashvars) {
	var noCache = "";
	if (cache == undefined || cache == '') {var noCache = "?" + new Date();}
	if (wmode != "opaque" && wmode != "transparent") {wmode = "transparent";}
	var monta_swf = "";


	monta_swf += "<object name='" + swf + "' id='" + swf + "' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='"+ width +"' height='"+ height +"' title=''>";
	monta_swf += "<param name='movie' value='"+ caminho + swf + ".swf" + noCache +"'>";
	monta_swf += "<param name='quality' value='high'>";
	monta_swf += "<param name='menu' value='0'>";
	monta_swf += "<param name='wmode' value='"+ wmode +"'>";
	monta_swf += "<param name='FlashVars' value='"+ flashvars +"'>";
	monta_swf += "<embed src='"+ caminho + swf  + ".swf" + noCache +"' FlashVars='" + flashvars + "' name='" + swf + "' id='" + swf  + "' quality='high' wmode='"+ wmode +"' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+ width +"' height='"+ height +"'></embed>";
	monta_swf += "</object>";


	//alert(monta_swf);
	document.write(monta_swf);
}


// Initialization, you can leave this here or move this somewhere else
$(function(){
	$('ul.jd_menu').jdMenu({	onShow: loadMenu
								//onHideCheck: onHideCheckMenu,
								//onHide: onHideMenu, 
								//onClick: onClickMenu, 
								//onAnimate: onAnimate
								});
	$('ul.jd_menu_vertical').jdMenu({onShow: loadMenu, onHide: unloadMenu, offset: 1, onAnimate: onAnimate});
});

function onAnimate(show) {
	//$(this).fadeIn('slow').show();
	if (show) {
		$(this)
			.css('visibility', 'hidden').show()
				.css('width', $(this).innerWidth())
			.hide().css('visibility', 'visible')
		.fadeIn('normal');
	} else {
		$(this).fadeOut('fast');
	}
}

var MENU_COUNTER = 1;
function loadMenu() {
	if (this.id == 'dynamicMenu') {
		$('> ul > li', this).remove();

		var ul = $('<ul></ul>');
		var t = MENU_COUNTER + 10;
		for (; MENU_COUNTER < t; MENU_COUNTER++) {
			$('> ul', this).append('<li>Item ' + MENU_COUNTER + '</li>');
		}
	}
}

function unloadMenu() {
	if (MENU_COUNTER >= 30) {
		MENU_COUNTER = 1;
	}
}

// We're passed a UL
function onHideCheckMenu() {
	return !$(this).parent().is('.LOCKED');
}

// We're passed a LI
function onClickMenu() {
	$(this).toggleClass('LOCKED');
	return true;
}

function troca_1(){
	document.getElementById('img_Off').style.display = "none";
	document.getElementById('img_On').style.display = "block";
}
function troca_2(){
	document.getElementById('img_On').style.display = "none";
	document.getElementById('img_Off').style.display = "block";
}

// Campo sem números
function noLetters(e)
{
	var tecla;
	if(!e)
		e = window.event;
	
	// verificação cross-browser
	if(e.which)
		tecla = e.which;
	else if(e.keyCode)
		tecla = e.keyCode;

	if( (tecla >= 48 && tecla <= 57) || (tecla >= 96 && tecla <= 105) || tecla == 8 || tecla == 37 || tecla == 39 || tecla == 46 || tecla == 9 )
	{
		/*9: tab; 8 = backspace; 37 = seta pra esquerda; 39 = seta pra direita; 46 = delete*/
		return true;
	}
	else
	{
		return false;
	}
}

//retira espaços em branco da string
function leftTrim(sString)
{
	while (sString.substring(0,1) == ' ')
	{
		sString = sString.substring(1, sString.length);
	}
	return sString;
}

function rightTrim(sString)
{
	while (sString.substring(sString.length-1, sString.length) == ' ')
	{
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}


function trim(sString)
{
	while (sString.substring(0,1) == ' ')
	{
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' ')
	{
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}