// JavaScript Document
<!--// Validar las contadores
function retorno(){
	return false;	
}
function textCounter(field,maxlimit ) {
  if ( field.value.length > maxlimit )
  {
    field.value = field.value.substring( 0, maxlimit );
	mayornumber = maxlimit + 1;
    alert( 'Usted puede Ingresar unicamente ' + mayornumber + ' Caracteres');
    return false;
  }
 
}
c= function (tag) { // Crea un elemento
   return document.createElement(tag);
}
d = function (id) { // Retorna un elemento en base al id
   return document.getElementById(id);
}
e = function (evt) { // Retorna el evento
   return (!evt) ? event : evt;
}
f = function (evt) { // Retorna el objeto que genera el evento
   return evt.srcElement ?  evt.srcElement : evt.target;
}

<!--// Validar Email
function  ValidarEmail(item)
{
    var checkOK = "0123456789-.@abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_";
    var checkStr = item.value;
    var allValid = true;
    var decPoints = 0;
    var posarroba = 0;
    var cantarroba=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;
		}
		if(ch == "@"){
		   allNum += "@";
		   posarroba = i;
		   cantarroba ++;
		}
		else if(ch == ".")
		{
			allNum += ".";
			decPoints++;
        }		
		else
		{
			allNum += ch;
		}
	}
	if(cantarroba > 1){
		allValid = false;
	}
	if(cantarroba <1){
		allValid = false;
	}
		
	if(posarroba == 0){
	    allValid = false;
	}
	if(decPoints < 1){
		allValid = false;
	}
	return (allValid);
}
function allSelect()
{
List = document.forms[0].elements["destinatarios[]"];
if (List.length && List.options[0].value == 'temp') return;
for (i=0;i<List.length;i++)
{
List.options[i].selected = true;
}
}
function poptastic(url, name)
{
    name=window.open(url, name,'height=700,width=760');
	if (window.focus) {name.focus()}
}
function validateRefer(theForm) {
	if (theForm.name.value == "") {
		alert("Ingrese su nombre");
		theForm.name.focus();
		return false;
	}
	if (theForm.email.value == "") {
         alert("Ingrese el correo electronico");
		 theForm.email.focus();
		 return (false);
    }
	if(!ValidarEmail(theForm.email)) {
    	alert("Correo Electronico Invalido");
		theForm.email.focus();
		return(false);
    }
	if ((theForm.message.value == "") || (theForm.message.value == "Escribe tu mensaje:")) {
		alert("Ingrese su mensaje");
		theForm.message.focus();
		return (false);
	}
	answer = confirm("Por favor revise la informacion antes de Continuar. Si esta seguro presione OK!! ");
	if (answer!=0){
		submitform(document.getElementById('sendfriend'),'includes/sendrefer.php','form');
		return false;
	}
	else
		return false;
}
var url = "http://www.bonergemejia.com/"; 
var title = "Bonerge Mejia, Tu Decano Amigo"; 

function addToFavorites() { 
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
}
function poptastic(url)
{
	newwindow=window.open(url, 'name','height=600,width=660,scrollbars=1');
	if (window.focus) {newwindow.focus()}
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function popcopy(url)
{
    newwindow=window.open(url, 'name','height=550,width=700,scrollbars=1');
	if (window.focus) {newwindow.focus()}
}
function poppromo(url)
{
    newwindow=window.open(url, 'name','height=500,width=500, scrollbars=yes');
	if (window.focus) {newwindow.focus()}
}
function cerrarPopup(pid)
   {
      document.getElementById(pid).style.visibility = 'hidden';
	  document.getElementById(pid).style.height = '0px';  
   }