/*VAR*/
press_button = false;

/*#ONLOAD#*/
window.name = 'bb_browser';

/*#NONE#*/
function none() {
}


/*#FINALIZAR#*/
function carrinho_finalizar() {
    if (!press_button)	{
		press_button				= true;
		location.href				= './?actA=3';
	}
}

/*#SOMA#*/
function carrinho_soma() {
	iframe_virtual('temp/carrinho_soma.asp');
}

/*# COUNT #*/
function count(objetoVC,targetVC) {
	window.open('codigos/count.asp?'+objetoVC,targetVC);
}

/*# IFRAME VIRTUAL #*/
function iframe_virtual(urlVC) {
	if (document.all.iframe_virtual)	{
		document.all.iframe_virtual.removeNode(true);
	}
	
	var tempIFrame					= document.createElement('iframe');
		tempIFrame.style.border		='0px';
		tempIFrame.style.width		='0px';
		tempIFrame.style.height		='0px';
		
		tempIFrame.setAttribute('id','iframe_virtual');
		tempIFrame.setAttribute('name','iframe_virtual');
		tempIFrame.setAttribute('src',urlVC);
	
	IFrameObj						= document.body.appendChild(tempIFrame);
}

/*# aceita só números digitados num campo */
function soNumero(evtKeyPress) {
	var nTecla;
	nTecla = (evtKeyPress.which) ? evtKeyPress.which : evtKeyPress.keyCode;
	
	if((nTecla > 47 && nTecla < 58) || nTecla == 8 || nTecla == 9)
		return true;
	else
		return false;
}

/*#MASCARA#*/
function mascara(vle,msk)	{
	var i	= vle.value.length;
	var s	= msk.substring(0,1);
	var t	= msk.substring(i)
	
	if (t.substring(0,1) != s)	{
		vle.value += t.substring(0,1);
	}
}

/*# MASCARA */
function mascarar(vc_campo,vc_mascara) {
	var i		= vc_campo.value.length;
	var x		= vc_mascara.substring(0,1);
	var y		= vc_mascara.substring(i);
	
	if (y.substring(0,1) != x) {
		vc_campo.value += y.substring(0,1);
	}
}

/*# VERIFICAR */
function pesquisa_verificar() {
	if (frm_pesquisa.pesquisa_termoVC.value.length < 2 && frm_pesquisa.pesquisa_genero_produtoID.value == 0 && frm_pesquisa.pesquisa_tipo_produtoID.value == 0) {
		alert('Para podermos filtrar melhor o que você procura,\npreencha o campo de pesquisa com mais caracteres.');	
		document.frm_pesquisa.pesquisa_termoVC.focus();
	} else {
		frm_pesquisa.submit();
	}
}

/*# VERIFICA DATA #*/
function data_verificar(campoVC) {

	if (campoVC.value.length > 0) {  
		it_dia		= (campoVC.value.substring(0,2)); 
		it_mes		= (campoVC.value.substring(3,5)); 
		it_ano		= (campoVC.value.substring(6,10)); 
		it_erro		= 0; 

		if ((it_dia < 01) || (it_dia < 01 || it_dia > 30) && (it_mes == '04' || it_mes == '06' || it_mes == '09' || it_mes == '11' ) || it_dia > 31) { 
			it_erro	= 1; 
		} 

		if (it_mes < 01 || it_mes > 12 ) { 
			it_erro	= 1; 
		} 

		if (it_mes == 2 && (it_dia < 01 || it_dia > 29 || (it_dia > 28 && (parseInt(it_ano / 4) != it_ano / 4)))) { 
			it_erro	= 1; 
		} 

		if ((it_ano < 1900) || (it_ano>2078)){
			it_erro	= 1;
		}
		
		if (it_erro == 1) { 
			alert("Por favor, preencha uma data válida!"); 
			campoVC.value	= '';
			campoVC.focus(); 
		}
	} 
}

/*#IMG CHANGER#*/
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
//-->

/*# VISUALIZAR #*/
function pop_abre(id_item,W,H,vc_arquivo) {
	var X	= Math.ceil( (window.screen.height - H) / 2 ) - 20;
	var Y	= Math.ceil( (window.screen.width - W) / 2 ) - 16;
	
	window.open('pops/'+vc_arquivo+'.asp?'+vc_arquivo+'ID='+id_item,vc_arquivo+'_'+id_item,'width='+W+',height='+H+',top='+X+',left='+Y+',location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,toolbar=no');
}


/****************************************************************
*	Criado em:		20/10/06			Por: ANDRÉ LUIZ			*
*	ToDo ->			trata dropDown nas pesquisas por música		*
*	Utilizado em:	includes/pesquisa_menu.asp					*
*****************************************************************/
function trataTipoPesquisa(it_valor) {
	it_valor		= parseInt(it_valor);
	
	var obj_dd		= document.getElementById('pesquisa_termoIT');
	
	// verifica se o objeto existe
	if (obj_dd) {
		if (it_valor == 15) {
			// remove opção [termo exato] se o tipo de pesquisa for [por música]
			obj_dd.remove(0);
			obj_dd.options[0].selected == true;
		} else {
			if (obj_dd.options.length == 1) {
				// limpa dropDown de tipo de pesquisa
				while (obj_dd.options.length != 0)
					obj_dd.remove(0);
				// adiciona opções de tipo de pesquisa [artista, titulo ou musica]
				obj_dd[0]	= new Option('COM QUALQUER DAS PALAVRAS',1);
				obj_dd[1]	= new Option('TERMO EXATO',2);
			}
		}
	}
}

/*# TRIM - Função que verifica se há espaços no início e fim de uma string, semelhante ao trim #*/
function trim(vc_string) {
  //Remove os espaços do Inicio
  while ((vc_string.substring(0,1) == ' ') || (vc_string.substring(0,1) == '\n') || (vc_string.substring(0,1) == '\r')) {
    vc_string = vc_string.substring(1,vc_string.length);
  }
 
  //Remove os espaços do Final
  while ((vc_string.substring(vc_string.length-1,vc_string.length) == ' ') || (vc_string.substring(vc_string.length-1,vc_string.length) == '\n') || (vc_string.substring(vc_string.length-1,vc_string.length) == '\r')) {
    vc_string = vc_string.substring(0,vc_string.length-1);
  }
 
 return vc_string;
}