function popUpPag(URL){
    window.open(URL, '_chevNova', 'width=450, height=180, top=50%, left=50%, scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}

function newFlash(swf, width, height, flashvars, id){
    var escreveFlash = new String();
    
    if (navigator.appName.indexOf("Microsoft") != -1) {
        escreveFlash += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
        escreveFlash += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=version=8,0,0,0" ';
        escreveFlash += 'width="' + width + '" height="' + height + '" name="' + id + '"id = ' + id + '">';
        escreveFlash += '<param name="movie" value="' + swf + '"/>';
        if (flashvars != null) {
            escreveFlash += '<param name="flashvars" value="' + flashvars + '"/>'
        };
        escreveFlash += '<param name="menu" value="false"/>';
        escreveFlash += '<param name="salign" value="LT"/>';
        escreveFlash += '<param name="scale" value="noscale"/>';
        escreveFlash += '<param name="wmode" value="transparent"/>';
        escreveFlash += '<param name="allowScriptAccess" value="sameDomain"/>';
        escreveFlash += '</object>';
    }
    else {
        escreveFlash += '<embed src="' + swf + '" ';
        escreveFlash += 'width="' + width + '" ';
        escreveFlash += 'height="' + height + '" ';
        escreveFlash += 'id="' + id + '" ';
        escreveFlash += 'name="' + id + '" ';
        escreveFlash += 'menu="false" ';
        escreveFlash += 'scale="noscale" ';
        escreveFlash += 'salign="LT" ';
        escreveFlash += 'wmode="transparent" ';
        escreveFlash += 'allowScriptAccess="sameDomain" ';
        if (flashvars != null) {
            escreveFlash += 'flashvars="' + flashvars + '" '
        };
        escreveFlash += 'type="application/x-shockwave-flash" ';
        escreveFlash += 'pluginspage="http://www.macromedia.com/go/getflashplayer">';
        escreveFlash += '</embed>';
    }
    
    return escreveFlash;
}


function abrirUrl(url){
    window.open(url, 'cont', 'width=580px,height=600px, scrollbars=yes');
}

function veiculo(obj, carName){
    IE6 = (navigator.userAgent.toLowerCase().indexOf('msie 6') != -1) && (navigator.userAgent.toLowerCase().indexOf('msie 7') == -1)
    
    var imagem = obj.id;
    document.getElementById('area-direita').style.height = '345px';
    document.getElementById('area-esquerda').style.height = '345px';
    document.getElementById("nome-veiculo").src = "/images/titulos/" + obj.id + ".jpg"
    document.getElementById("mada").removeChild(document.getElementById('flash_div'));
    document.getElementById("mada").innerHTML = '<div id="flash_div" style="width:419px; height:227px;"></div>';
    document.getElementById("flash_div").innerHTML = newFlash("/flashs/autosnovos/" + imagem + ".swf", 419, 227, "", "flash_ddiv");
    document.getElementById("link_veic").href = "/autosnovos/show/" + obj.id;
    document.getElementById("link_cont").href = "javascript:window.open('" + carName + "')"
    document.getElementById("link_tech").href = "javascript:window.open('" + carName + "')"
    document.getElementById("veiculo_selecionado").value = imagem;
    if (obj.id == 0) {
        document.getElementById('detalhes-veiculo').style.display = 'none';
    }
    else {
        document.getElementById('detalhes-veiculo').style.display = 'inline';
    }
    
    if (obj.id == 15) {
        if (IE6 == true) {
            document.getElementById('imagebox15div').style.marginTop = '10px';
        }
        document.getElementById('area-direita').style.height = '380px';
        document.getElementById('area-esquerda').style.height = '380px';
        document.getElementById('imagebox15div').style.display = 'inline';
    }
    else {
        document.getElementById('imagebox15div').style.display = 'none';
    }
    if (obj.id == 16) {
        if (IE6 == true) {
            document.getElementById('imagebox16div').style.marginTop = '10px';
        }
        document.getElementById('area-direita').style.height = '380px';
        document.getElementById('area-esquerda').style.height = '380px';
        document.getElementById('imagebox16div').style.display = 'inline';
    }
    else {
        document.getElementById('imagebox16div').style.display = 'none';
    }
}

function abrirLink(obj, linkConteudo, linkEspecificacoes){
    IE6 = (navigator.userAgent.toLowerCase().indexOf('msie 6') != -1) && (navigator.userAgent.toLowerCase().indexOf('msie 7') == -1)
    
    var imagem = obj.id;
    document.getElementById('area-direita').style.height = '345px';
    document.getElementById('area-esquerda').style.height = '345px';
    document.getElementById("nome-veiculo").src = "/images/titulos/" + obj.id + ".jpg"
    document.getElementById("mada").removeChild(document.getElementById('flash_div'));
    document.getElementById("mada").innerHTML = '<div id="flash_div" style="width:419px; height:227px;"></div>';
    document.getElementById("flash_div").innerHTML = newFlash("/flashs/autosnovos/" + imagem + ".swf", 419, 227, "", "flash_ddiv");
    document.getElementById("link_veic").href = "/autosnovos/show/" + obj.id;
    document.getElementById("link_cont").href = "javascript:abrirUrl('" + linkConteudo + "')"
    document.getElementById("link_tech").href = "javascript:abrirUrl('" + linkEspecificacoes + "')"
    document.getElementById("veiculo_selecionado").value = imagem;
    if (obj.id == 0) {
        document.getElementById('detalhes-veiculo').style.display = 'none';
    }
    else {
        document.getElementById('detalhes-veiculo').style.display = 'inline';
    }
    
    if(IE6==true){            
		jQuery('#imagebox' + obj.id + 'div').css('margin-top', '10px');
    }
	jQuery('#area-direita').css('height', '380px');
    jQuery('#area-esquerda').css('height', '380px');
    jQuery('.imagebox15').hide();
	jQuery('#imagebox' + obj.id + 'div').show();
}
