function validar_areas(v_areas){
	var i=0;
	var contador=0;
	
	for (i=0;i<v_areas.lenght;i++){
		if (v_areas[i].checked){
		contador = contador + 1;
		}
	}
	
	if(contador > 4)   
	{ 
		alert("Seleccionar Maximo 4 areas de Interes"); 
		return false;
	}
	else
		return true;
}

function setCookie( name, value, expires, path, domain, secure ){
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );
	/*
	if the expires variable is set, make the correct 
	expires time, the current script below will set 
	it for x number of days, to make it for hours, 
	delete * 24, for minutes, delete * 60 * 24
	*/
	if (expires){expires = expires * 1000 * 60 * 60 * 24;}
	
	var expires_date = new Date( today.getTime() + (expires) );
	
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
	( ( path ) ? ";path=" + path : "" ) + 
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}

function habilita_campos_password(p1,p2,p3){
	
	var old = elemento(p1);
	var pass = elemento(p2);
	var repass = elemento(p3);
	if(old.disabled == "") old.disabled = "disabled"; else old.disabled = "";		
	if(pass.disabled == "") pass.disabled = "disabled"; else pass.disabled = "";
	if(repass.disabled == "") repass.disabled = "disabled"; else repass.disabled = "";		
}

function habdes_campos_noticias(FormName,value){

	count = document.forms[FormName].elements["noticias[]"].length;
    for (i=0; i < count; i++) 
		document.forms[FormName].elements["noticias[]"][i].disabled = value;
		
}

function habdes_campos_otros_idiomas(otros_idiomas){

	var campo_otros_idiomas = elemento(otros_idiomas);
	if(campo_otros_idiomas.disabled == "") campo_otros_idiomas.disabled = "disabled"; else campo_otros_idiomas.disabled = "";		

}

function verificar_cantidad_areas_checked(FormName){
	
	total = document.forms[FormName].elements["areas[]"].length;
	chequeadas = 0;
	
    for (i=0; i < total; i++) 
	{
		if (document.forms[FormName].elements["areas[]"][i].checked)
			chequeadas++;
	}
	
	if (chequeadas > 4)
		return true;
	else
		return false;
}

function vCA_oportunidad(FormName, Obj){
	
	total = document.forms[FormName].elements[Obj.id].length;
	chequeadas = 0;
	
    for (i=0; i < total; i++) 
	{
		if (document.forms[FormName].elements[Obj.id][i].checked)
			chequeadas++;
	}
	
	if (chequeadas > 5)
		return true;
	else
		return false;
}
	





