function over(id,w){
document.getElementById(id).style.width = w+"px";
}

function out(id,w){
    document.getElementById(id).style.width = w+"px";
}

function setOpacity(domId, val) {
	obj = document.getElementById(domId);
	obj.style.MozOpacity = val;
	obj.style.opacity = val/10;
	obj.style.filter = 'alpha(opacity=' + val*10 + ')';
};

function fade(domId){
	obj = document.getElementById(domId); //Get the Element
	var alpha = 0; //Set the initial value of alpha to 10 (Opaque)
	function f(){ //Internal function
		alpha++; //Decrememnt the alpha value
		setOpacity(domId, alpha); //Set the opacity of our element to the specified alpha
		if(alpha < 11){ //If alpha is still bigger than -1 then..
			setTimeout(f, 10); //..then call the function again after 100 milliseconds
		}
	}
	setTimeout(f, 10); //This is where we call the f() function for the first time
};
//fim funcao do alpha


//funcao para esconder ou aparecer menu
function menus(id,elemento,alp){
    if(elemento == "" && alp == ""){
        limpa();
        limpa_alpha();
        exibe(id);
    }else{
        limpa();
        exibe(id);
        exibe(elemento);
        limpa_alpha();
        alpha(alp);
    }
}
//fim funcao para esconder ou aparecer menu

//limpa elementos
function limpa(){
	var e = new Array(16)
	e[0] = "menu_colecoes";
	e[1] = "menu_onde";
	e[2] = "menu_servicos";
	e[3] = "dest_gabriel";
	e[4] = "dest_gabriel2";
	e[5] = "dest_shoppingdd";
	e[6] = "dest_rio_casa_shopping";
	e[7] = "dest_brasilia";
	e[8] = "dest_curitiba";
	e[9] = "sobre_nos";
	e[10] = "dest_lavagem";
	e[11] = "dest_restauro";
	e[12] = "dest_acarpetamento";
	e[13] = "eventos2";
	e[14] = "cadastro";
	e[15] = "contato2";
//        e[16] = "trabalhe-conosco2";

	for (i=0;i<16;i++){
            document.getElementById(e[i]).style.display = "none";
	}
}
//fim limpa elementos

function exibe(id){
	document.getElementById(id).style.display = "block";
}

function limpa_alpha(){
    var o = new Array(12)
    o[0] = "sobre_nos";
    o[1] = "dest_gabriel";
    o[2] = "dest_gabriel2";
    o[3] = "dest_shoppingdd";
    o[4] = "dest_rio_casa_shopping";
    o[5] = "dest_brasilia";
    o[6] = "dest_curitiba";
    o[7] = "dest_lavagem";
    o[8] = "dest_restauro";
    o[9] = "dest_acarpetamento";
    o[10] = "eventos2";
    o[11] = "cadastro";
    o[12] = "contato2";
//    o[13] = "trabalhe-conosco2";

    for (i=0;i<12;i++){
    obj = document.getElementById(o[i]);
    obj.style.MozOpacity = 0;
    obj.style.opacity = 0;
    obj.style.filter = 'alpha(opacity=0)';
    }
}

function alpha(id){
    fade(id);
}

function menu(){
    var get = window.location.search.substring(3);
    if(get == 1){
            exibe("menu_colecoes");
            alpha("menu_colecoes");
    }
    if(get == 2){
            exibe("sobre_nos");
            alpha("sobre_nos");
    }
    if(get == 3){
            exibe("menu_onde");
            alpha("menu_onde");
    }
    if(get == 4){
            exibe("menu_servicos");
            alpha("menu_servicos");
    }
    if(get == 5){
            exibe("eventos2");
            alpha("eventos2");
    }
    if(get == 6){
            exibe("cadastro");
            alpha("cadastro");
    }
    if(get == 7){
            exibe("contato2");
            alpha("contato2");
    }
//    if(get == 8){
//            exibe("trabalhe-conosco2");
//            alpha("trabalhe-conosco2");
//    }

    fade("menu");
}

function carregando(){
  document.getElementById("carregando").style.display = "none";
}

function blog() {
	window.location.href='http://www.bykamy.com/blog';
}

function popup(url,w,h) {
	window.open(url,"popup","width=" + w + ",height= " + h + "");
}

//// FUNCOES DO TRABALHE CONOSCO
//function changediv(iddiv) {
//
//  $('div.tabtrabalhe a').removeClass('active');
//  $('div.tabtrabalhe a#link_'+iddiv+'').addClass('active');
//
//  if(iddiv == 'academico') {
//    $('table#cursos').fadeIn('fast');
//    $('table#informatica').hide();
//    $('table#idiomas').hide();
//  }
//
//  if(iddiv == 'pessoal') {
//    $('table#dados').fadeIn('fast');
//    $('table#deficiencia').hide();
//  }
//
//  if(iddiv == 'profissional') {
//    $('table#objetivos').fadeIn('fast');
//    $('table#experiencia').hide();
//  }
//
//  $('#profissional').hide();
//  $('#academico').hide();
//  $('#pessoal').hide();
//
//  $('#'+iddiv+'').fadeIn('fast');
//
//}
//
//function avancartrabalhe(atual, proximo) {
//   $('#'+atual+'').hide();
//   $('#'+proximo+'').fadeIn('fast');
//}



// SCROLL GALERIA
function goleft(){
  intervalo2 = '0';
  intervalo1 = setInterval(
      function(){
        var atual = $("div.scrollableArea").scrollLeft();
        $("div.scrollableArea").scrollLeft(atual-5);
      }
  ,1);
}

function goright(){
  intervalo1 = '0';
  intervalo2 = setInterval(
      function(){
        var atual = $("div.scrollableArea").scrollLeft();
        $("div.scrollableArea").scrollLeft(atual+5);
      }
  ,1);
}

function gopara(){
  clearInterval(intervalo2);
  clearInterval(intervalo1);
}

// GALERIA
function changeevento(id) {
    $.ajax({
       type: "POST",
       url: "/eventos/ajax.php",
       data: {
            "tarefa" : "trocarevento",
            "id" : ""+id+""
       },
       success: function(msg){
        $('#eventos').html(msg);
       }
    });
}

function changefoto(id){
  $('#imagem').html('<br><br><br><img src="/images/loading1.gif">');
  setTimeout("changefoto_load('"+id+"')", 500);
}

function changefoto_load(id) {
  $.ajax({
     type: "POST",
     url: "/eventos/ajax.php",
     data: {
          "tarefa" : "trocarfoto",
          "id" : ""+id+""
     },
     success: function(msg){
      $('#imagem').html(msg);
     }
  });
}
