function url(tmp_string) {
	window.location = tmp_string;
}

function swapI(obj,focus){
	if(focus){
		if(obj.value == obj.attributes["label"].value){
			obj.value = "";
		}
	} else {
		if(obj.value.trim() == ""){
			obj.value = obj.attributes["label"].value;
		}
	}
}
function swapP(obj,focus){
	if(focus){
		var pass = document.getElementById(obj.attributes["parent"].value);
		if(pass){
			obj.innerHTML = "";
			pass.focus();
		}
	} else {
		if(obj.value == ""){
			var div = document.getElementById("div"+obj.id);
			if(div){
				div.innerHTML = obj.attributes["label"].value;
			}
		}
	}
}
function swapOver(nome,over){
	var obj = document.getElementById('img_'+nome);
	if(obj){
		if(over){
			var arr = obj.src.split('.');
			var newSrc = '';
			for(var x=0;x<arr.length-1;x++){
				newSrc += arr[x];
				if((x+1) <arr.length-1){
					newSrc += '.';
				}
			}
			obj.src = newSrc+'_over.'+arr[arr.length-1];
		} else {
			obj.src = obj.src.replace('_over','');
		}
	}
}

function swapMenu(div_id,focus){
	var obj = document.getElementById(div_id);
	if(focus){
		if(obj){
			obj.className = 'bt_alpha100';
		}
	} else {
		if(obj){
			obj.className = 'bt_alpha50';
		}
	}
}

function swapMenu2(div_id,focus){
	var obj = document.getElementById(div_id);
	if(obj){
		if(focus){
			obj.className = '';
		} else {
			obj.className = 'bt_alpha60';
		}
	}
}

function esconde_div(id){
	if(id == 'a_marca'){
		document.getElementById('a_marca').style.display = 'none';
		document.getElementById('a_marca2').style.display = '';
		document.getElementById('a_marca2').style.marginTop = '0px';
	}else{
		document.getElementById('a_marca').style.display = '';
		document.getElementById('a_marca2').style.display = 'none';
	}
}
function esconde_div2(id){
	if(id == 'release'){
		document.getElementById('release').style.display = '';
		document.getElementById('catalogo').style.display = 'none';
		document.getElementById('making').style.display = 'none';
		document.getElementById('wallpaper').style.display = 'none';
	}else if(id == 'catalogo'){
		document.getElementById('release').style.display = 'none';
		document.getElementById('catalogo').style.display = '';
		document.getElementById('making').style.display = 'none';
		document.getElementById('wallpaper').style.display = 'none';
	}else if(id == 'making'){
		document.getElementById('release').style.display = 'none';
		document.getElementById('catalogo').style.display = 'none';
		document.getElementById('making').style.display = '';
		document.getElementById('wallpaper').style.display = 'none';
	}else if(id == 'wallpaper'){
		document.getElementById('release').style.display = 'none';
		document.getElementById('catalogo').style.display = 'none';
		document.getElementById('making').style.display = 'none';
		document.getElementById('wallpaper').style.display = '';
	}
}

function abre_popup(swf,w,h) {
	var popup = new Popup(w, h);
	popup.overflow = "hidden";
	popup.open('pop_up.php?src=../../swf/common/'+swf+'.swf&w='+w+'&h='+h);
}
function loadCampo(tmp_idSelecionando,tmp_idcampo,tmp_rotina){
	resetSelect(tmp_idcampo);
	var a = new Ajax();
	a.onLoad = function(){
		var str = this.html;
		var campo = document.getElementById(tmp_idcampo);
		var arr = str.split("###");//separa por registro
		var arraux = new Array();
		
		if (str != '') {
			for(var x = 0; x < arr.length; x++){
				arraux = arr[x].split("...");
				
				addOption(campo,arraux[1],arraux[0]);
				if (arraux[0] == '') {
					campo.options[x+2].style.fontWeight = 'bold';
				}
			}
			campo.disabled = '';
		} else {
			addOption(campo,'Nenhum item encontrado','');
			campo.disabled = true;
		}
	}
	a.get('../../inc/routines/routines.php?action='+tmp_rotina+'&id_selecionado='+tmp_idSelecionando);
}
function resetSelect(tmp_idcmapo){
	var campo = document.getElementById(tmp_idcmapo);
	if(campo){
		var dis = campo.disabled;
		campo.disabled = '';
		for(var x=campo.length-1;x>=2;x--){
			campo.remove(x);
		}
		campo.disabled = dis;
	}
}
function addOption(obj_select,tmp_text,tmp_value){
	var option = document.createElement('option');
	option.value = tmp_value;
	option.text = tmp_text;
	
	try {//outros navegadores
		obj_select.add(option,null);
	} catch(ex) {//para IE
		obj_select.add(option);
	}
}
function checkCatalogo() {
	if ($('catalogo').checked) {
		$('td_catalogo').innerHTML = $('div_catalogo').innerHTML;	
	} else {
		$('td_catalogo').innerHTML = '';	
	}
}
function mostrarResposta(tmp_id) {
	if(perguntaatual != tmp_id) {
		if ($('div_resposta_'+perguntaatual)) {
			$('div_resposta_'+perguntaatual).style.display = 'none';
			$('link_pergunta_'+perguntaatual).className = '';
		}
		
		$('div_resposta_'+tmp_id).style.display = '';
		$('link_pergunta_'+tmp_id).className = 'background';
		
		perguntaatual = tmp_id;
	}
}