// date

function CTVDate () {
var time = new Date()
var date = time.getDate()
var day = time.getDay()
var month = time.getMonth()
var year = time.getYear()
var daytext = new Array("Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado")
  	        var monthtext = new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre")
 	        document.write(daytext[day] + " " + date + " de " + monthtext[month] + ", 19" +year)
		
}

// popup para radios
function startRadios(desktopURL){
	window.open( desktopURL, "radios", "toolbar=no,location=no,status=yes,menubar=yes,resizable=0,scrollbars=yes,width=300,height=350");
}


// registro al network
function registrate(){
	window.open("http://www.integridad.com/registroNetwork.php", "", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,directories=no,location=no,width=550,height=400");
}

// encuesta INI
function encuestaini(){
	window.open("http://www.integridad.com/encuesta-ini.php", "", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,directories=no,location=no,width=550,height=500");
}

// encuesta EM
function encuestaem(){
	window.open("http://www.enlacemusical.com/encuesta-em.php", "", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,directories=no,location=no,width=550,height=500");
}

// registro al boletin
function suscripcion()	{
	window.open("http://www.integridad.com/suscripcionNetwork.php", "", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,directories=no,location=no,width=550,height=400");
}

// image rollover
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_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];}}
}

function MM_findObj(n, d) { //v3.0
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); 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 navMouseOver(imgid,imgnew) {
if (document.images) {
document.images[imgid].src=eval(imgnew + ".src");
}
}

// cell color rollover

function cOvr(src) {
if (!src.contains(event.fromElement)) {
src.style.cursor = 'hand';
}
}

function cOut(src) {
if (!src.contains(event.toElement)) {
src.style.cursor = 'default';
}
}

function mOvr(src,clrOver) {
if (!src.contains(event.fromElement)) {
src.style.cursor = 'hand';
src.bgColor = clrOver;
}
}

function mOut(src,clrIn) {
if (!src.contains(event.toElement)) {
src.style.cursor = 'default';
src.bgColor = clrIn;
}
}

function mClk(src) {
if(event.srcElement.tagName=='TD'){
src.children.tags('A')[0].click();
}
}

// popup detection resolution code

agent = navigator.userAgent;
if (parseInt(agent.substring(8,9)) > 3) {
if (screen.width >= 800) {
winwidth = 760;
winheight = 520;
} else {
winwidth = 620;
winheight = 420;
}
}
if (parseInt(agent.substring(8,9)) <= 3) {
winwidth = 620;
winheight = 420;
}

// normal centered popup

function popup(url,name,width,height,resize,scroll) {
var dialogWin = new Object();
dialogWin.width = width;
dialogWin.height = height;
now = new Date();
var millis=now.getTime();
var mstr=""+millis;
if (document.layers) {
dialogWin.left = window.screenX + ((window.outerWidth - dialogWin.width) / 2);
dialogWin.top = window.screenY + ((window.outerHeight - dialogWin.height) / 2);
var attr = 'screenX=' + dialogWin.left + ',screenY=' + dialogWin.top + ',resizable=' + resize + ',width=' + dialogWin.width + ',height=' + dialogWin.height + ',scrollbars=' + scroll + ',menubar=no,location=no,toolbar=no,status=no,directories=no';
} else if (document.all) {
dialogWin.left = (screen.width - dialogWin.width) / 2;
dialogWin.top = (screen.height - dialogWin.height) / 2;
var attr = 'left=' + dialogWin.left + ',top=' + dialogWin.top + ',resizable=' + resize + ',width=' + dialogWin.width + ',height=' + dialogWin.height + ',scrollbars=' + scroll + ',menubar=no,location=no,toolbar=no,status=no,directories=no';
}
//Agrega el codigo anti-caching
tienesp=false;
for (i=0; i<url.length; i++)
	if (url.charAt(i)=='?')
		tienesp=true;
if (tienesp)
	nocach='&nocache='+mstr;
else
	nocach='?nocache='+mstr;

window.open(url + nocach ,name,attr);
}


// recommend integridad popup

function recomienda(pagina)
{
laURL= 'http://www.integridad.com/recomienda1.php'
popup(laURL,'recomienda','450','375');
}

function envia_a_un_amigo(id)
{
laURL= 'http://www.integridad.com/recomienda2.php?id=' + id;
popup(laURL,'recomienda','450','375');
}

function envia_a_un_amigo2(id)
{
laURL= 'http://www.integridad.com/recomienda3.php?id=' + id;
popup(laURL,'recomienda','450','375');
}

function envia_a_un_amigo_EM(id)
{
laURL= 'http://www.enlacemusical.com/recomienda2.php?id=' + id;
popup(laURL,'recomienda','450','375');
}

