//Disable right click script III- By Renigade (renigade@mediaone.net)
//For full source code, visit http://www.dynamicdrive.com

var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")

 

 //Funcion utilizada para la validaciones de las cajas de texto
//Valida que una caja de texto no este en blanco
function RemoverEspacios(inputString, removeChar) 
{
	var returnString = inputString;
	if (removeChar.length)
	{
	  while(''+returnString.charAt(0)==removeChar)
		{
		  returnString=returnString.substring(1,returnString.length);
		}
		while(''+returnString.charAt(returnString.length-1)==removeChar)
	  {
	    returnString=returnString.substring(0,returnString.length-1);
	  }
	}
	return returnString;
}

//Funcion que la valida que el string sean solo numeros
function onlyNumbers(inputString)
{
  var searchForNumbers = /\D+/;
  return (searchForNumbers.test(inputString)) ? false : true;
} 

//Funcion que valida la direccion de correo electronico
function ValidaEmail(objeto)
{
	// validar el Campo Correo Electrónico.  Opcional.  Debe ser de la forma xx@xx.xx
	//var patron = /\w+@\w+\.\w+/
	var patron = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	objeto.value = RemoverEspacios(objeto.value,' ');
	if ((howManyWords(objeto.value)==1)&&((patron.test(objeto.value)||(objeto.value==''))))
	{
		return true;
	}
	else
	{
		if (howManyWords(objeto.value)>1)
			alert("El campo Correo electrónico no puede contener espacios en blanco");
		else
			alert("Correo electrónico no es válido");
		objeto.focus();
		return false;
	}
}

//Funcion utilizada por la funcion ValidaEmail
function howManyWords(inputString)
{
  return inputString.split(' ').length;
}

var timeoutID;
var frameValues = ['imagenes/banners/FondoContador.gif', 'imagenes/banners/B-Premium-Naranja-Copa-2009.gif', 'imagenes/banners/B_Premium__Crecer.jpg'];
var frameURLs = ['/copa/cuenta_pagina.asp', '/copa/cuenta_pagina.asp', '/copa/cuenta_pagina.asp'];

//Banner premium del home mis hijos
function rotar_imagenes(i) {
	obj = document.getElementById('Contador');
	if (i == '0'){
		obj.style.display = "";
		document.getElementById('valor').innerHTML = document.form1.contador.value;		
	}
	else{
	    obj.style.display = 'none';	
		document.getElementById('valor').innerHTML = '';			
	}
	document.form1.pagina.value = frameURLs[i];
	document.getElementById('image').background = frameValues[i];
	i = (++i == frameValues.length) ? 0 : i
	timeoutID = setTimeout('rotar_imagenes(' + i + ')', 3500)
}	

var timeoutID2;

function rotar_imagenes2(i) {
	obj = document.getElementById('Contador');
	if (i == '0'){
		obj.style.display = "";
		document.getElementById('valor').innerHTML = document.form1.contador1.value + document.form1.contador2.value + document.form1.contador3.value;		
	}
	else{
	    obj.style.display = 'none';	
		document.getElementById('valor').innerHTML = '';			
	}
	document.getElementById('image').background = frameValues2[i];
	i = (++i == frameValues2.length) ? 0 : i
	timeoutID2 = setTimeout('rotar_imagenes2(' + i + ')', 3000)
}	

//De Padres a Padres
var frameValues3 = ['imagenes/padres/B-Premium-Rosado-Contador-D.jpg', 'imagenes/padres/B-Premium-Rosado-Funciones-.gif']

function rotar_imagenes3(i) { 
	obj = document.getElementById('Contador');
	var tira = '';
	if (i == '0'){
		tira = '<br>VISITAS&nbsp;&nbsp;&nbsp;<br>Desde MisHijos:&nbsp;' + document.form1.contador_mishijos.value + '&nbsp;&nbsp;&nbsp;<br>' + 'Directas:&nbsp;' + document.form1.contador.value + '&nbsp;&nbsp;&nbsp;<br>Total:&nbsp;' + document.form1.contador_total.value + '&nbsp;&nbsp;&nbsp;'
		obj.style.display = "";
		document.getElementById('valor').innerHTML = tira;		
	}
	else{
	    obj.style.display = 'none';	
		document.getElementById('valor').innerHTML = '';			
	}
	document.getElementById('image').background = frameValues3[i];
	i = (++i == frameValues3.length) ? 0 : i
	timeoutID2 = setTimeout('rotar_imagenes3(' + i + ')', 3500)
}	


//Ellos Sugieren
var frameValues4 = ['imagenes/ellos/B-Premium-Verde-Contador-El.jpg', 'imagenes/ellos/B-Premium-Verde-Cuento-Plan.jpg']

function rotar_imagenes4(i) { 
	obj = document.getElementById('Contador');
	var tira = '';
	if (i == '0'){
		tira = '<br>VISITAS&nbsp;&nbsp;&nbsp;<br>Desde MisHijos:&nbsp;' + document.form1.contador_mishijos.value + '&nbsp;&nbsp;&nbsp;<br>' + 'Directas:&nbsp;' + document.form1.contador.value + '&nbsp;&nbsp;&nbsp;<br>Total:&nbsp;' + document.form1.contador_total.value + '&nbsp;&nbsp;&nbsp;'
		obj.style.display = "";
		document.getElementById('valor').innerHTML = tira;		
	}
	else{
	    obj.style.display = 'none';	
		document.getElementById('valor').innerHTML = '';			
	}
	document.getElementById('image').background = frameValues4[i];
	i = (++i == frameValues4.length) ? 0 : i
	timeoutID2 = setTimeout('rotar_imagenes4(' + i + ')', 3000)
}	

//Copa
var frameValues5 = ['imagenes/B-Prem-MP-Contador-Ac.jpg', 'imagenes/B-Prem-MPag-Mov.gif', 'imagenes/B-Prem-MP-InterPreEscolar-A.gif']

function rotar_imagenes5(i) { 
	obj = document.getElementById('Contador');
	var tira = '';
	if (i == '0'){
		tira = '<br>VISITAS&nbsp;&nbsp;&nbsp;<br>Desde MisHijos:&nbsp;' + document.form1.contador_mishijos.value + '&nbsp;&nbsp;&nbsp;<br>' + 'Directas:&nbsp;' + document.form1.contador.value + '&nbsp;&nbsp;&nbsp;<br>Total:&nbsp;' + document.form1.contador_total.value + '&nbsp;&nbsp;&nbsp;'
		obj.style.display = "";
		document.getElementById('valor').innerHTML = tira;		
	}
	else{
	    obj.style.display = 'none';	
		document.getElementById('valor').innerHTML = '';			
	}
	document.getElementById('image').background = frameValues5[i];
	i = (++i == frameValues5.length) ? 0 : i
	timeoutID2 = setTimeout('rotar_imagenes5(' + i + ')', 4000)
}	
