// JavaScript Document

function checkForm(which){
	
	if(which.file1.value.length == 0){
		alert("Por favor, selecione o arquivo para continuar.");
		return false;
	}
}

function auto_tab(ini,len,itemx){
	
if (ini.value.length==len){document.getElementById(itemx).focus()}
}


	function format_num_math(num){
		num=num.replace(".","")
		num=num.replace(",",".")
		return num;
	}

function IsDate(day, month, year) {
	//IsDate(29, 2, 2005)
	//IsDate(29, 2, 2004)
	var date = new Date();
	var blnRet = false;
	var blnDay;
	var blnMonth;
	var blnYear;

	date.setFullYear(year, month -1, day);

	blnDay   = (date.getDate()      == day);
	blnMonth = (date.getMonth()     == month -1);
	blnYear  = (date.getFullYear()  == year);

	if (blnDay && blnMonth && blnYear)
	blnRet = true;

	return blnRet;
}


function Mascara(src, mask){
	var len = src.value.length;
	var saida = mask.substring(0,1);
	var texto = mask.substring(len);
	if (texto.substring(0,1) != saida){src.value += texto.substring(0,1)};
	if (len>=mask.length) {src.value=src.value.substring(0,mask.length)};
}

function valida_nome(nome) {
	var coisa = /^.{3,}\s.{3,}$/;
	return coisa.test(nome);
}

function valida_senha(senha) {
	var coisa = /^.{6}$/;
	return coisa.test(senha);
}
function jump_tel(de, para){
	if (de.length >= 2){
		para.focus();
	}
}
function Valida_cpf(cpf) {
	
     var numeros, digitos, soma, i, resultado, digitos_iguais;
      digitos_iguais = 1;
      if (cpf.length < 11)
            return false;
      for (i = 0; i < cpf.length - 1; i++)
            if (cpf.charAt(i) != cpf.charAt(i + 1))
                  {
                  digitos_iguais = 0;
                  break;
                  }
      if (!digitos_iguais)
            {
            numeros = cpf.substring(0,9);
            digitos = cpf.substring(9);
            soma = 0;
            for (i = 10; i > 1; i--)
                  soma += numeros.charAt(10 - i) * i;
            resultado = soma % 11 < 2 ? 0 : 11 - soma % 11;
            if (resultado != digitos.charAt(0))
                  return false;
            numeros = cpf.substring(0,10);
            soma = 0;
            for (i = 11; i > 1; i--)
                  soma += numeros.charAt(11 - i) * i;
            resultado = soma % 11 < 2 ? 0 : 11 - soma % 11;
            if (resultado != digitos.charAt(1))
                  return false;
            return true;
            }
      else
            return false;

}

function Valida_cnpj(ObjCnpj) {
	var msg = true;
    var cnpj = ObjCnpj;
    var valida = new Array(6,5,4,3,2,9,8,7,6,5,4,3,2);
    var dig1= new Number;
    var dig2= new Number;
    exp = /\.|\-|\//g
    cnpj = cnpj.toString().replace( exp, "" ); 
    var digito = new Number(eval(cnpj.charAt(12)+cnpj.charAt(13)));
    for(i = 0; i<valida.length; i++){
        dig1 += (i>0? (cnpj.charAt(i-1)*valida[i]):0);    
        dig2 += cnpj.charAt(i)*valida[i];    
    }
    dig1 = (((dig1%11)<2)? 0:(11-(dig1%11)));
    dig2 = (((dig2%11)<2)? 0:(11-(dig2%11)));
    
    if(((dig1*10)+dig2) != digito){msg = false};
	return msg;
}


function extraiScript(texto){
//Maravilhosa função feita pelo SkyWalker.TO do imasters/forum
//http://forum.imasters.com.br/index.php?showtopic=165277&
    // inicializa o inicio ><
    var ini = 0;
    // loop enquanto achar um script
    while (ini!=-1){
		
        // procura uma tag de script
        ini = texto.indexOf('<script', ini);
        // se encontrar
        if (ini >=0){
            // define o inicio para depois do fechamento dessa tag
            ini = texto.indexOf('>', ini) + 1;
            // procura o final do script
            var fim = texto.indexOf('</script>', ini);
            // extrai apenas o script
            codigo = texto.substring(ini,fim);
            // executa o script
            //eval(codigo);
            /**********************
            * Alterado por Micox - micoxjcg@yahoo.com.br
            * Alterei pois com o eval não executava funções.
            ***********************/
            novo = document.createElement("script")
            novo.text = codigo;
            document.body.appendChild(novo);
        }
    }
}


