function pub_flash( swf, w, h )
{
	document.write( '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'">'+"\n" );
	document.write( '<param name="movie" value="'+swf+'">'+"\n" );
	document.write( '<param name="quality" value="high">'+"\n" );
	document.write( '<param name="menu" value="false">'+"\n" );
	document.write( '<embed src="'+swf+'" menu="false" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" align="middle" height="'+h+'"></embed>'+"\n" );
	document.write( '</object>'+"\n" );
}

function pub_flash2( swf, w, h )
{
	document.write( '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'">'+"\n" );
	document.write( '<param name="movie" value="'+swf+'">'+"\n" );
	document.write( '<param name="quality" value="high">'+"\n" );
	document.write( '<param name="menu" value="false">'+"\n" );
	document.write( '<param name="wmode" value="transparent">'+"\n" );
	document.write( '<param name="devicefont" value="true">'+"\n" );
	document.write( '<embed src="'+swf+'" menu="false" quality="high" wmode="transparent" devicefont="true" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed>'+"\n" );
	document.write( '</object>'+"\n" );
}

function bannersecur()
{
	// var adwin = window.open( "http://www.securstar.eu/partnerprogramm2/en/popup_form/123e28adbd8bd0e49a7dfd7997edb086", "adwin", "HEIGHT=400,WIDTH=500,SCROLLBARS" );
	var adwin = window.open( "http://www2.litoral.com.br/banner.php?espaco=1&click=1", "adwin", "HEIGHT=400,WIDTH=500,SCROLLBARS" );
	adwin.focus();
}

function SetCookie (name, value, expires) {  
  var argv = SetCookie.arguments;  
  var argc = SetCookie.arguments.length;
  var now = new Date();
  now.setTime( now.getTime() + ( expires * 1000 ) );
  var expires = ( expires ) ? now : null;  
  var path = (argc > 3) ? argv[3] : null;  
  var domain = (argc > 4) ? argv[4] : null;  
  var secure = (argc > 5) ? argv[5] : false;  
  document.cookie = name + "=" + escape (value) + 
  ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
  ((path == null) ? "" : ("; path=" + path)) +  
  ((domain == null) ? "" : ("; domain=" + domain)) +    
  ((secure == true) ? "; secure" : "");
}

function sonumero( valor ) {
  retorno = '';    
  for( c = 0; c < valor.length; c++ )
  {
    letra = asc( valor.substr( c, 1 ) );
    if( letra >= 48 && letra <= 57 )
    {
      retorno = retorno + valor.substr( c, 1 );
    }
  }
  return retorno;
}

function asc(each_char)
{
  var n = 0
  var char_str = ' !"#$%&' + "'" + '()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~';
  for (i = 0; i < char_str.length; i++)
  {
    if (each_char == char_str.substring(i, i+1))
    {
      break
    }
  }
  return i + 32
}
function semacento( val ) {
  val = val.replace(/á/g,'a');
  val = val.replace(/é/g,'e');
  val = val.replace(/í/g,'i');
  val = val.replace(/ó/g,'o');
  val = val.replace(/ú/g,'u');
  val = val.replace(/ç/g,'c');
  val = val.replace(/ã/g,'a');
  val = val.replace(/õ/g,'o');
  val = val.replace(/à/g,'a');
  val = val.replace(/è/g,'e');
  val = val.replace(/ì/g,'i');
  val = val.replace(/ò/g,'o');
  val = val.replace(/ù/g,'u');
  val = val.replace(/â/g,'a');
  val = val.replace(/ê/g,'e');
  val = val.replace(/î/g,'i');
  val = val.replace(/ô/g,'o');
  val = val.replace(/û/g,'u');
  return val;
}

function priupper( val ) {
  val = val.toLowerCase();
  val = val.substr( 0, 1 ).toUpperCase() + val.substr( 1, val.length );
  return val;
}

function wordupper( val ) {
  retorno = '';
  flag = 1;    
  for( c = 0; c < val.length; c++ ) {
    letra = asc( val.substr( c, 1 ) );
    if( letra == 32 ) {
      if( retorno != '' && last != 32 && c != ( val.length - 1 ) ) {
        retorno = retorno + ' ';
      }
      flag = 1;
    } else {
      if( flag == 1 ) {
        retorno = retorno + val.substr( c, 1 ).toUpperCase();
        flag = 0;
      } else {
        retorno = retorno + val.substr( c, 1 ).toLowerCase();
      }
    }
    last = letra;
  }
  retorno = retorno.replace(/ De /g,' de ');
  retorno = retorno.replace(/ Do /g,' do ');
  retorno = retorno.replace(/ Dos /g,' dos ');
  retorno = retorno.replace(/ Da /g,' da ');
  retorno = retorno.replace(/ Das /g,' das ');
  retorno = retorno.replace(/ E /g,' e ');
  retorno = retorno.replace(/ Ap /g,' ap ');
  retorno = retorno.replace(/ Apto /g,' ap ');
  retorno = retorno.replace(/ Ap. /g,' ap ');
  retorno = retorno.replace(/ Apto. /g,' ap ');
  return retorno;
}

function textmax( obj, max ) {
 
 str = obj.value;
 if( str.length > max ) {
  obj.value = str.substring( 0, max );
 }
 
}


function chklogin( valor ) {
  valor = valor.toLowerCase();
  retorno = '';
  x = 0;
  for( c = 0; c < valor.length; c++ )
  {
    letra = asc( valor.substr( c, 1 ) );
    if( x == 0 ) {
      if( ( letra >= 48 && letra <= 57 ) || ( letra >= 97 && letra <= 122 ) ) {
        retorno = retorno + valor.substr( c, 1 );
        x = 1;
      }
    } else {
      if( ( letra >= 48 && letra <= 57 ) || ( letra >= 97 && letra <= 122 ) || ( letra == 46 ) || ( letra == 95 ) || ( letra == 45 ) ) {
        if( !( letra == 46 && last == 46 ) && !( letra == 95 && last == 95 ) && !( letra == 45 && last == 45 ) ) {
          if( x >= 1 ) retorno = retorno + valor.substr( c, 1 );
          x = x + 1;
        }
      }
    }
    last = letra;
  }
  valor = retorno;
  retorno = '';  
  x = 0;
  for( c = ( valor.length - 1 ); c >= 0; c-- )
  {
    letra = asc( valor.substr( c, 1 ) );
    if( x == 0 ) {
      if( ( letra >= 48 && letra <= 57 ) || ( letra >= 97 && letra <= 122 ) ) {
        retorno = valor.substr( c, 1 ) + retorno;
        x = 1;
      }
    } else {
      if( ( letra >= 48 && letra <= 57 ) || ( letra >= 97 && letra <= 122 ) || ( letra == 46 ) || ( letra == 95 ) || ( letra == 45 ) ) {
        if( x >= 1 ) retorno = valor.substr( c, 1 ) + retorno;
        x = x + 1;
      }
    }
  }
  
  return retorno;
  
}

function semespaco( valor ) {
  
  valor = valor.toLowerCase();
  retorno = '';
  for( c = 0; c < valor.length; c++ )
  {
    letra = asc( valor.substr( c, 1 ) );
    if( letra != 32 ) {
      retorno = retorno + valor.substr( c, 1 );
    }
  }
  return retorno.toUpperCase();
  
}

function chkemail( valor ) {
  valor = valor.toLowerCase();
  retorno = '';
  x = 0;
  arr = 0;
  for( c = 0; c < valor.length; c++ ) {
    letra = asc( valor.substr( c, 1 ) );
    if( x == 0 ) {
      if( ( letra >= 48 && letra <= 57 ) || ( letra >= 97 && letra <= 122 ) ) {
        retorno = retorno + valor.substr( c, 1 );
        x = 1;
      }
    } else {
      if( ( letra >= 48 && letra <= 57 ) || ( letra >= 97 && letra <= 122 ) || ( letra == 46 ) || ( letra == 95 ) || ( letra == 64 ) ) {
        if( ( letra == 64 ) && arr == 0 ) {
          retorno = retorno + valor.substr( c, 1 );
          arr = 1;
        } else {
          if( !( letra == 46 && last == 46 ) && !( letra == 95 && last == 95 ) && !( letra == 46 && last == 64 ) ) {
            if( x >= 1 ) retorno = retorno + valor.substr( c, 1 );
            x = x + 1;
          }
        }
      }
    }
    last = letra;
  }
  valor = retorno;
  retorno = '';  
  x = 0;
  pto = 0;
  for( c = ( valor.length - 1 ); c >= 0; c-- )
  {
    letra = asc( valor.substr( c, 1 ) );
    if( letra == 46 ) pto = 1;
    if( x == 0 ) {
      if( ( letra >= 48 && letra <= 57 ) || ( letra >= 97 && letra <= 122 ) ) {
        retorno = valor.substr( c, 1 ) + retorno;
        x = 1;
      }
    } else {
      if( ( letra >= 48 && letra <= 57 ) || ( letra >= 97 && letra <= 122 ) || ( letra == 46 ) || ( letra == 95 ) || ( letra == 64 ) ) {
        if( x >= 1 ) retorno = valor.substr( c, 1 ) + retorno;
        x = x + 1;
      }
    }
  }
  
  if( arr == 0 || pto == 0 ) {
    retorno = '';
  }
  
  return retorno;
  
}

function gowebmail( email, senha, lembraemail ) {
	
	if ( email == "" || email == 'undefined' ) {
		alert('Por favor, informe seu e-mail e sua senha');
		return;
	} else if ( senha == "" || senha == 'undefined' ) {
		alert('Por favor, informe seu e-mail e sua senha');
		return;
	}
      SetCookie( 'webmailuser', email, 0 );
      SetCookie( 'webmailpass', senha, 0 );
	if( lembraemail == 1 || lembraemail == true ) {
		SetCookie( 'lembraemail', email, 6480000 );
	} else {
		SetCookie( 'lembraemail', '' );
	}
	document.webmailform.imapuser.value = email;
	document.webmailform.pass.value = senha;
	document.webmailform.submit();
}

isNN = document.layers ? 1 : 0; 

// document.oncontextmenu = noContext;
// document.onkeypress    = noContextKey;
// document.onmousedown   = noClick;
// document.onmouseup     = noClick;

if(isNN){ 
    document.captureEvents(Event.MOUSEDOWN);
}

function noContext(){return false;}

function noContextKey(e) {
    if(isNN){
        if (e.keyCode == 96){ return (false);}
    } else {
        if (event.keyCode == 96){ return (false);}
    }
}

function noClick(e){
    if(isNN){
        if(e.which > 1) {return false;}
    } else { 
        if(event.button > 1){return false;}
    }
}

function get_radio_value (radio_array)
{
	var i;
	for (i = 0; i < radio_array . length; ++ i)
		if (radio_array [i] . checked)
			return radio_array [i] . value;
	return null;
}

function chknome( obj ) {
	obj.value = wordupper( semacento( obj.value.toLowerCase() ) );
}

function versaohtml() {
	SetCookie( 'versaohtml', 1, 648000 );
	window.location=window.location;
}

function versaoflash() {
	if( confirm("ATENÇÃO:\n\nEsta versão do site necessita do Macromedia Flash Player 7.\nCaso você não o possua, ele será automaticamente instalado.") ) {
		SetCookie( 'versaohtml', 648000 );
		window.location='flashupdate.php';
	}
}

function abresantos() {
  window.open('hotsitesantos459.php','hotsitesantos459','width=640,height=470,left=20,top=20');
}

function santos460() {
  window.open('hotsitesantos460.php','hotsitesantos460','width=640,height=465,left=20,top=20');
}

function abrepopup() {
  window.open('promocao_speedy.php','promocaospeedy','width=300,height=320,left=20,top=20');
}

function abre_speedyprecos(tipo) {
  if( tipo == 0 ) {
    window.open('http://200.205.125.211/speedy/home_produtos.asp','precosspeedy','width=800,height=600,left=0,top=0');
  } else {
    window.open('http://200.205.125.211/speedy/home_business.asp','precosspeedy','width=800,height=600,left=0,top=0');
  }
}

function juntadata( dia, mes, ano ) {
    dia1 = dia.value * 1; mes1 = mes.value; ano1 = ano.value;
    dia.disabled = true; mes.disabled = true; ano.disabled = true;
    if( dia1 < 1 || dia1 > 31 ) dia1 = 1;
    if( dia1 < 10 ) dia1 = '0' + dia1;
    return dia1 + '/' + mes1 + '/' + ano1;
}

function callswf( swf, w, h ) {
	document.write( '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'">'+"\n" );
	document.write( '	<param name="movie" value="'+swf+'">'+"\n" );
	document.write( '	<param name="quality" value="high">'+"\n" );
	document.write( '	<param name="menu" value="false">'+"\n" );
	document.write( '	<param name="wmode" value="transparent">'+"\n" );
	document.write( '	<embed src="'+swf+'" menu="false" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="opaque" width="'+w+'" height="'+h+'"></embed>'+"\n" );
	document.write( '</object>'+"\n" );
}

