/**  
 * VisãoI Sistemas
 * visaoi@visaoi.com.br
 * 
 * Rua Marcílio Dias, 26
 * Bairro Americano - Lajeado - RS
 * (51)3011-7001 | (51)8424-4494
 * 
 * DESCRIÇÃO
 * Javascripts do módulo site
 *
 * @author		Francisco Schwertner
 * @copyright   Copyright (c) 2005-2008 VisãoI Sistemas. (http://www.visaoi.com)
 * 
 */
$(function() {
	
	
	// cria o menu principal do módulo
	$('#site_menu_principal').jdMenu();
	
	/*
	* insere o flash do topo
	*
	*/
	$('#flash_topo').media({ 
	    width: 900,
    	height: 165,
	    autoplay:  true, 
	    bgColor: '',
	    src: baseurl+'/flash/site/topo.swf',
	    attrs:     { wmode:  'transparent' },  // object/embed attrs 
	    params:    { wmode:  'transparent' }, // object params/embed attrs 
	    caption:   false // supress caption text 
	});
	
	$('#visaoilogorodape').media({ 
	    width: 91,
    	height: 55,
	    autoplay:  true, 
	    bgColor: '',
	    src: baseurl+'/flash/site/logoVisaoi.swf',
	    attrs:     { wmode:  'transparent' },  // object/embed attrs 
	    params:    { wmode:  'transparent' }, // object params/embed attrs 
	    caption:   false // supress caption text 
	});
	
	/*
	* insere o flash da logomarca
	*
	*/
	$('#flash_destaques').media({ 
	    width: 790,
    	height: 220,
	    autoplay:  true,
	    bgColor: '', 
	    src: baseurl+'/flash/site/destaques.swf',
	    attrs:     { wmode:  'transparent' },  // object/embed attrs 
	    params:    { wmode:  'transparent' }, // object params/embed attrs 
	    caption:   false // supress caption text 
	});
	
	/*
	* insere o flash dos representantes
	*
	*/
	$('#flash_representantes').media({ 
	    width: 650,
    	height: 370,
	    autoplay:  true,
	    bgColor: '', 
	    src: baseurl+'/flash/site/representantes.swf',
	    attrs:     { wmode:  'transparent' },  // object/embed attrs 
	    params:    { wmode:  'transparent' }, // object params/embed attrs 
	    caption:   false // supress caption text 
	});
	
	
	/*
	* insere o flash da vista aérea
	*
	*/
	$('#tour').media({ 
	    width: 600,
    	height: 400,
	    autoplay:  true,
	    bgColor: '', 
	    src: baseurl+'/flash/site/tour.swf',
	    attrs:     { wmode:  'transparent' },  // object/embed attrs 
	    params:    { wmode:  'transparent' }, // object params/embed attrs 
	    caption:   false // supress caption text 
	});
	$("#tour").css("display", "none");
	$("#tour").append("<a href='javascript:;' onclick='tb_remove()'>FECHAR</a>");
	
	
	/*
	* insere o flash associe
	*
	*/
	$('#flash_associe').media({ 
	    width: 200,
    	height: 200,
	    autoplay:  true,
	    bgColor: '', 
	    src: baseurl+'/flash/site/associe.swf',
	    attrs:     { wmode:  'transparent' },  // object/embed attrs 
	    params:    { wmode:  'transparent' }, // object params/embed attrs 
	    caption:   false // supress caption text 
	});
	
	/*
	* insere o flash rodape
	*
	*/
	$('#flash_rodape').media({ 
	    width: 170,
    	height: 67,
	    autoplay:  true,
	    bgColor: '', 
	    src: baseurl+'/flash/site/rodape.swf',
	    attrs:     { wmode:  'transparent' },  // object/embed attrs 
	    params:    { wmode:  'transparent' }, // object params/embed attrs 
	    caption:   false // supress caption text 
	});
	
}); // fim jquery


/*
 * menu com abertura de submenu
 *
 */

var aberto = "";
var fechado = "";

function preload(){
	if(document.images){
		aberto = new Image(13,9) ;
		fechado = new Image(13,9);
		aberto.src = "../_img/setaAberto.gif";
		fechado.src = "../_img/setaFechado.gif";
	}
}
function mostra(item, item2){
	if (item.style.display=='none'){
		item.style.display='block';
		item2.src=aberto.src;
	}else{
		item.style.display='none';
		item2.src=fechado.src;
	}
}


/*
 * exibe e torna enabled select "filho"
 *
 */

function changeCombo(id,id_dst,value){
	if($('#'+id).val() == value){
		$('[for^='+id_dst+']').css('display','block');
		$('#'+id_dst).css('display','block');
		$('#'+id_dst).attr('disabled','');
	}else{
		$('[for^='+id_dst+']').css('display','none');
		$('#'+id_dst).css('display','none');
		$('#'+id_dst).attr('disabled','disabled');
	}
}


/*
 * torna enabled e chama action para ser para o select "filho"
 *
 */
function changeComboPlus(id, id_dst, action){
	if($('#'+id).val() != 0){
		val = $('#'+id).val();
		$.post(action,{value:val, id_ele:id_dst}, function(options){
			vars = eval(options);
			c = vars.length;
		
			$('#'+id_dst).children("option").remove();
		
			for(i = 0; i < c; i++){
				$('#'+id_dst).append("<option id='opt"+i+"' value="+vars[i].value+">"+vars[i].label+"</option>");
			}
		});
		
		//$('[for^='+id_dst+']').css('display','block');
		//$('#'+id_dst).css('display','block');
		$('#'+id_dst).attr('disabled','');
	}else{
		$('#'+id_dst).children("option").remove();
		//$('[for^='+id_dst+']').css('display','block');
		//$('#'+id_dst).css('display','block');
		$('#'+id_dst).attr('disabled','disabled');
	}
}


