﻿var rootUrl = document.location.href;
rootUrl = rootUrl.substr(0, rootUrl.indexOf('/', 8));
if (location.href.indexOf("/Institucional3") > -1) {
    rootUrl += "/Institucional3";
}
//rootUrl = "http://localhost";
function showFlash(swf, width, height, flashAlternative) {
    monta_swf = "";
    if ((navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.indexOf("Mac") == -1 && navigator.appVersion.indexOf("3.1") == -1) || (navigator.plugins && navigator.plugins["Shockwave Flash"]) || navigator.plugins["Shockwave Flash 2.0"]) {
        monta_swf += "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"  width=\"" + width + "\" height=\"" + height + "\" title=\"\">";
        monta_swf += "<param name=\"movie\" value=\"" + swf + "\" />";
        monta_swf += "<param name=\"quality\" value=\"high\" />";
        monta_swf += "<param name=\"menu\" value=\"0\" />";
        monta_swf += "<param name=\"wmode\" value=\"transparent\" />";
        monta_swf += "<embed src=\"" + swf + "\" quality=\"high\" wmode=\"transparent\" type=\"application/x-shockwave-flash\" width=\"" + width + "\" height=\"" + height + "\"></embed>";
        monta_swf += "</object>";
    }else if (flashAlternative != "" && flashAlternative != null){
        monta_swf += rootUrl + "/" + flashAlternative;
    }
    document.write(monta_swf);
}
function showFash(swf, width, height, flashAlternative) { showFlash(swf, width, height, flashAlternative); }
function $id(ID) {
    return document.getElementById(ID);
}
function HighLightMenu() {
    var URL = location.href.toLowerCase();
    if (URL.indexOf("produtos-para-rastreamento.htm") > -1) {
        $id("topo_menuItem_produtos").className = "topo_menuSelected";
    } else if (URL.indexOf("sobre-a-golsat.htm") > -1) {
        $id("topo_menuItem_sobre").className = "topo_menuSelected";
    } else if (URL.indexOf("comoComprar.aspx") > -1) {
        $id("topo_menuItem_comocomprar").className = "topo_menuSelected";
    } else if (URL.indexOf("fale-conosco.htm") > -1) {
        $id("topo_menuItem_faleconosco").className = "topo_menuSelected";
    } else if (URL.indexOf("faq.htm") > -1) {
        $id("topo_menuItem_faq").className = "topo_menuSelected";
    } else if (URL.indexOf("sua-empresa.htm") > -1) {
        $id("topo_menuItem_suaempresa").className = "topo_menuSelected";
    }    
}
window.onload = function() {
HighLightMenu();};
function loja_comprar(valor) {
    if (document.getElementById('chkContrato').checked) {
        document.getElementById('item_valor_1').value = valor;
        document.getElementById('frmPagseguro').submit();
    }else{
        var container = document.getElementById('chkContrato').parentNode;
        container.className = "atenction";
        alert("Atenção: você precisa concordar com os termos para continuar");
        document.getElementById('chkContrato').focus();
    }
}
function BuyRedirect(root, ID, desc, valor) {
    if (document.getElementById('chkContrato').checked) {
        location.href = root + "cadastro.aspx?prdID=" + ID + "&prdDesc=" + desc + "&valor=" + valor;
    }else{
        var container = document.getElementById('chkContrato').parentNode;
        container.className = "atenction";
        alert("Atenção: você precisa concordar com os termos para continuar");
        document.getElementById('chkContrato').focus();
    }
}
function ShowVideo(VideoPath, ThumbPath, AutoPlay, W, H) {
    var Width = (typeof (W) != "undefined") ? W : "240";
    var Height = (typeof (H) != "undefined") ? H : "176";
    var Buffer = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0\" width=\"" + Width + "\" height=\"" + Height + "\" id=\"Object3\" align=\"middle\">" +
    "<param name=\"allowScriptAccess\" value=\"sameDomain\" />" +
    "<param name=\"allowFullScreen\" value=\"false\" />" +
    "<param name=\"movie\" value=\"swf/FlvPlayer2.swf?VideoPath=" + VideoPath + "&ImagePath=" + ThumbPath + "&AutoPlay=" + AutoPlay + "\" />" +
    "<param name=\"quality\" value=\"high\" />	" +
    "<embed src=\"swf/FlvPlayer2.swf?VideoPath=" + VideoPath + "&ImagePath=" + ThumbPath + "&AutoPlay=" + AutoPlay + "\" quality=\"high\" " +
    "width=\"" + Width + "\" height=\"" + Height + "\" name=\"Video3\" align=\"middle\" " +
    "allowScriptAccess=\"sameDomain\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" " +
    "pluginspage=\"http://www.adobe.com/go/getflashplayer\" />" +
    "</object>";
    document.write(Buffer);
}