	function loadsource(sImagem){ 
		var defaultPage = "inverno_2009/modelos/m1.php";
		if((sImagem.length > 0) && ( sImagem != "null" )){
			var frameSource = "inverno_2009/modelos/"+ sImagem +".php";
			window.frames["info"].location = frameSource;
		}
		else{
			window.frames["info"].location = defaultPage;
		}
	}
	
	/*function loadsource() 
	{ 
	var defaultPage = "teste/modelos/m1.php";
	   var query = window.location.search.substring(1);
	   var pos = query.indexOf('=');
	   if (pos > 0) 
	   {
		  var frameSource = query.substring(pos+1);
		  window.frames["info"].location = frameSource;
	   }
	   else
	   {
		  window.frames["info"].location = defaultPage;
	   }
	}*/
//Funcoes para o TUNEL DO TEMPO
 
function fnMostraOculta(pId)
{
	if (document.getElementById(pId).style.display == 'block')
	{
    	document.getElementById(pId).style.display='none' ;
	}
	else
	{
		document.getElementById(pId).style.display='block' ;
	}
}

/////////////////////////////////////////////////////////////////////////////////////////////////
//Funcao Adiciona a Favoritos
function fnAdicionaFavoritos(){
	str_titulo = "Ana Trivelato.";
	str_url = "http://www.anatrivelato.com.br";
	//FireFox
	if (window.sidebar){
   		window.sidebar.addPanel(str_titulo, str_url,"");
	} else if( window.external ){
	//IE
  		window.external.AddFavorite( str_url, str_titulo);
	} else if(window.opera && window.print){
	//Opera
   		return true;
	}
}


////////////////////////////////////////////////////////////////////////////////////////////
//Validacao do Indique Amigo
function ValidaForm_IndiqueAmigo(form,evento){
	if ( form.nome.value == '' ){
		alert('Atenção!\nO campo SEU NOME deve ser preenchido.') ;
		form.nome.focus();
		return false ;
	}
	if (form.email.value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1){
		alert("Atenção!\nO campo SEU E-MAIL deve ser preenchido.");
		form.email.focus();
		return false;
	}
	if (form.emailamigo.value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1){
		alert("Atenção!\nO campo E-MAIL DO AMIGO deve ser preenchido.");
		form.emailamigo.focus();
		return false;
	}
	if (form.mensagem.value == ''){
		alert('Atenção!\nO campo MENSAGEM deve ser preenchido.') ;
		form.mensagem.focus();
		return false ;
	}
}



//////////////////////////////////////////////////////////////////////////////////////////////
//Funcao de popup
function MM_openBrWindow(theURL,winName,features) 
{
	var myWin =  window.open(theURL,winName,features);
	myWin.focus();
}

//////////////////////////////////////////////////////////////////////////////////////////////
//Funcao para o flash
function fnFlash(str_url, int_largura, int_altura){
	document.writeln('<object type="application/x-shockwave-flash" data="' + str_url + '" width="' + int_largura + '" height="' + int_altura + '">');
	document.writeln('<param name="movie" value="' + str_url + '">');
	document.writeln('<param name="quality" value="high">');
	document.writeln('<param name="wmode" value="transparent">');
	document.writeln('</object>');
}
////////////////////////////////////////////////////////////////////////////////////////////////
// Valida Multi marcas
function ValidaForm_MultiMarcas(form){
	if(form.nome_fantasia.value.length<=1){
		alert("O campo Nome Fantasia deve estar preenchido corretamente.");
		form.nome_fantasia.focus();
		return false;
	}
	if(form.razao_social.value.length<=1){
		alert("O campo Razão Social deve estar preenchido corretamente.");
		form.razao_social.focus();
		return false;
	}
	if(form.nome_contato.value.length<=1){
		alert("O campo Nome para Contato deve estar preenchido corretamente.");
		form.nome_contato.focus();
		return false;
	}
	if(form.cnpj.value.length<=1){
		alert("O campo CNPJ deve estar preenchido corretamente.");
		form.cnpj.focus();
		return false;
	}
	if (form.email.value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1){
		alert("Atenção!\nO campo E-mail deve ser preenchido.");
		form.email.focus();
		return false;
	}
	if(form.cidade.value.length<=1){
		alert("O campo Cidade deve estar preenchido corretamente.");
		form.cidade.focus();
		return false;
	}
	if(form.estado.value.length<=1){
		alert("O campo Estado deve estar preenchido corretamente.");
		form.estado.focus();
		return false;
	}
	if(form.cep.value.length<=1){
		alert("O campo CEP deve estar preenchido corretamente.");
		form.cep.focus();
		return false;
	}
	if(form.bairro.value.length<=1){
		alert("O campo Bairro deve estar preenchido corretamente.");
		form.bairro.focus();
		return false;
	}
	if(form.endereco.value.length<=1){
		alert("O campo Endereço deve estar preenchido corretamente.");
		form.endereco.focus();
		return false;
	}
	
	if(form.telefone.value.length<=1){
		alert("O campo Telefone deve estar preenchido corretamente.");
		form.telefone.focus();
		return false;
	}
	if(form.celular.value.length<=1){
		alert("O campo Celular deve estar preenchido corretamente.");
		form.celular.focus();
		return false;
	}
	if(form.marcas_trabalha.value.length<=1){
		alert("O campo Com que marcas trabalha deve estar preenchido corretamente.");
		form.marcas_trabalha.focus();
		return false;
	}
	if(form.tempo_comercio.value.length<=1){
		alert("O campo Há quanto tempo no comércio deve estar preenchido corretamente.");
		form.tempo_comercio.focus();
		return false;
	}
}