function monta_campos_sql_V2(pico,idx){
	
	var campos = "campo_array="
	var tipos = "tipo_array="
	
	$(pico).find("input").each(function(){
		
		var field = $(this);
		if($(field).attr("type")!="button" && (typeof($(field).attr("matchField"))=='undefined' || $(field).attr("matchField")=='' )){
			if(($(field).attr("type")=="radio")){
						if($(field).is(':checked') ){
		campos = campos+','+$(field).attr("id").replace(idx,'')
		tipos = tipos+','+$(field).attr("fieldType")
						}
						}
			else{
				
		campos = campos+','+$(field).attr("id").replace(idx,'')
		tipos = tipos+','+$(field).attr("fieldType")
				}			
		}
		
		})
		
		$(pico).find("textarea").each(function(){
		
		var field = $(this);
		
		campos = campos+','+$(field).attr("id").replace(idx,'')
		tipos = tipos+','+$(field).attr("fieldType")
				
			
		})
		
			$(pico).find("select").each(function(){
		
		var field = $(this);
		
		campos = campos+','+$(field).attr("id").replace(idx,'')
		tipos = tipos+','+$(field).attr("fieldType")
				
			
		})
		
	parax=(monta_campos_sql_simples(pico,'')+''+campos+'&'+tipos+'&')
	return parax
		}



function monta_campos_sql(pico,idx){
	
	var campos = "campo_array="
	var tipos = "tipo_array="
	
	$(pico).find("input").each(function(){
		
		var field = $(this);
		if($(field).attr("type")!="button" && typeof($(field).attr("matchField"))=='undefined'){
			if(($(field).attr("type")=="radio")){
						if($(field).is(':checked') ){
		campos = campos+','+$(field).attr("id")
		tipos = tipos+','+$(field).attr("sqlType")
						}
						}
			else{
		campos = campos+','+$(field).attr("id")
		tipos = tipos+','+$(field).attr("sqlType")
				}			
		}
		
		})
		
		$(pico).find("textarea").each(function(){
		
		var field = $(this);
		
		campos = campos+','+$(field).attr("id")
		tipos = tipos+','+$(field).attr("sqlType")
				
			
		})
		
			$(pico).find("select").each(function(){
		
		var field = $(this);
		
		campos = campos+','+$(field).attr("id")
		tipos = tipos+','+$(field).attr("sqlType")
				
			
		})
		
	parax=(monta_campos_sql_simples(pico,idx)+''+campos+'&'+tipos+'&')
	return parax
		}
		
function monta_campos_sql_simples(pico,ididx){
	var para = ""
var	 idxx = ididx
	$(pico).find("input").each(function(){
		
		var field = $(this);
	if($(field).attr("type")!="button"  && (typeof($(field).attr("matchField"))=='undefined' || $(field).attr("matchField")=='' ) ){
		//if(typeof($(field).attr("matchField"))=='undefined'){alert("dsds")}
					
					if(($(field).attr("type")=="radio")){
						if($(field).is(':checked') ){
						para=para+$(field).attr("id")+idxx+'='+escape($(field).val())+'&'
						}
					}else
					{
						if($(field).attr("type")=="checkbox"){
								if($(field).is(':checked') ){
									para=para+$(field).attr("id")+idxx+'='+$(field).val()+'&'
									}else
									{
									para=para+$(field).attr("id")+idxx+'=0&'
									}
						}else{
					para=para+$(field).attr("id")+idxx+'='+escape($(field).val())+'&'	
					}
					}
		}
		
		})
	
	$(pico).find("textarea").each(function(){
		var field = $(this);
		para=para+$(field).attr("id")+idxx+'='+escape($(field).val())+'&'
		
		
	})
	
		$(pico).find("select").each(function(){
			
		var field = $(this);
		para=para+$(field).attr("id")+idxx+'='+escape($(field).val())+'&'
		
		
	})
	
	return (para)
		}

