var iniWidth = 0, iniHeight = 0;
var l = 0;
var xPos;


// JavaScript Document
function red_tela(largura, altura){
	xInicio = largura/2 - document.getElementById('menu').offsetWidth/2 + document.getElementById('menu').offsetWidth;
	if(largura <= 1020){		
		xPos = 1020 - document.getElementById("head_phone").offsetWidth - 25;
		document.getElementById('head_phone').style.left = xPos+"px";
	} else {		
		xPos = xInicio + (largura-xInicio)/2 - document.getElementById("head_phone").offsetWidth/2 - 25;
		document.getElementById('head_phone').style.left = xPos+"px";
	}
//	document.getElementById('head_phone').style.left = (largura-280)+"px";
}

function reda_tela(){
	alertSize();
}
function inicia_tela(){
	document.getElementById('head_phone').style.visibility = "visible";
	alertSize();
}

function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  red_tela(myWidth, myHeight);
}

function mostrarAreaAtuacao(id_area){
	$.ajax({
	    type: "POST",
        url: "ajaxAreaAtuacaoDet.asp",
        data: "id_area="+id_area,
        success: function(data) {
    	    $('#contAreaAtuacao').html(data);
        }
    });	
}

function voltarAreaAtuacao(){
	$.ajax({
	    type: "POST",
        url: "ajaxAreaAtuacao.asp",
        success: function(data) {
    	    $('#contAreaAtuacao').html(data);
        }
    });	
}

function mostraEndereco(div, endereco){
	$("#"+div).gMap({ 
			markers: 
			[
				{
					address: "Rua Atlântica, 318, Jardim Paulista - São Paulo - SP - Brasil",
					html: "Rua Atlântica, 318, Jardim Paulista - São Paulo - SP - Brasil"
				}
				,
				{
					address: "Rua Rio Grande Sul, 210 - Barueri - SP - Brasil",
					html: "Rua Rio Grande Sul, 210 - Barueri - SP - Brasil" 
				}/*,
				{ 
					address: "Rua George Smith, 357 - São Paulo - SP - Brasil",
					html: "_address" 
				}*/
			],
			address: endereco,
			zoom: 15,
			icon:
			{
				image:              "_imagens/ico_map.png",
				shadow:             "_imagens/ico_map.png",
				iconsize:           [53, 37],
				shadowsize:         false,
				iconanchor:         [4, 19],
				infowindowanchor:   [8, 2]
			}
		});	
}

$(document).ready(function(){
	$("#rede_in, #rede_out").change(function() {
		if($(this).val() != ""){
			window.location = 'produtos_interna.asp?id_prod=1&combo='+$(this).attr('id')+'&id_unidade='+$(this).val();
		}
	});
});
