<!--

// PNG TRANSPARENTE

 //<![CDATA[

 // If you don't want to put unstandard properties in your stylesheet, here's yet
 // another means of activating the script. This assumes that you have at least one
 // stylesheet included already. Remove the /* and */ lines to activate.

 /*
 if (document.all && document.styleSheets && document.styleSheets[0] &&
  document.styleSheets[0].addRule)
 {
  // Feel free to add rules for specific tags only, you just have to call it several times.
  document.styleSheets[0].addRule('*', 'behavior: url(../_css/iepngfix.htc)');
 }
 */

 //]]>

//SCRIPT ABRE POPUP
function abrirprint(pagina,largura,altura) {

var esquerda = 2000;
var topo = 2000;

//abre a nova janela, já com a sua devida posição
window.open(pagina,'','status=yes,height=' + altura + ', width=' + largura + ', top='+topo+', left='+esquerda+''); 
}


//SCRIPT ABRE POPUP
function abrirpopup(pagina,largura,altura) {

var esquerda = (screen.width - largura)/2;
var topo = (screen.height - altura)/2;
   
//abre a nova janela, já com a sua devida posição
window.open(pagina,'','status=yes,height=' + altura + ', width=' + largura + ', top='+topo+', left='+esquerda+''); 
}


//SCRIPT ABRE POPUP RELATORIO
function abrirrelatorio(pagina) {

var largura = (screen.width - 10);
var altura = (screen.height - 90);

//abre a nova janela, já com a sua devida posição
window.open(pagina, '', "resizable=1,scrollbars=1,status=yes,height=" + altura + ", width=" + largura + ", top=0, left=0");
}


//SCRIPT ABRE IMAGEM

function PopupPic(sPicURL)
{
	var server = self.location;
	var path = (server.toString().indexOf("server") == -1) ? "/site/principal/" : "/servidor/Sinduscon/site/principal/";

	if(arguments.length > 1)
	{
		window.open(path + "popup.htm?url=" + sPicURL + "&legenda=" + escape(arguments[1]), "", "resizable=1,HEIGHT=200,WIDTH=200");
	} else {
		window.open(path + "popup.htm?url=" + sPicURL, "", "resizable=1,HEIGHT=200,WIDTH=200");
	}
}

//SCRIPT LIMPA INPUT PREENCHIDO
function limpainput(obj) {
	obj.value = "";
}

// SCRIPTS MM
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


//FAZ O MOUSEOVER NA TR E COLOCA O LINK NELA
function over_tr(src,clrOver)
{
	if (!src.contains(event.fromElement))
	{
		src.style.cursor = 'hand';
		src.bgColor = clrOver;
	}
}
function out_tr(src,clrIn)
{
	if (!src.contains(event.toElement))
	{
		src.style.cursor = 'default';
		src.bgColor = clrIn;
	}
}
function go(loc)
{
	window.location.href = loc;
}


//FUNÇÕES DE PAGINAÇÃO
function decrementa(nameForm, nameField)
{
	var form = eval("document." + nameForm);
	if(form == null)
	{
		alert("Função decrementa não encontrou o formulário");
	} else {
		var field = eval("document." + nameForm + "." + nameField);
		if(field == null)
		{
			alert("Função decrementa não encontrou o campo que contém a página atual");
		} else {
			if(verificaIsNum(field.value))
			{
				if(parseInt(field.value) > 1)
				{
					field.value = parseInt(field.value) - 1;
					form.submit();
				} else {
					return false;
				}
			} else {
				return false;
			}
		}
	}
}
	
function incrementa(nameForm, nameField, totalPaginas)
{

	var form = eval("document." + nameForm);
	if(form == null)
	{
		alert("Função incrementa não encontrou o formulário");
	} else {
		var field = eval("document." + nameForm + "." + nameField);

		if(field == null)
		{
			alert("Função incrementa não encontrou o campo que contém a página atual");
		} else {
			//if( (verificaIsNum(field.value)) && (verificaIsNum(totalPaginas)) )
			//{
				if(parseInt(field.value) < (totalPaginas))
				{
					field.value = parseInt(field.value) + 1;
					form.submit();
				} else {
					return false;
				}
				/*
			} else {
				return false;
			}
			*/
		}
	}
}

//FORMATA MONETÁRIOS
function FmascTempoReal(ConteudoCampo)
{
	if(((event.keyCode) > 47) && ((event.keyCode) < 58))
	{
		NumDig = ConteudoCampo.value;
		TamDig = NumDig.length;
		Contador = 0;
		if(TamDig > 1)
		{
			numer = "";
			for(i = TamDig; (i >= 0); i--)
			{
				if((parseInt(NumDig.substr(i,1))>=0) && (parseInt(NumDig.substr(i, 1))<=9))
				{
					Contador++;
					if((Contador == 2) && ((TamDig -i) < 4))
					{
						numer = "," + numer;
						Contador = 0;
					}
					else if (Contador == 3)
					{
						numer = "." + numer;
						Contador = 0;
					}
					numer = NumDig.substr(i, 1) + numer;
				}
			}
			ConteudoCampo.value = numer;
		};
		return(true)
	}
   else return(false)
}