function GetXmlObject(){
var xmlhttp=null;
try
  {  xmlhttp=new XMLHttpRequest();  }
catch (e)
  {
try
    {    xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");    }  
catch (e)
    {    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
  }
return xmlhttp;

}


function GetXmlObject2(){
var xmlhttp2=null;try  {  xmlhttp2=new XMLHttpRequest();  }catch (e)  {try    {    xmlhttp2=new ActiveXObject("Msxml2.XMLHTTP");    }  catch (e)    {    xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP"); }  }return xmlhttp2;
}





function atualiza_div_0(div,urlx){
var xmx='var xmlhttp'+cont+'=null;try{xmlhttp'+cont+'=new XMLHttpRequest();}catch (e){try{xmlhttp'+cont+'=new ActiveXObject("Msxml2.XMLHTTP");}catch (e){xmlhttp'+cont+'=new ActiveXObject("Microsoft.XMLHTTP"); }  };'
xmx2 = 'xmlhttp'+cont+' = eval(xmx)'
eval(xmx2)
var pg_temp="<table cellspacing='5' cellpadding='9' border='0'  class='tab1_div' width='100%'><tr><td valign='middle' align='center'><b>Carregando... </b><br><br><img src='../sis/img/loading.gif' width='30px'></center></table>"
var xmx3='function {if(xmlhttp'+cont+'.readyState<=3){}if(xmlhttp'+cont+'.readyState==4){document.getElementById(id_id_fixo'+cont+').innerHTML=(xmlhttp'+cont+'.responseText);}}'
eval('id_id_fixo'+cont+'=div;xmlhttp'+cont+'.onreadystatechange=function() { if(xmlhttp'+cont+'.readyState<=3){document.getElementById(id_id_fixo'+cont+').innerHTML = pg_temp }if(xmlhttp'+cont+'.readyState==4){document.getElementById(id_id_fixo'+cont+').innerHTML=(xmlhttp'+cont+'.responseText);}};xmlhttp'+cont+'.open("GET",urlx+"&tm="+Math.random(),true);xmlhttp'+cont+'.send(null);')
}

function atualiza_div_post_0(div,urlx,parametros){
	
var xmx='var xmlhttp'+cont+'=null;try{xmlhttp'+cont+'=new XMLHttpRequest();}catch (e){try{xmlhttp'+cont+'=new ActiveXObject("Msxml2.XMLHTTP");}catch (e){xmlhttp'+cont+'=new ActiveXObject("Microsoft.XMLHTTP"); }  };'
xmx2 = 'xmlhttp'+cont+' = eval(xmx)'
eval(xmx2)
var pg_temp="<table cellspacing='5' cellpadding='9' border='0'  class='tab1_div' width='100%'><tr><td valign='middle' align='center'><b>Carregando... </b><br><br><img src='../sis/img/loading.gif' width='30px'></center></table>"
var xmx3='function {if(xmlhttp'+cont+'.readyState<=3){}if(xmlhttp'+cont+'.readyState==4){document.getElementById(id_id_fixo'+cont+').innerHTML=(xmlhttp'+cont+'.responseText);}}'
eval('id_id_fixo'+cont+'=div;xmlhttp'+cont+'.onreadystatechange=function() { if(xmlhttp'+cont+'.readyState<=3){document.getElementById(id_id_fixo'+cont+').innerHTML = pg_temp }if(xmlhttp'+cont+'.readyState==4){document.getElementById(id_id_fixo'+cont+').innerHTML=(xmlhttp'+cont+'.responseText);}};xmlhttp'+cont+'.open("POST",urlx+"&tm="+Math.random(),true);xmlhttp'+cont+'.setRequestHeader("Content-type", "application/x-www-form-urlencoded");xmlhttp'+cont+'.setRequestHeader("Content-length", parametros.length);xmlhttp'+cont+'.setRequestHeader("Connection", "close");xmlhttp'+cont+'.send(parametros);')
}



function atualiza_div2(div,urlx){
xmlhttp2 = GetXmlObject2()
id_id_fixo2=div
xmlhttp2.onreadystatechange=ajax_id2;
xmlhttp2.open("GET",urlx+"&tm="+Math.random(),true);
xmlhttp2.send(null);
}



 function open_tooltip(div,url,larg,event)
 {
	$("#"+div).resizable( "destroy" )
	yy=mouse_y(event)

     ///alert($("#"+div).resizable())
	 if(larg!=null){
	 $("#"+div).width(larg+"px")
	 
	 }
	 $("#"+div).css("top",yy)
	 $("#"+div).css("display","inline")
	//j("#"+div).fadeTo("slow",1.0,function(){j("#"+div).addClass("tooltip");alert("sd")});

	 // 
	  atualiza_div_tip(div,url)


	

 }
function ajax_id(){
var switcher = document.getElementById(id_id_fixo);
if(xmlhttp.readyState<=3){
switcher.innerHTML = "<table cellspacing='5' cellpadding='9' border='0'  class='tab1_div' width='100%'><tr><td valign='middle' align='center'><b>Carregando... </b><br><br><img src='../sis/img/loading.gif' width='30px'></center></table>"
}
if(xmlhttp.readyState==4){	
var x = xmlhttp.responseText;
extraiScript(x);
switcher.innerHTML=x;
}
}

function ajax_id_tip(){
var switcher = document.getElementById(id_id_fixo);
if(xmlhttp.readyState<=3){
switcher.innerHTML = "<table cellspacing='5' cellpadding='9' border='0'  class='tab1_div' width='100%'><tr><td valign='middle' align='center'><b>Carregando... </b><br><br><img src='../sis/img/loading.gif' width='30px'></center></table>"
}
if(xmlhttp.readyState==4){	
var x = xmlhttp.responseText;
extraiScript(x);
switcher.innerHTML=x;
$('#'+id_id_fixo).resizable( {minWidth: 150, minHeight: 150} );$('#'+id_id_fixo).draggable();


}
}

function ajax_id2(){
var switcher2 = document.getElementById(id_id_fixo2);
if(xmlhttp2.readyState<=3){
switcher2.innerHTML = "<table cellspacing='5' cellpadding='9' border='0'  class='tab1_div' width='100%'><tr><td valign='middle' align='center'><b>Carregando... </b><br><br><img src='../sis/img/loading.gif' width='30px'></center></table>"
}
if(xmlhttp2.readyState==4){	
var x = xmlhttp2.responseText;
extraiScript(x);
switcher2.innerHTML=x;
}
}



function switch_(){
	
var switcher = document.getElementById(id_id_fixo);
		if(xmlhttp.readyState<=3){
		switcher.innerHTML = "...carregando"
		}
		
		if(xmlhttp.readyState==4){			
		var x = xmlhttp.responseText;
		extraiScript(x);
		switcher.innerHTML=x;
		
}
	}

function mostra_ef_id(id)
{
	if (document.getElementById(id).style.display == "none")
	{document.getElementById(id).style.display = "inline";
	Effect.Fade('geral', {to: 0.3}); return false;
		
	}
	else
	{
		document.getElementById(id).style.display = "none";
		Effect.Appear('geral', {to: 1}); return false;
	}	
}



function tool_tip_div(event,div_mov,larg_div){
	
	if (typeof(larg_div)=="undefined"){
		var ajuste=10
		}
		else{
		if (larg_div==""){var ajuste=10}
		else{
		var ajuste = (1*larg_div+30)*(-1)
		document.getElementById(div_mov).style.width = larg_div+'px';
		}
		}
	
mouse_xy(event)
_x=_x-0
_y=_y-0
//alert(_x+"dsdsds"+_y)
document.getElementById(div_mov).style.top = _y+'px';
document.getElementById(div_mov).style.left = (_x+ajuste)+'px';
document.getElementById(div_mov).style.display="block";

}

function at_td_sel (id_id,div_pop,n_par,url) {
	
	
	if (typeof(n_par)!="undefined"){
	n_par = n_par.split(',');
	//alert(n_par.length)
	var url3=""
	for (i=0; i<n_par.length-1;i++)
	{
	valor_box=document.getElementById(n_par[i]).value	
	url3 = url3+"&"+ n_par[i] +"="+document.getElementById(n_par[i]).value
	//alert(url3)
	document.getElementById("td_"+n_par[i]).innerHTML=document.getElementById(n_par[i]).value
	}
}
	

	xmlhttp = GetXmlObject()
	var url2=url+".asp";
url2 = url2+"?id_id="+id_id+url3

url2 = url2+"&tm="+Math.random();
//xmlhttp.onreadystatechange=ajax_div;
//alert(url2)
//alert(url2)
xmlhttp.open("GET",url2,true);
xmlhttp.send(null);
mostra_id(div_pop)

}


function prontothis(id_id,url,nome_box){

//var conf=confirm("Voce tem certeza que deseja modificar esse item?")
var conf=true
if (conf==true){
//alert(conf)

var valor_box;
//alert(document.getElementById(nome_box).checked)
if(nome_box.checked==true){

valor_box="1";
}
else{
valor_box="0";

}
//alert(valor_box)
xmlhttp = GetXmlObject()
if (xmlhttp==null){
alert('Seu navegador não suporta Ajax');
return;
}

var url2=url;
url2 = url2+"&id_id="+id_id
url2 = url2+"&valor_box="+valor_box
url2 = url2+"&tm="+Math.random();
//xmlhttp.onreadystatechange=ajax_div;
//alert(url2)
xmlhttp.open("GET",url2,true);
xmlhttp.send(null);
}
else
{
	if(nome_box.checked==true){
	nome_box.checked=false	
	}else{nome_box.checked=true}
}
}


function pronto(id_id,url,nome_box){

//var conf=confirm("Voce tem certeza que deseja modificar esse item?")
var conf=true
if (conf==true){
//alert(conf)

var valor_box;
//alert(document.getElementById(nome_box).checked)
if(document.getElementById(nome_box).checked==true){

valor_box="1";
}
else{
valor_box="0";

}
//alert(valor_box)
xmlhttp = GetXmlObject()
if (xmlhttp==null){
alert('Seu navegador não suporta Ajax');
return;
}

var url2=url+".asp";
url2 = url2+"?id_id="+id_id
url2 = url2+"&valor_box="+valor_box
url2 = url2+"&tm="+Math.random();
//xmlhttp.onreadystatechange=ajax_div;
//alert(url2)
xmlhttp.open("GET",url2,true);
xmlhttp.send(null);
}
else
{
	if(document.getElementById(nome_box).checked==true){
	document.getElementById(nome_box).checked=false	
	}else{document.getElementById(nome_box).checked=true}
}
}


function mouse_xy(eventx){
	
var marginX = 0; //distancia do mouse em x
var marginY = 0; //distancia do mouse em y

 _x = 0;
 _y = 0;


var lar_janela = document.body.clientWidth || innerWidth

	if (document.all) {//IE
		_x = (document.documentElement && document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft;
		_y = (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;
		_x += (window.event.clientX+marginX);
		_y += (window.event.clientY+marginY);
	} else {//Good Browsers

		_x = (eventx.pageX+marginX);
		_y = (eventx.pageY+marginY);
		
	if (typeof(eventx.pageX)=="undefined"){
	_x = 300
	_y = 200
	}	
	}
	
}

function mouse_x(eventx){


 var _x = 0;




	if (document.all) {//IE
	var lar_janela = document.body.clientWidth || innerWidth
		_x = (document.documentElement && document.documentElement.scrollLeft) ? document.documentElement.scrollLeft : document.body.scrollLeft;
	
		_x += (window.event.clientX);
	} else {//Good Browsers

	
		_x = (eventx.pageX);
		
	if (typeof(eventx.pageX)=="undefined"){

	_x = 200
	}	
	}
	return _x
	
}

function mouse_y(eventx){


 var _y = 0;




	if (document.all) {//IE
	var lar_janela = document.body.clientWidth || innerWidth
		_y = (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop;
	
		_y += (window.event.clientY);
	} else {//Good Browsers

	
		_y = (eventx.pageY);
		
	if (typeof(eventx.pageX)=="undefined"){

	_y = 200
	}	
	}
	return _y
	
}



function tool_tip_div(event,div_mov,larg_div){
	
	if (typeof(larg_div)=="undefined"){
		var ajuste=10
		}
		else{
		if (larg_div==""){var ajuste=10}
		else{
		var ajuste = (1*larg_div+30)*(-1)
		document.getElementById(div_mov).style.width = larg_div+'px';
		}
		}
	
mouse_xy(event)
_x=_x-9
_y=_y-9

document.getElementById(div_mov).style.top = _y+'px';
document.getElementById(div_mov).style.left = (_x+ajuste)+'px';
document.getElementById(div_mov).style.display="block";

}


function box_new(event,valor,id_campo,div_url,url_op){

	if (valor=="0")
	{
		show_usuarios(event,id_campo,div_url,'',url_op);
		
	}
	else 
	
	{
		
		
		
			}
		
		}
	

function show_usuarios(event,id_perfil,div,larg_div,urlx){
	
xmlhttp = GetXmlObject()
if (xmlhttp==null){
alert('Seu navegador não suporta Ajax');
return;
}
id_id_fixo=div

if (typeof(urlx)=="undefined"){url=div;}
else{
if (urlx==""){url=div}
else{
	url=urlx;
	}}

var url2=url+'.asp';
url2 = url2+"?id_perfil="+id_perfil
url2 = url2+"&tm="+Math.random();
xmlhttp.onreadystatechange=ajax_id;
xmlhttp.open("GET",url2,true);
xmlhttp.send(null);
tool_tip_div(event,id_id_fixo,larg_div)
//ef_black1()
}

function atualiza_div(div,urlx){

xmlhttp = GetXmlObject()
if (xmlhttp==null){
alert('Seu navegador não suporta Ajax');
return;
}
id_id_fixo=div
	

var url2=urlx
//url2 = url2+"?id_perfil="+id_perfil
url2 = url2+"&tm="+Math.random();

xmlhttp.onreadystatechange=ajax_id;
xmlhttp.open("GET",url2,true);
xmlhttp.send(null);

}








function atualiza_div_tip(div,urlx){

xmlhttp = GetXmlObject()
if (xmlhttp==null){
alert('Seu navegador não suporta Ajax');
return;
}
id_id_fixo=div
	

var url2=urlx
//url2 = url2+"?id_perfil="+id_perfil
url2 = url2+"&tm="+Math.random();

xmlhttp.onreadystatechange=ajax_id_tip;
xmlhttp.open("GET",url2,true);
xmlhttp.send(null);

}



function atualiza_div_ef(div,urlx){
Effect.Appear(div, {to: 1});
atualiza_div(div,urlx)
ef_black1()
}

function check_msg(urlx,n_msg,url_funcao,div_funcao){

xmlhttp = GetXmlObject()
if (xmlhttp==null){
alert('Seu navegador não suporta Ajax');
return;
}

var url2=urlx
url_funcaox=url_funcao
div_funcaox=div_funcao
n_msgx=n_msg


url2 = url2+"&tm="+Math.random();

xmlhttp.onreadystatechange=ajax_idxxx;
xmlhttp.open("GET",url2,true);
xmlhttp.send(null);

}




function ajax_idxxx(){

if(xmlhttp.readyState==4){	
var x = xmlhttp.responseText;
if (x!=n_msgx){
//alert(url_funcaox)
//document.getElementById('n_msg').value=x
atualiza_div(div_funcaox,url_funcaox)
}
}
}

function ef_black1()
{
	if ( typeof(black_div)=="undefined"  || black_div==""){
	document.getElementById('black').style.height = pag_size()[1]+"px"
	document.getElementById('black').style.width = pag_size()[0]+"px" 
	black_div="x"
	Effect.Appear('black', {duration:1.0 ,from: 0.0,to: 0.6}); return false;
	}else
{black_div="y";}
	}

	function ef_black2()
{
		black_div=""
new Effect.Appear('black', {duration:0.5, to: 0.0}); 
var xxxx = function testexx (){document.getElementById('black').style.display = "none";}
setTimeout(xxxx, 1000)
}
function pag_size()
{
	        
	     var xScroll, yScroll;
		
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = window.innerWidth + window.scrollMaxX;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		
		var windowWidth, windowHeight;
		
		if (self.innerHeight) {	// all except Explorer
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth; 
			} else {
				windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}	
		
		// for small pages with total height less then height of the viewport
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else { 
			pageHeight = yScroll;
		}
	
		// for small pages with total width less then width of the viewport
		if(xScroll < windowWidth){	
			pageWidth = xScroll;		
		} else {
			pageWidth = windowWidth;
		}

		return [pageWidth,pageHeight];
	}
	
	
	function mostra_id(id)
{
	if (document.getElementById(id).style.display == "none")
	{
		document.getElementById(id).style.display = "inline";
	}
	else
	{
		document.getElementById(id).innerHTML=""
		document.getElementById(id).style.display = "none";
	if (typeof(black_div)!="undefined"){	
	if (black_div=="x"){ef_black2()} else {black_div="x";} }
	
		if (typeof(white_div)!="undefined"){	
	
		if (white_div=="x"){geral_ef2()}}
	}	
}


function pronto_geral(url,div,array_campo,div_at,url_at)
{

	n_par = array_campo;
	n_par = n_par.split(',');
	var url3=""
	url3 = url;
	url3 = url3 + ".asp?xxx=1"
	
	for (i=0; i<n_par.length;i++){	
	url3 = url3+"&"+ n_par[i] + "="+document.getElementById(n_par[i]).value;	 	
	}
	
	xmlhttp = GetXmlObject()
url3 = url3+"&tm="+Math.random();

//xmlhttp.onreadystatechange=ajax_div;
//alert(url2)

xmlhttp.open("GET",url3,true);
xmlhttp.send(null);

xmlhttp = GetXmlObject()

	id_id_fixo=div_at
		var url2=url_at+".asp";

url2 = url2+"?xxx=1"
//alert(url2)
url2 = url2+"&tm="+Math.random();
xmlhttp.onreadystatechange=ajax_id;
//alert(url2)
xmlhttp.open("GET",url2,true);
xmlhttp.send(null);

mostra_id(div);

}

 function click_enter(e,funcao) // submit key
  
              {
   
                if (e.keyCode == 13) // 13 = enter key
   
                {
   				eval(funcao)
                 //alert($("#"+funcao).attr("onclick").toString())
  
                }
  
              } 


function filtrar_top(div,comp,pagina){
	para = (monta_campos_sql_simples($('#filtros_top'),'')+'1=1'+comp)
	
	$('#' + div).loaderSimple();
	$.get(pagina+'?tm='+Math.random()+'&'+para,
			function(result){
				$('#'+div).html(result);
				//$('#' + div).loaderSimple({ show : false });
			}
	);
	
	//atualiza_div(div,pagina+'?'+para)
	}


	function mostra_id_simples(id)
{
	if (document.getElementById(id).style.display == "none")
	{
		document.getElementById(id).style.display = "inline";
	}
	else
	{
	
		document.getElementById(id).style.display = "none";
	
	}	
}

function monta_campos(id){ 

  //alert(document.getElementById("campo_array").value)
   n_par=document.getElementById("campo_array"+id).value
   t_par=document.getElementById("tipo_array"+id).value
   
  	n_par = n_par.split(',');
		t_par = t_par.split(',');
	
	var url3="campo_array="+document.getElementById("campo_array"+id).value+"&tipo_array="+document.getElementById("tipo_array"+id).value
	for (i=1; i<n_par.length-0;i++)
	{
		//alert(t_par[i]+id)
		//alert(document.getElementById(n_par[i]).value)
	//valor_box=document.getElementById(n_par[i]).value	
	if (t_par[i]!="d"){
		if (t_par[i]=="t"){
	url3 = url3+"&"+ n_par[i] +id+"="+escape(document.getElementById(n_par[i]+id).value)}
	else{
		url3 = url3+"&"+ n_par[i] +id+"="+document.getElementById(n_par[i]+id).value
	}
	}
	else{
		url3 = url3+"&d"+ n_par[i] +id+"="+document.getElementById("d"+n_par[i]+id).value
		url3 = url3+"&m"+ n_par[i] +id+"="+document.getElementById("m"+n_par[i]+id).value
		url3 = url3+"&y"+ n_par[i] +id+"="+document.getElementById("y"+n_par[i]+id).value
	}
	//alert(url3)
	//document.getElementById("td_"+n_par[i]).innerHTML=document.getElementById(n_par[i]).value
	}
	return(url3)
	
  }
  
  function monta_campos2(id){ 

  //alert(document.getElementById("campo_array").value)
   n_par=document.getElementById("campo_array2"+id).value
   t_par=document.getElementById("tipo_array2"+id).value
  	n_par = n_par.split(',');
		t_par = t_par.split(',');
	
	var url3="campo_array="+document.getElementById("campo_array2"+id).value+"&tipo_array="+document.getElementById("tipo_array2"+id).value
	for (i=1; i<n_par.length-0;i++)
	{
		//alert(t_par[i]+id)
		//alert(document.getElementById(n_par[i]).value)
	//valor_box=document.getElementById(n_par[i]).value	
	if (t_par[i]!="d"){
		if (t_par[i]=="t"){
	url3 = url3+"&"+ n_par[i] +id+"="+escape(document.getElementById(n_par[i]+id).value)}
	else{
		url3 = url3+"&"+ n_par[i] +id+"="+document.getElementById(n_par[i]+id).value
	}
	}
	else{
		url3 = url3+"&d"+ n_par[i] +id+"="+document.getElementById("d"+n_par[i]+id).value
		url3 = url3+"&m"+ n_par[i] +id+"="+document.getElementById("m"+n_par[i]+id).value
		url3 = url3+"&y"+ n_par[i] +id+"="+document.getElementById("y"+n_par[i]+id).value
	}
	//alert(url3)

	//document.getElementById("td_"+n_par[i]).innerHTML=document.getElementById(n_par[i]).value
	}
	return(url3)
	
  }
  
  function monta_campos3(id){ 

  //alert(document.getElementById("campo_array").value)
   n_par=document.getElementById("campo_array3"+id).value
   t_par=document.getElementById("tipo_array3"+id).value
  	n_par = n_par.split(',');
		t_par = t_par.split(',');
	
	var url3="campo_array="+document.getElementById("campo_array3"+id).value+"&tipo_array="+document.getElementById("tipo_array3"+id).value
	for (i=1; i<n_par.length-0;i++)
	{
		//alert(t_par[i]+id)
		//alert(document.getElementById(n_par[i]).value)
	//valor_box=document.getElementById(n_par[i]).value	
	if (t_par[i]!="d"){
		if (t_par[i]=="t"){
	url3 = url3+"&"+ n_par[i] +id+"="+escape(document.getElementById(n_par[i]+id).value)}
	else{
		url3 = url3+"&"+ n_par[i] +id+"="+document.getElementById(n_par[i]+id).value
	}
	}
	else{
		url3 = url3+"&d"+ n_par[i] +id+"="+document.getElementById("d"+n_par[i]+id).value
		url3 = url3+"&m"+ n_par[i] +id+"="+document.getElementById("m"+n_par[i]+id).value
		url3 = url3+"&y"+ n_par[i] +id+"="+document.getElementById("y"+n_par[i]+id).value
	}
	//alert(url3)
	//document.getElementById("td_"+n_par[i]).innerHTML=document.getElementById(n_par[i]).value
	}
	return(url3)
	
  }
  
  
  function atualiza_div_post(div,urlx,para){

xmlhttp = GetXmlObject()
id_id_fixo=div
	

var url2=urlx
//url2 = url2+"?id_perfil="+id_perfil
url2 = url2+"?tm="+Math.random();

xmlhttp.onreadystatechange=ajax_id;
xmlhttp.open("POST",url2,true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
//xmlhttp.setRequestHeader("Content-type", "text/html; charset=iso-8859-1");
      xmlhttp.setRequestHeader("Content-length", para.length);
      xmlhttp.setRequestHeader("Connection", "close");
 //parax = escape(parax.replace(/\+/g," "))
xmlhttp.send((para));

}

function show_data(sinal,div_data)

{
if (document.getElementById(div_data).style.display != "inline"){
document.getElementById(div_data).style.display = "inline"
sinal.innerHTML ="-"
}
else {
document.getElementById(div_data).style.display = "none"
sinal.innerHTML ="+"
}
}
function pronto_basico(url){


//alert(valor_box)
xmlhttp = GetXmlObject()
if (xmlhttp==null){
alert('Seu navegador não suporta Ajax');
return;
}

var url2=url;
url2 = url2+"&tm="+Math.random();
//xmlhttp.onreadystatechange=ajax_div;
//alert(url2)
xmlhttp.open("GET",url2,true);
xmlhttp.send(null);
}

function pronto_basico_post(url,para){


//alert(valor_box)
xmlhttp = GetXmlObject()
if (xmlhttp==null){
alert('Seu navegador não suporta Ajax');
return;
}

var url2=url;
url2 = url2+"?tm="+Math.random();
//xmlhttp.onreadystatechange=ajax_div;
//alert(url2)
xmlhttp.open("POST",url2,true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlhttp.setRequestHeader("Content-length", para.length);
      xmlhttp.setRequestHeader("Connection", "close");

xmlhttp.send(para);
}

		// Drag and drop
		  var objSelecionado = null;
		  var mouseOffset = null;

document.onmousemove = function(ev) {
//alert(" sdsds")
var ev = ev || window.event;
var mousePos = mouseCoords(ev);
if (objSelecionado) {
	
  document.getElementById(objSelecionado).style.left = mousePos.x - mouseOffset.x + 'px';
  document.getElementById(objSelecionado).style.top = mousePos.y - mouseOffset.y + 'px';
  document.getElementById(objSelecionado).style.margin = '0px';
  return false;
}
}

  function dragdrop2(caixa_movida, ev) {

  objSelecionado = caixa_movida;
  mouseOffset = getPosition(caixa_movida, ev);

}

function getPosition(e, ev){
e = document.getElementById(e);
var left = 0;
var top  = 0;
var coords = mouseCoords(ev);
while (e.offsetParent){
  left += e.offsetLeft;
  top  += e.offsetTop;
  e     = e.offsetParent;
}
left += e.offsetLeft;
top  += e.offsetTop;
return {x: coords.x - left, y: coords.y - top};
}
document.onmouseup = function() {
objSelecionado = null;
}

  function dragdrop2(caixa_movida, ev) {

  objSelecionado = caixa_movida;
  mouseOffset = getPosition(caixa_movida, ev);

}

function mouseCoords(ev){
if(ev.pageX || ev.pageY){
  return {x:ev.pageX, y:ev.pageY};
}
return {
  x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
  y:ev.clientY + document.body.scrollTop  - document.body.clientTop
};
}

function mostra_menu(){
	
	
	if (document.getElementById('td_menu').style.display=="none"){
		//document.getElementById('td_menu2').style.width = 160+'px';
	document.getElementById('td_menu').style.display="inline";
	document.getElementById('menu_show').innerHTML="(-) Ocultar Menu";}
	else {
		//document.getElementById('td_menu2').style.width = 1+'px';
	document.getElementById('td_menu').style.display="none";
	document.getElementById('menu_show').innerHTML="(+) Mostrar Menu";
}	}

function atualiza_ordem_geral(id_pagina,tabela, campo) {
 ordem = document.getElementById('ordem'+id_pagina).value;

if(!isNaN(ordem))
 {
xmlhttp = GetXmlObject()
 url2="atualiza_ordem.asp?id_pagina=" + id_pagina +"&ordem="+ ordem + "&tabela=" + tabela + "&campo=" + campo +"&tm="+Math.random();
xmlhttp.open("GET",url2,true);
xmlhttp.send(null);
 }
 else
 {
	alert("Digite somente Números!");
	return false;
 }
   

   
}

function atualiza_campo_geral(id_pagina,tabela,campo_id,campo,tipo) {
 ordem = document.getElementById(campo+id_pagina).value;

if(ordem!="")
 {
	 
if (tipo=='' && isNaN(ordem)==true){alert("Digite apenas números !");document.getElementById(campo+id_pagina).focus();return false;}
	 
xmlhttp = GetXmlObject()
 url2="../sis/atualiza_ordem_todos.asp?tipo="+tipo+"&campo_id="+campo_id+"&id_pagina=" + id_pagina +"&ordem="+ ordem + "&tabela=" + tabela + "&campo=" + campo +"&tm="+Math.random();
xmlhttp.open("GET",url2,true);
xmlhttp.send(null);
 }
 else
 {
	alert("Digite um valor");
	document.getElementById(campo+id_pagina).focus()
	return false;
 }
   

   
}



function monta_campos_geral(id,n_campo){ 

  //alert(document.getElementById("campo_array").value)
   n_par=document.getElementById("campo_array"+n_campo+id).value
   t_par=document.getElementById("tipo_array"+n_campo+id).value
  	n_par = n_par.split(',');
		t_par = t_par.split(',');
	
	var url3="campo_array="+document.getElementById("campo_array"+n_campo+id).value+"&tipo_array="+document.getElementById("tipo_array"+n_campo+id).value
	for (i=1; i<n_par.length-0;i++)
	{
		//alert(t_par[i]+id)
		//alert(document.getElementById(n_par[i]).value)
	//valor_box=document.getElementById(n_par[i]).value	
	if (t_par[i]!="d"){
		if (t_par[i]=="t"){
	url3 = url3+"&"+ n_par[i] +id+"="+escape(document.getElementById(n_par[i]+id).value)}
	else{
		url3 = url3+"&"+ n_par[i] +id+"="+document.getElementById(n_par[i]+id).value
	}
	}
	else{
		url3 = url3+"&d"+ n_par[i] +id+"="+document.getElementById("d"+n_par[i]+id).value
		url3 = url3+"&m"+ n_par[i] +id+"="+document.getElementById("m"+n_par[i]+id).value
		url3 = url3+"&y"+ n_par[i] +id+"="+document.getElementById("y"+n_par[i]+id).value
	}
	//alert(url3)
	//document.getElementById("td_"+n_par[i]).innerHTML=document.getElementById(n_par[i]).value
	}
	return(url3)
	
  }


 

var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();

function load_flash(url,div,xxx,yyy){
	
var params = { allowScriptAccess: "always", wmode: "transparent", allowFullScreen: "true", scale: "exactFit" }; 
var attributes = {}; 
var flashvars = {}; 
swfobject.embedSWF(url, div, xxx, yyy, "10.0.0", "/expressInstall.swf", flashvars, params, attributes);
}
