function janela(URL,w,h) {
  var width = w;
  var height = h;

  var left = 550;
  var top = 320;

  window.open(URL,'exemplo',  'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');

}

function returnDefaultValue() 
{
  // objeto de todos os elementos 'input'
  var elInput = document.getElementsByTagName("input");
  for(var x = 0; x < elInput.length; x++) {
    // objeto a ser trabalhado
    var obj = elInput[x];
    // se for um campo do tipo 'text' e tiver um valor padrão
    if(obj.type == "text" && obj.defaultValue != "") {
      // função que limpa o valor ao se clicar no campo
      obj.onclick = function() { this.value = ""; }

      // função que volta ao valor padrão
      obj.onblur = function() { if(this.value == "") this.value = this.defaultValue; }
    }
  }
}

function mostraBannerDetalhes(e,img)
{
document.getElementById('banner').style.top = document.body.scrollTop;
document.getElementById('banner').style.left = document.body.scrollLeft;
}

function mostraBanner(e,img)
{
document.getElementById('banner').style.top = (e.clientY+4)+(document.body.scrollTop);
document.getElementById('banner').style.left = e.clientX+7;
}

function carregaBanner(img)
{
document.getElementById('banner').style.display = '';
if (img.substring(img.length-3) == 'jpg')
{
	document.getElementById('img').style.display = '';
	document.getElementById('img').src = img.substring(0,img.length-4) + '.jpg';
	//document.getElementById('img').src = 'http://www.meuveiculo.com.br/mv2008-julho/fotos/' + img.substring(0,img.length-4) + '.jpg';
	//document.getElementById('img').src = 'http://www.meuveiculo.com.br/mv2008-julho/scripts/redimensiona-250-188.asp?imagem=' + img.substring(0,img.length-4) + '.jpg';

}
else
{
	document.getElementById('img').style.display = '';
	document.getElementById('img').src = 'http://www.meuveiculo.com.br/mv2008-julho/fotos/'+img;
}
}

function ocultaBanner()
{
document.getElementById('banner').style.display = 'none';
document.getElementById('img').src = 'http://www.meuveiculo.com.br/mv2008-julho/imagens/carregando.gif';
}


function opcionais(id,e)
{
	document.getElementById('opcionais').innerHTML = "<center><img src=http://www.meuveiculo.com.br/mv2008-julho/imagens/opcionais.gif width=130 height=25 /></center><br>";
	
	if ( document.getElementById(id).value != '' )
		document.getElementById('opcionais').innerHTML += document.getElementById(id).value;
	else
		document.getElementById('opcionais').innerHTML += '<img src=http://www.meuveiculo.com.br/mv2008-julho/imagens/seta.gif> BASICO';
	
	document.getElementById('opcionais').style.display = '';
	document.getElementById('opcionais').style.top = (e.clientY+4)+(document.body.scrollTop);
	document.getElementById('opcionais').style.left = e.clientX+7;
}

function limpaOpcionais()
{
	document.getElementById('opcionais').style.display = 'none';
}



function popup(popup_url,name,largura,altura,barra,aumenta) {
	size = 'width=' + largura + ',height=' + altura + ',scrollbars=' + barra + ',resizable=' + aumenta;
	window.open(popup_url,name,'menubar=no,location=no,toolbar=no,status=no,directories=no,'+size);}
	
function exibir(nome) {
	window.open(nome,'popup','scrollbars=no, resizable=no, toolbar=no, location=no, directories=no, status=no, menubar=no, width=465, height=315, top=150, left=150');  }

function FunTrtVlr() {
	if ((!((event.keyCode >= 48) && (window.event.keyCode <= 57))) && (event.keyCode != 13)) 
	{
		event.returnValue = false;
		return false;
	}
	return true;
}

function mascara(o,f){
    v_obj=o
    v_fun=f
    setTimeout("execmascara()",1)
}

function execmascara(){
    v_obj.value=v_fun(v_obj.value)
}

function soNumeros(v){
    return v.replace(/\D/g,"")
}

function telefone(v){
    v=v.replace(/\D/g,"")                 //Remove tudo o que não é dígito
    v=v.replace(/^(\d\d)(\d)/g,"($1) $2") //Coloca parênteses em volta dos dois primeiros dígitos
    v=v.replace(/(\d{4})(\d)/,"$1-$2")    //Coloca hífen entre o quarto e o quinto dígitos
    return v
}

function cpf(v){
    v=v.replace(/\D/g,"")                    //Remove tudo o que não é dígito
    v=v.replace(/(\d{3})(\d)/,"$1.$2")       //Coloca um ponto entre o terceiro e o quarto dígitos
    v=v.replace(/(\d{3})(\d)/,"$1.$2")       //Coloca um ponto entre o terceiro e o quarto dígitos
                                             //de novo (para o segundo bloco de números)
    v=v.replace(/(\d{3})(\d{1,2})$/,"$1-$2") //Coloca um hífen entre o terceiro e o quarto dígitos
    return v
}

function cep(v){
    v=v.replace(/D/g,"")                //Remove tudo o que não é dígito
    v=v.replace(/^(\d{5})(\d)/,"$1-$2") //Esse é tão fácil que não merece explicações
    return v
}

function placa(v){
    //v=v.replace(/D/g,"")                //Remove tudo o que não é dígito
    v=v.replace(/^(\d{4})(\d)/,"$1-$2") //Esse é tão fácil que não merece explicações
    return v
}

function cnpj(v){
    v=v.replace(/\D/g,"")                           //Remove tudo o que não é dígito
    v=v.replace(/^(\d{2})(\d)/,"$1.$2")             //Coloca ponto entre o segundo e o terceiro dígitos
    v=v.replace(/^(\d{2})\.(\d{3})(\d)/,"$1.$2.$3") //Coloca ponto entre o quinto e o sexto dígitos
    v=v.replace(/\.(\d{3})(\d)/,".$1/$2")           //Coloca uma barra entre o oitavo e o nono dígitos
    v=v.replace(/(\d{4})(\d)/,"$1-$2")              //Coloca um hífen depois do bloco de quatro dígitos
    return v
}

function site(v){
    //Esse sem comentarios para que você entenda sozinho ;-)
    v=v.replace(/^http:\/\/?/,"")
    dominio=v
    caminho=""
    if(v.indexOf("/")>-1)
        dominio=v.split("/")[0]
        caminho=v.replace(/[^\/]*/,"")
    dominio=dominio.replace(/[^\w\.\+-:@]/g,"")
    caminho=caminho.replace(/[^\w\d\+-@:\?&=%\(\)\.]/g,"")
    caminho=caminho.replace(/([\?&])=/,"$1")
    if(caminho!="")dominio=dominio.replace(/\.+$/,"")
    v="http://"+dominio+caminho
    return v
}

function YNconfirm(txt){
	return typeof(suporteVBscript)=="Mensagem"?confirm(txt):VBconfirm(txt)==6
}

<!--
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_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_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}

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];}
}
//-->