/////////////////////////////////////////////////////////////////////////////////////////////////
//valida formulario Contato
function ValidaForm_Contato(form){
	if(form.nome.value.length<=1){
		alert("O campo Nome deve estar preenchido corretamente.");
		form.nome.focus();
		return false;
	}
	var str_email = form.email.value ;
    if (( str_email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1 ) || ( str_email == 'Email:' )){
    	alert("O campo E-mail deve ser preenchido corretamente");
    	form.email.focus();
    	return false;
	}
	if(form.telefone.value.length<=1){
		alert("O campo Telefone deve estar preenchido corretamente.");
		form.telefone.focus();
		return false;
	}
	if(form.cidade.value.length<=1){
		alert("O campo Cidade deve estar preenchido corretamente.");
		form.cidade.focus();
		return false;
	}
	if(form.estado.value.length<=1){
		alert("O campo Estado deve estar selecionado corretamente.");
		form.estado.focus();
		return false;
	}
	if(form.mensagem.value.length<=1){
		alert("O campo Mensagem deve estar preenchido corretamente.");
		form.mensagem.focus();
		return false;
	}
	if(form.cod.value.length<=1){
		alert("O campo Código de Segurança deve estar preenchido corretamente.");
		form.cod.focus();
		return false;
	}
}

////////////////////////////////////////////////////////////////////////////////////
//Funcao da Mascara
function fnMascara(objeto,evt,mask){ 
	var LetrasU = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
	var LetrasL = 'abcdefghijklmnopqrstuvwxyz';
	var Letras  = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';	
	var Numeros = '0123456789';
	var Fixos  = '().-:/ ';
	var Charset = " !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_/`abcdefghijklmnopqrstuvwxyz{|}~";
	evt = (evt) ? evt : (window.event) ? window.event : "";
	var value = objeto.value;
	if(evt){
		var ntecla = (evt.which) ? evt.which : evt.keyCode;
		tecla = Charset.substr(ntecla - 32, 1);
		if(ntecla < 32) return true;
		var tamanho = value.length;
		if(tamanho >= mask.length) return false;
		var pos = mask.substr(tamanho,1);
		while(Fixos.indexOf(pos) != -1){
 	 		value += pos;
 	 		tamanho = value.length;
 	 		if(tamanho >= mask.length) return false;
 	 		pos = mask.substr(tamanho,1);
		}
		switch(pos){
   			case '#': if(Numeros.indexOf(tecla) == -1) return false; break;
   			case 'A': if(LetrasU.indexOf(tecla) == -1) return false; break;
   			case 'a': if(LetrasL.indexOf(tecla) == -1) return false; break;
   			case 'Z': if(Letras.indexOf(tecla) == -1) return false; break;
   			case '*': objeto.value = value; return true; break;
   			default: return false; break;
 		}
	}
	objeto.value = value;
	return true;
}