/* Função para formatar o valor */
function FtrataBackSpace(dado)
{
	NumDig = dado.value;
	TamDig = NumDig.length;
	TamDig--;
	Contador = 0;
	if((TamDig >= 0) && (event.keyCode == 8))
	{
		numer = "";
		for (i = TamDig; (i >= 0); i--)
		{
			if((parseInt(NumDig.substr(i,1))>=0) && (parseInt(NumDig.substr(i, 1))<=9))
			{
				Contador++;
				if((Contador == 4) && ((TamDig -i) < 5))
				{
					numer = "," + numer;
					Contador = 0;
				}
				else if ((Contador == 3) && ((numer.length) > 4))
				{
					numer = "." + numer;
					Contador = 0;
				}
				numer = NumDig.substr(i, 1) + numer;
			}
		}
		dado.value = numer;
	};
}

function FormatNumber(dado)
{
	if (dado.length > 0)
	{
		dado.value = ValorFloatToFmt(FloatToSrt(ValorFmtToFloat(dado.value)))
	}		
}

function ValorFmtToFloat(input)
{
	var inputlength = input.length;
	input = input.toLowerCase();
	var number = "";
	for (i = 0; i < inputlength; i++)
	{
		var character = input.charAt(i);   
		switch(character)
		{
			case '0': number += "0"; break;
			case '1': number += "1"; break;
			case '2': number += "2"; break;
			case '3': number += "3"; break;
			case '4': number += "4"; break;
			case '5': number += "5"; break;
			case '6': number += "6"; break;
			case '7': number += "7"; break;
			case '8': number += "8"; break;
			case '9': number += "9"; break;
		}
	}
	var numberAux = number.substring(0, number.length - 2);
	if(numberAux == "")
	{
		numberAux += "0";
	}	
	numberAux += ".";	
	numberAux += number.substring(number.length - 2, number.length);	
	number = numberAux;
	var valor;
	//var valor =0;
	valor = parseFloat(number);
	//valor = eval(number);
	return valor;
}
//VERIFICA SE O VALOR É INTEIRAMENTE NUMÉRICO
function verificaIsNum(valor) {
	try{
		valor = valor.replace("(", "");
		valor = valor.replace(")", "");
		valor = valor.replace("-", "");
		valor = valor.replace("-", "");
	
		if(isNaN(valor) == true) {
			return false;
		} else {
			return true;
		}
	}catch(e){}
}
//PERMITE SÓ NÚMEROS
//PADRÃO : onKeypress="return permiteSoNumeros(event);"
function permiteSoNumeros(event) {
	var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
    var caract = new RegExp(/^[0-9 ]+$/i);
	if((keyCode != 36) && (keyCode != 8)) {
   		var caract = caract.test(String.fromCharCode(keyCode));
	}	
    //------------------------
   	if(!caract) {	
       	keyCode = 0;
		return false;
	}
}

function FloatToSrt(Num)
{
	var valorStr = "";
	var pospt = 0;
	valorStr += Num;	
	if(Num <= .99)
	{
		valorStr = valorStr.replace("0", "");
		valorStr = "0" + valorStr;		
	}	
	for (var n = 1 ; n <= valorStr.length ; n++) 
	{
		if (valorStr.substring(n-1, n) == ".") 
		{
			pospt = n;
			break;
		}
	}

	if (pospt == 0)		
	{
		valorStr += ".00";		
	}
	else if(pospt > 0)
	{
		var fracao = valorStr.substring(pospt, valorStr.length);
		if(fracao.length == 1)
		{
			valorStr += "0";			
		}
	}
	return valorStr;
}

function ValorFloatToFmt(Num)
{
	var numer;
	var i;	
	var TamDig = Num.length;
	var Contador = 0;
	if (TamDig > 1)
	{
 		numer = "";
   		for (i = TamDig; (i >= 0); i--)
   		{
			if ((parseInt(Num.substr(i,1))>=0) && (parseInt(Num.substr(i, 1))<=9))
			{
				Contador++;
				if ((Contador == 3) && ((TamDig -i) < 5))
				{
					numer = "," + numer;
					Contador = 0;
				}
				else if (Contador == 3)
				{
					numer = "." + numer;
					Contador = 0;					
				}
				numer = Num.substr(i, 1) + numer;
			}
		}       
	}    
	return numer;   
}

//FIM FORMATA MONETÁRIOS

