function openPopFoto(idFoto,width,height)
{
	window.open('/click/popfoto.aspx?idFoto=' + idFoto,'clickCloseup','width=' + width + ',height=' + height);
}
function testmovie_DoFSCommand(command, args) { 
	LARGURA = 200;
	ALTURA = 200
	alert(args);
	if(command=="openLogin"){
	    window.showModalDialog(args,'login','width='+LARGURA+',height='+ALTURA);
	}
}
function openWindow(url, windowName, w, h, windowFeatures)
{
	var winleft = (screen.width - w) / 2;
	var wintop = (screen.height - h) / 2;
	
	params = 'height=' + h + ',width=' + w + ',top=' + wintop + ',left=' + winleft;
	
	if (windowFeatures)
	{
		params = params + ',toolbar=yes, location=yes, directories=yes, status=yes, menubar=yes, scrollbars=yes, resizable=yes';
	}
	else
	{
		params = params + ',toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, fullscreen=no';
	}
	
	win = window.open(url, windowName, params);
	
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
function ContadorCaracteres(campo, contador, max)
{
	atual = campo.value.length;
	if (atual > max)
		campo.value = campo.value.substring(0,max);
	else
		contador.value = atual;
}
function ContadorCaracteres2Campos(campo1,campo2, contador, max)
{
	atual = campo1.value.length + campo2.value.length;
	if (atual > max)
		campo1.value = campo1.value.substring(0,max);
	else
		contador.value = atual;
}
function ContadorCaracteres2CamposInverso(campo1,campo2, contador, max)
{
	atual = campo1.value.length + campo2.value.length;
	replace = max - campo2.value.length;
	cont = max - atual;
	if (atual > max)
		campo1.value = campo1.value.substring(0,replace);
	else
		contador.value = cont;
}
function MaxLength(campo,len)
{
	if(campo.value.length > len)
		return false;
	else
		return true;
}

function valida_CPF(obj){
 s = obj.value;
 if (isNaN(s)) {
  return false;
 }
 var i;
 var c = s.substr(0,9);
 var dv = s.substr(9,2);
 var d1 = 0;
 for (i = 0; i < 9; i++) {
  d1 += c.charAt(i)*(10-i);
 }
 if (d1 == 0){
  return false;
 }         
    d1 = 11 - (d1 % 11);
    if (d1 > 9) d1 = 0;         
 if (dv.charAt(0) != d1) {
  return false;         
 }
 d1 *= 2;
 for (i = 0; i < 9; i++) {
  d1 += c.charAt(i)*(11-i);
 }
 d1 = 11 - (d1 % 11);
 if (d1 > 9) d1 = 0;
 if (dv.charAt(1) != d1) {
     return false;
    }
    return true;
}
function valida_CGC(obj){
 s = obj.value;
 if (isNaN(s)) {
  return false;
 }
 var i;
 var c = s.substr(0,12);
 var dv = s.substr(12,2);
 var d1 = 0;
 for (i = 0; i <12; i++){
  d1 += c.charAt(11-i)*(2+(i % 8));
 }
 if (d1 == 0) 
  return false;
 d1 = 11 - (d1 % 11);
 if (d1 > 9) d1 = 0;
 if (dv.charAt(0) != d1){
  return false;
 }
 d1 *= 2;
 for (i = 0; i < 12; i++){
  d1 += c.charAt(11-i)*(2+((i+1) % 8));
 }
 d1 = 11 - (d1 % 11);
 if (d1 > 9) 
  d1 = 0;
 if (dv.charAt(1) != d1){
  return false;
 }
 return true;
}