function gbpop(pagina)
{
laURL= '../guest/gbpop.php'
popup(laURL,'gbpop','450','375');
}

// chat rules and regulations popup

function chatrules(pagina)
{
laURL= '/chat/reglas-condiciones-de-uso-chat.php'
popup(laURL,'chatrules','450','375','yes','yes');
}


// statement popup

function statement(pagina)
{
laURL= '/legal/declaracion.php'
popup(laURL,'statement','440','270');
}


// audio and video spec requirements popup

function audiovideospecs(pagina)
{
laURL= 'http://www.integridad.com/audio-video/requerimientos-audiovideo.php'
popup(laURL,'audiovideospecs','450','420','yes','yes');
}


// webcam popup

function webcam(pagina)
{
laURL= '/webcam.php'
popup(laURL,'webcam','375','350');
}


// expulsados popup

function expulsados(pagina)
{
laURL= '/moderador/'
popup(laURL,'webcam','500','350','no','yes');
}

function agregarExpulsados(pagina)
{
laURL= '/moderacion/'
window.open( laURL, "moderacion", "toolbar=no,location=no,status=yes,menubar=no,resizable=yes,scrollbars=yes,width=500,height=350");
}



// launch top dropdown menus

function gotoSite(obj)
{
var s;
s=obj.options[obj.selectedIndex].value
if (s!="") {
window.top.location.href=s;
}
}

// netscape resize bug fix

if (document.layers) {
origWidth = innerWidth;
origHeight = innerHeight;}

function reDo() {
if (innerWidth != origWidth || innerHeight != origHeight)
location.reload();}

if (document.layers) onresize = reDo;

// search validation script

function valida_buscador() {
if ((document.formbuscador.texto.value=="") || (document.formbuscador.texto.value==" ") || (document.formbuscador.texto.value=="  ") || (document.formbuscador.texto.value=="   ")) {
alert("Debe ingresar una palabra para que inicie la búsqueda ");
return (false);
} else {
var checkOK = "._-áéíóúAÉÍÚÓçÇãÃõÕüÜàÀêÊ~`@!#$%^&*()-_=+[]{}''|\/<>,.;:\"";
var checkStr = document.formbuscador.texto.value;
var allValid = true;
var decPoints = 0;
var allNum = "";
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
allNum += ch;
}
if (!allValid)
{
return (true);

} else {
alert("Ingresá una palabra");
return (false);
}
}
}


// cookie reader

function getValue(cadena, valor)
{
valor = valor + "=";
offset = cadena.indexOf(valor);
if (offset !=-1) { // Existe el valor
offset += valor.length;
end = cadena.indexOf("&", offset);
if (end == -1)
end = cadena.length;
return cadena.substring(offset, end);
} else {
return "";
}
}

function getCookie(Name, value) {
var search =  "; " + Name + "="
if (document.cookie.length > 0) {
	offset = document.cookie.indexOf(search)
	if (offset != -1) { // if cookie exists	
		 search =  "; " + Name + "="
	} else {
		 search = Name + "="
	}
		
} 
if (document.cookie.length > 0) { // if there are any cookies
offset = document.cookie.indexOf(search)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset)
// set index of end of cookie value
if (end == -1)
end = document.cookie.length
return getValue(unescape(document.cookie.substring(offset, end)), value);
} else {
return "";
}
} else {
return "";
}
}

// Este script Copyright © 2003 Integridad Network Inc.

var mymessage = "\n A V I S O  I M P O R T A N T E\n\ \n\
Este sitio y todos los sitios y propiedades\n\
de Integridad Network están protegidos por\n\
leyes de copyright.\n\ \n\
El contenido de estás páginas electrónicas ha\n\
sido creado exclusivamente para tu uso personal.\n\ \n\
Todos los textos, imágenes, archivos de audio\n\
y video, fotos digitales y códigos no pueden\n\
ser modificados, republicados, distribuidos\n\
ni utilizados fuera de estos sitios sin el\n\
consentimiento de Integridad Network Inc.\n\ \n\
Por favor lee los Términos y Condiciones de\n\
Uso para más información.\n\ \n\
Copyright © 1997-2006 Integridad Network Inc.\n\
All rights reserved. Todos los derechos reservados.";

function rtclickcheck(keyp){
  if (navigator.appName == "Netscape" && keyp.which == 3) {
   alert(mymessage);
    return false;
  }

  if (navigator.appVersion.indexOf("MSIE") != -1 && event.button == 2) {
    alert(mymessage);
    return false;
  }
}

//document.onmousedown = rtclickcheck