//Marca ou desmarca os checkboxes
function checkUncheck(form, nameCheck)
{	
	if(eval('document.' + form + '.' + nameCheck + '.length') != undefined)		
	{	
		for(i = 0; i < eval("document." + form + "." + nameCheck + ".length"); i++)
		{
			eval("document." + form + "." + nameCheck + "[" + i + "].checked = !document." + form + "." + nameCheck + "[" + i + "].checked");
		}
	} else {
		eval('document.' + form + '.' + nameCheck + '.checked = !document.' + form + '.' + nameCheck + '.checked;');
	}	
}
//Função que valida os checkboxes para deleção
function checkDelete(form, nameCheck)
{
	var marcado = false;
	if(eval('document.' + form + '.' + nameCheck + '.length') != undefined)
	{
		for(i = 0; i < eval("document." + form + "." + nameCheck + ".length"); i++)
		{
			if(eval("document." + form + "." + nameCheck + "[" + i + "].checked") == true)
			{
				marcado = true;
				break;
			}
		}
	}	
	else
	{	
		if(eval('document.' + form + '.' + nameCheck + '.checked') == true)
		{
			marcado = true;
		}
	}	
	
	if(marcado)
	{
		if(confirm("Você deseja realmente apagar este(s) ítem(ns)?") == true)
		{
			return true;
		} else {
			return false;
		}
	} else {
		alert("Você deve selecionar pelo menos um ítem para ser deletado!");
		return false;
	}
}

//Função que valida os checkboxes para deleção
function checkDeletePHP(form, nameCheck)
{
	var marcado = false;
	if(eval("document." + form + ".cods") != null) {
		eval("document." + form + ".cods.value = '';");
	}
	
	if(eval('document.' + form + '.' + nameCheck + '.length') != undefined)
	{
		for(i = 0; i < eval("document." + form + "." + nameCheck + ".length"); i++)
		{
			if(eval("document." + form + "." + nameCheck + "[" + i + "].checked") == true)
			{
				if(eval("document." + form + ".cods") != null) {
					if(eval("document." + form + ".cods.value == ''")) {
						eval("document." + form + ".cods.value = document." + form + "." + nameCheck + "[" + i + "].value;");
					} else {
						eval("document." + form + ".cods.value = document." + form + ".cods.value + ', ' + document." + form + "." + nameCheck + "[" + i + "].value;");
					}
				}
				marcado = true;
			}
		}
	}
	else	
	{
		if(eval('document.' + form + '.' + nameCheck + '.checked'))
		{
			eval("document." + form + ".cods.value = document." + form + "." + nameCheck + ".value;");
			marcado = true;			
		}
	}	
	if(marcado)
	{
		if(confirm("Você deseja realmente apagar este(s) ítem(ns)?") == true)
		{
			return true;
		} else {
			return false;
		}
	} else {
		alert("Você deve selecionar pelo menos um ítem para ser deletado!");
		return false;
	}
}


//Compara duas datas
function comparaData(form, data1, data2)
{
	DataInicial = eval('document.' + form + '.' + data1 + '.value' );
	DataFinal = eval('document.' + form + '.' + data2 + '.value' );
	DataInicial = DataInicial.split("/");
	DataFinal = DataFinal.split("/");
	DataInicial = new Date(DataInicial[2],DataInicial[1],DataInicial[0]);
	DataFinal = new Date(DataFinal[2],DataFinal[1],DataFinal[0]);
	
	if(DataInicial > DataFinal)
	{	
		return false;
	}	
	else
	{	
		return true;
	}
}

function addOption(selectId, txt, val) {
	var objOption = new Option(txt, val);

	document.getElementById(selectId).options.add(objOption);
}

function checkRadioMarcado(objCheck)
{
	var marcado = false;
	if(objCheck == null) {
		alert("A função checkRadioMarcado não encontrou o campo");
	} else {
		if(typeof(objCheck.length) != 'undefined') {
			for(i = 0; i < objCheck.length; i++) {
				if(objCheck[i].checked == true) {
					marcado = true;
					break;
				}
			}
		} else {
			if(objCheck.checked == true) {
				marcado = true;
			}
		}
	}
	return marcado;	
}

function startTinyMCE(){


	tinyMCE.init({
		// General options
		mode : "textareas",
		theme : "advanced",
		plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,ibrowser",

		 editor_deselector : "NOTanEditor",
		
		// Theme options
		theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen,ibrowser",
        //theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",

		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "middle",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,

		
		extended_valid_elements : "input[name|size|type|value|onclick],iframe[height|width|src|frameborder|scrolling|allowtransparency|marginheight|marginwidth]",
		// Example content CSS (should be your site CSS)
		content_css : "../../_css/ivirtua.css",
		
		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "lists/template_list.js",
		external_link_list_url : "lists/link_list.js",
		external_image_list_url : "lists/image_list.js",
		media_external_list_url : "lists/media_list.js"
	});
	
}


-->