function EncuestasResultados(idx) {
	document.frmEncuestasResultados.idxencuesta.value = idx;
	document.frmEncuestasResultados.submit();
}
function Set_Cookie(name,values,expires,path,domain,secure){

var today = new Date();
today.setTime( today.getTime() );

if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( values ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
( ( path ) ? ";path=" + path : "" ) + 
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );

}
function Votar(idx,cantidad) {
	var okvoto = false;
	var opcion = 0;
	for (i = 0 ; i < cantidad ; i++ ) {
		if (document.frmEncuestaNew.rEncuesta[i].checked) {
		  opcion = i;
		  okvoto = true;
			break;
		}
	}
	if(okvoto) {
		Set_Cookie('EncResultados',idx,'','/','','');
		window.open("../herramientas/check_cookies.php?idxencuesta="+idx+"&idxopcion="+document.frmEncuestaNew.rEncuesta[opcion].value,"Votar","width=510,height=322,outerwidth=407,outerheight=322,top=150,left=150");
	} else {
	  alert('Por favor seleccione una opción');
	}
}

function Votar2(idx,cantidad) {/*radio=frmEncuestaNew.rEncuesta*/
	var okvoto = false;
	var opcion = 0;
	
	for (var i = 0 ; i < cantidad ; i++ ) {
		if (document.getElementById('rEncuesta'+i.toString()).checked) {
		  opcion = document.getElementById('rEncuesta'+i.toString()).value;
		  okvoto = true;
			break;
		}
	}
	
	if(okvoto) {
		Set_Cookie('EncResultados',idx,'','/','','');
		window.open("../herramientas/check_cookies.php?idxencuesta="+idx+"&idxopcion="+opcion,"Votar","width=510,height=322,outerwidth=407,outerheight=322,top=150,left=150");
	} else {
	  alert('Por favor seleccione una opción');
	}
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function devolverfalse()
{
	return false;
}

function BuscarIP(from) {	

	switch(from) {
		case "sidebar" :
		if (document.getElementById('texto_sidebar').value.length < 4) {
			alert("Por favor ingrese al menos 4 letras.");
		}
		else
		{
			/*alert(from);
			//chequeamos si quiere buscar en infobae
			if(document.getElementById('infobae_sidebar').checked) {
				
				document.frmBusqueda.onsubmit = devolverfalse;
				window.open('http://www.infobae.com/herramientas/buscador.php?accion=buscar&donde=1&ultimos=30&rangoFecha=365&texto='+document.getElementById('texto_sidebar').value, 'infobae');			
			}*/
			/*else
			{*/
				if(document.getElementById('goolge_sidebar').checked) {
				
				window.open('http://www.google.com.ar/search?hl=es&q='+document.getElementById('texto_sidebar').value+'&meta=', 'google');	
				}
				else
				{
				var d = new Date()
				document.frmBusqueda.onsubmit = devolverfalse;
				window.location = "../interior/index.php?p=buscador&accion=Buscar&totalN=0&porpaginaN=10&texto="+document.getElementById('texto_sidebar').value+"&filtroFecha=1&anio="+(d.getFullYear())+"&fdd=01&fdm=01&fhd="+(d.getDate())+"&fhm="+(d.getMonth()+1)+"&rangoFecha=365";
				//window.location = "http://www.infobaeprofesional.com/interior/index.php?p=buscador&accion=Buscar&totalN=0&porpaginaN=10&texto="+document.getElementById('texto_sidebar').value+"&filtroFecha=1&anio="+(d.getFullYear())+"&fdd=01&fdm=01&fhd="+(d.getDate())+"&fhm="+(d.getMonth()+1)+"&rangoFecha=365";
				}
			/*}*/
		}
		break;
		case "footer" :
		
		if (document.getElementById('texto_footer').value.length < 4) {
			alert("Por favor ingrese al menos 4 letras.");
		}
		else
		{
			//chequeamos si quiere buscar en infobae
			/*if(document.getElementById('infobae_footer').checked) {
				document.frmBusquedaFooter.onsubmit = devolverfalse;
				window.open('http://www.infobae.com/herramientas/buscador.php?accion=buscar&donde=1&ultimos=30&texto='+document.getElementById('texto_footer').value, 'infobae');			
			}
			else
			{*/
				if(document.getElementById('goolge_footer').checked) {
				window.open('http://www.google.com.ar/search?hl=es&q='+document.getElementById('texto_footer').value+'&meta=', 'google');	
				}
				else
				{
				var d = new Date()
				document.frmBusquedaFooter.onsubmit = devolverfalse;
				window.location = "../interior/index.php?p=buscador&accion=Buscar&totalN=0&porpaginaN=10&texto=" + document.getElementById('texto_footer').value + 	"&filtroFecha=1&anio=" + (d.getFullYear())  + "&fdd=01&fdm=01&fhd=" + (d.getDate()) + "&fhm=" + (d.getMonth()+1) + "";
				//window.location = "http://www.infobaeprofesional.com/interior/index.php?p=buscador&accion=Buscar&totalN=0&porpaginaN=10&texto=" + document.getElementById('texto_footer').value + "&filtroFecha=1&anio=" + (d.getFullYear())  + "&fdd=01&fdm=01&fhd=" + (d.getDate()) + "&fhm=" + (d.getMonth()+1) + "";
				}
			//}
		}
		break;
	}
}

function BuscarInt() {
	if (document.frmPrincipal.texto.value.length < 4) {
		alert("Ingrese por favor al menos 4 letras.");
	}
	else
	{
		var d = new Date()
		document.frmPrincipal.onsubmit = devolverfalse;
		window.location = "http://www.infobaeprofesional.com/interior/index.php?p=buscador&accion=Buscar&totalN=0&porpaginaN=10&texto=" + document.frmPrincipal.texto.value + "&filtroFecha=1&anio=" + (d.getFullYear())  + "&fdd=01&fdm=01&fhd=" + (d.getDate()) + "&fhm=" + (d.getMonth()+1) + "";
	}
}

function BuscarDesdeHerramientas(keycode) {
	if (document.frmPrincipal.texto.value.length < 4) {
		alert("Ingrese por favor al menos 4 letras.");
	} else {
		var d = new Date()
		document.getElementById('frameHerr').src = "http://www.infobaeprofesional.com/interior/index.php?p=buscador_herr&accion=Buscar&total=0&porpagina=10&texto=" + document.frmPrincipal.texto.value + "&filtroFecha=2&anio=" + (d.getFullYear())  + "&fdd=01&fdm=01&fhd=" + (d.getDate()) + "&fhm=" + (d.getMonth()+1) + "";
		if(keycode == 13) return false;
		//document.frmResultado.target = "frameHerr";
		//document.frmResultado.action = "index.php?p=buscador_herr&accion=Buscar&total=0&porpagina=10&texto=" + document.frmPrincipal.texto.value + "&filtroFecha=1&anio=" + (d.getFullYear())  + "&fdd=01&fdm=01&fhd=" + (d.getDate()) + "&fhm=" + (d.getMonth()+1) + "";
		//document.frmResultado.site.value = "1";
		//document.frmResultado.submit();
		//return;
	}
}

function BuscarBoletin() {
	document.frmPrincipal.accion.value = "buscarboletin";
	document.frmPrincipal.pagina.value = "0";
	document.frmPrincipal.total.value = "0";
	document.frmPrincipal.submit();
}

function WebLogin() {
	
	if (!document.frmLogin.usuario.value.length) {
	  alert ("Por favor, ingrese un nombre de usuario.\n");
	  document.frmLogin.usuario.focus();
	  return false;
	}
	if (!document.frmLogin.password.value.length) {
	  alert ("Por favor, ingrese su password.\n");
	  document.frmLogin.password.focus();
	  return false;
  	}
	
	document.frmLogin.accion.value      = "Login";
	document.frmLogin.html_actual.value = window.location.href.replace("&","|##|");
	document.frmLogin.action            = "../interior/index.php?=home";
	document.frmLogin.submit();
	return true;
}
function WebLoginFrmPpal() {
	
	if (!document.frmPrincipal.usuario.value.length) {
	  alert ("Por favor, ingrese un nombre de usuario.\n");
	  document.frmPrincipal.usuario.focus();
	  return false;
	}
	if (!document.frmPrincipal.password.value.length) {
	  alert ("Por favor, ingrese su password.\n");
	  document.frmPrincipal.password.focus();
	  return false;
  	}
	
	document.frmPrincipal.accion.value      = "Login";
	document.frmPrincipal.html_actual.value = window.location.href.replace("&","|##|");
	//document.frmPrincipal.action            = "../interior/index.php?=home";
	document.frmPrincipal.submit();
	return true;
}

function WebLoginEcom(idxseccion) {
	
	if (!document.frmPrincipal.usuarioE.value.length) {
	  alert ("Por favor, ingrese un nombre de usuario.\n");
	  document.frmPrincipal.usuarioE.focus();
	  return false;
	}
	if (!document.frmPrincipal.passwordE.value.length) {
	  alert ("Por favor, ingrese su password.\n");
	  document.frmPrincipal.passwordE.focus();
	  return false;
  	}
	
	document.frmPrincipal.accion.value      = "Login";
	document.frmPrincipal.html_actual.value = window.location.href.replace("&","|##|");
	document.frmPrincipal.action            = "../interior/index.php?p=carrito&idxseccion="+idxseccion;
	document.frmPrincipal.tipo.value		= "ecomm";
	document.frmPrincipal.submit();
	return true;
}

function WebLoginAccesos() {
	if (!document.frmPrincipal.usuario.value.length) {
	  alert ("Por favor, ingrese un nombre de usuario.\n");
	  document.frmPrincipal.usuario.focus();
	  return;
	}
	if (!document.frmPrincipal.password.value.length) {
	  alert ("Por favor, ingrese su password.\n");
	  document.frmPrincipal.password.focus();
	  return;
  }
	document.frmPrincipal.method = "POST";
	document.frmPrincipal.accion.value = "Login";
	document.frmPrincipal.submit();
}

function WebLoginTD() {
	if (!document.frmPrincipal.usuario.value.length) {
	  alert ("Por favor, ingrese un nombre de usuario.\n");
	  document.frmPrincipal.usuario.focus();
	  return;
	}
	if (!document.frmPrincipal.password.value.length) {
	  alert ("Por favor, ingrese su password.\n");
	  document.frmPrincipal.password.focus();
	  return;
  }
	document.frmPrincipal.method = "POST";
	document.frmPrincipal.accion.value = "Login";
	document.frmPrincipal.submit();
}

function LogOff() {
	document.frmLogin.method = "POST";
	document.frmLogin.accion3.value = "logout";
	document.frmLogin.action = "/loginfront.php";
	//Set_Cookie( 'LoginCorporate', '', '', '/', '', '' );
	//Set_Cookie( 'ComunidadCorporate', '', '', '/', '', '' );
	document.cookie = "LoginCorporate=;path=/;domain=.infobaeprofesional.com;expires=Thu, 01-Jan-70 00:00:01 GMT";
	document.cookie = "ComunidadCorporate=;path=/;domain=.infobaeprofesional.com;expires=Thu, 01-Jan-70 00:00:01 GMT";
	//window.location.href = window.location.href;
	document.frmLogin.submit();
}


function MostrarNotasColumnista(idx,tipo) {
  window.location = '../notas/nota3cols.php?cambiopais=&p=home&accion=&idxproducto=&html_actual=&idx=&idxSeccion=&idx='+idx+'&pagina=0&total=0&tipo_col='+tipo;
  /*
  document.frmPrincipal.idx.value = idx;
  document.frmPrincipal.tipo_col.value = tipo;
  document.frmPrincipal.action = '../notas/nota3cols.php';
  document.frmPrincipal.submit();
  */
}
function Registrar(){
	document.frmPrincipal.method = "POST"
	document.frmPrincipal.accion.value = "Registrar";
	document.frmPrincipal.submit();
}

function Modificar(){
	document.frmPrincipal.method = "POST";
	document.frmPrincipal.accion.value = "Update";
	document.frmPrincipal.submit();
}

function EnviarPassword(){
	//document.EnviarPass.method = "POST";
	//document.EnviarPass.accion.value = "EnviarMail";
	document.EnviarPass.submit();
}

function Imprimir(idx) {
		window.open("../secciones/imprimir.php?idx="+idx,"Imprimir","toolbar=no,status=no,scrollbars=yes,location=no,menubar=yes,directories=no,width=636,height=425,top=100,left=100");
}

function Imprimir_editor(idxseccion) {
		window.open("../secciones/imprimir_editor.php?idxseccion="+idxseccion,"Imprimir","toolbar=no,status=no,scrollbars=yes,location=no,menubar=yes,directories=no,width=636,height=425,top=100,left=100");
}

function ImprimirBAE(idx) {
		window.open("../herramientas/imprimirBAE.php?idx="+idx,"ImprimirBAE","toolbar=no,status=no,scrollbars=yes,location=no,menubar=yes,directories=no,width=636,height=425,top=100,left=100");
}

function agregarProducto(idxproducto, idxseccion)
{
  document.frmPrincipal.idxproducto.value = idxproducto;
  document.frmPrincipal.idx.value = idxproducto;
  document.frmPrincipal.accion.value = "agregarCarrito";
  document.frmPrincipal.action = "../interior/carrito.php?idxseccion="+idxseccion;
  document.frmPrincipal.method = "POST";
  document.frmPrincipal.submit();
}

function agregarProductoPOPUP(idxproducto, idxseccion)
{
  document.frmPrincipal.idxproducto.value = idxproducto;
  document.frmPrincipal.idx.value = idxproducto;
  document.frmPrincipal.accion.value = "agregarCarrito";
  document.frmPrincipal.method = "POST";
  document.frmPrincipal.submit();
}

function agregarProductoWishlist(idxproducto) {
  document.frmPrincipal.idxproducto.value = idxproducto;
  document.frmPrincipal.accion.value = "agregarWishlist";
  document.frmPrincipal.action = window.location;
  document.frmPrincipal.method = "POST";
  document.frmPrincipal.submit();
}

function IrAPagina(num)
{
  document.frmPrincipal.pagina.value = num - 1;
  document.frmPrincipal.accion.value = "buscar";
  document.frmPrincipal.action = "#comentar";
  document.frmPrincipal.submit();
}

function IrAPagina2(num) {
  document.frmPrincipal.pagina.value = num ;
  document.frmPrincipal.accion.value = "buscar";
  document.frmPrincipal.action = "#comentar";
  document.frmPrincipal.submit();
}

function Borrar(){
	document.frmPrincipal.reset() ;
}

function fVerDetalleExecuzone(id) {
  window.open("../secciones/detalle_execuzone.php?id=" + id,"detalleExecuzone","toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,directories=no,width=610,height=400,top=100,left=100");
}

function fVerDetalleEmpresa(id) {
  window.open("../secciones/detalle_empresa.php?id=" + id,"detalleEmpresa","toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,directories=no,width=530,height=450,top=100,left=100");
}

function fVerDetalleFranquicia(idx) {
  window.location = "../interior/index.php?p=detFranq&idx=" + idx;
}

function fVerDetalleFranquicia2(idx) {
  window.location = "../interior/index.php?p=detFranq_herr&idx=" + idx;
}

function popGuiaIndustria() {
  window.open("../secciones/guia_industria.php","guiaIndustria","toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,directories=no,width=416,height=600,top=100,left=100");
}

function verEstadistica(idx) {
  window.open("../secciones/estadisticas_pop.php?idx="+idx,"estadisticas","toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,directories=no,width=616,height=400,top=100,left=100");
}

function fBuscarEmpresa() {
  var tipo;
  for ( i = 0 ; i < frmPrincipal.f_paramTipo.length; i++) {
    if (document.frmPrincipal.f_paramTipo[i].checked)
      tipo = document.frmPrincipal.f_paramTipo[i].value;
  }
  if(document.frmPrincipal.f_paramEmp.value.length >= 3) {
    window.location = "../interior/index.php?p=busqEmpresa&f_paramEmp=" + document.frmPrincipal.f_paramEmp.value + "&f_paramTipo=" + tipo;
  } else {
    alert('Por favor ingrese un parametro de busqueda de al menos 3 caracteres');
    document.frmPrincipal.f_paramEmp.focus();
  }
}

function tiposCambio() {
  window.open("../herramientas/tiposcambio.php","tiposCambio","toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,directories=no,width=620,height=650,top=100,left=100");
}

function openLink(URL) {
  window.open(URL,"link","resizable=yes,toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,directories=no,width=620,height=650,top=100,left=100");
}

function openBoletin(idx) {
  window.open("../secciones/boletin_detalle.php?idx="+idx,"link","toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,directories=no,width=620,height=650,top=100,left=100");
}

function acceso(num,idxseccion) {
  window.open("../partners/acceso.php?num="+num+"&idxseccion="+idxseccion,"acceso","toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,width=400,height=250,top=100,left=100");
}

function accesoExt(num,idxseccion,ext) {
  window.open("../partners/acceso.php?num="+num+"&idxseccion="+idxseccion+"&ext="+ext,"acceso","toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,width=400,height=250,top=100,left=100");
}

function popPartners(idx,ret,orig) {
  var objWin = window.open("../secciones/partner_pop.php?idx="+idx+"&orig="+orig,"popPartners","toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,directories=no,width=620,height=380,top=100,left=100");
  if(ret) return objWin;
}

function Buscar_micro(){
	document.frmPrincipal.method = "POST"
	document.frmPrincipal.submit();
}

function switchFuero(fuero) {
  setCookie('fuero',fuero,30);
  window.location = "../interior/index.php?p=legales&f=" + fuero;
}

function setCookieFront(cookieName,cookieValue,nDays,path) {
                        var today = new Date();
                        var expire = new Date();
                        if (nDays==null || nDays==0) nDays=1;
                      expire.setTime(today.getTime() + 3600000*24*nDays);
  document.cookie = cookieName+"="+escape(cookieValue) + ";expires="+expire.toGMTString()+";path="+path+";domain=.infobaeprofesional.com";
                        }

function setCookie(cookieName,cookieValue,nDays) {
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 expire.setTime(today.getTime() + 3600000*24*nDays);
 document.cookie = cookieName+"="+escape(cookieValue) + ";expires="+expire.toGMTString();
}

function Infografias(idx) {
  loc = (idx) ? "../herramientas/infografias.php?idx="+idx : "../herramientas/infografias.php";
  window.open(loc,"Infografias","width=615,height=480,scrollbars=yes");
}
/*[NM] 02/09/2004 05:27p.m.*/
function checkPing() {
	if (document.frmPrincipal.ping.value.length < 4){
		alert("Ingrese por favor su numero de ping.");
	}else{
	  var ping = document.frmPrincipal.ping.value
	  window.open('../tarjetademo/login.php?ping='+ ping  ,'TarjetaDemo','tollbars=no,width=355, height=300, top=10, left=50');
	  document.frmPrincipal.ping.value = "";
	}
}

function checkPingBanner() {
  //  alert(document.frmPrincipal.pingbanner.value);
	if (document.frmPrincipal.pingbanner.value.length < 4){
		alert("Ingrese por favor su numero de ping.");
	}else{
	  var ping = document.frmPrincipal.pingbanner.value
	  window.open('../tarjetademo/login.php?ping='+ ping  ,'TarjetaDemo','tollbars=no,width=355, height=300, top=50, left=50');
	  document.frmPrincipal.pingbanner.value = "";
	}
}

function OpenAlertaTemprana(){
  window.open('../alertatemprana/popup.php' , 'alertaTemprana' , 'tollbars=no,width=355, height=300, top=50, left=50' );
}

function OpenAlertaTempranaCarga(){
  window.open('../alertatemprana/popup_carga.php' , 'alertaTemprana' , 'tollbars=no,width=355, height=300, top=50, left=50' );
}

function validaremail(stringValue, campo)
{
  var total = stringValue.length;

  for (a = 0; a < total; a++)
  {
    var stringValue = stringValue.replace(" ","");
  }

  if (stringValue.length < 1)
  {
    return "El campo \"" + campo + "\" no puede estar vacio.\n";
  }
  else
  {
    var strRegExp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;
    if ((!strRegExp.test(stringValue)) && strRegExp !="")
    {
      return "El campo \"" + campo + "\" es invalido.\n";
    }
  }
  return "";
}


var arrSubActivos  = new Array();
var mostrarSubmenu = true;
var opcionActiva   = "";

function changeBackground(strId, color){
	if(document.getElementById(""+strId+"") && opcionActiva != strId)  document.getElementById(""+strId+"").style.backgroundColor = color;
}

function displaySubmenu(strIdPadre, strId, nivel)
{
	if (mostrarSubmenu)
	{
		ocultarSubmenuesActivos(nivel);
		arrSubActivos.push(strId);
		if(document.getElementById(""+strId+"")) displayFrame(strId,true);
		setTopDivMenu(strIdPadre, strId, nivel);
	}
}


function setTopDivMenu(strIdPadre, strId, nivel){
	if( nivel == 1 ){
		if(document.getElementById(strId)) document.getElementById(strId).style.top = (document.getElementById(strIdPadre).offsetTop + document.getElementById('TABLE_HEADER').offsetHeight) - document.getElementById('DIV_MENU').scrollTop;
	}
}


function ocultarSubmenuesActivos(nivel)
{
	for(a = arrSubActivos.length-1; a >= 0; a-- )
	{
		if ( arrSubActivos[a].substr(8,1) >= nivel )
		{
			if( document.getElementById(""+arrSubActivos[a]+"") ) nodisplaySubmenu(arrSubActivos[a]);
			arrSubActivos.pop();
		}
	}
}

function changemostrarSubmenu(val){
	if (!val){
		ocultarSubmenuesActivos(1);
		mostrarSubmenu = false;
	}else{
		setTimeout("mostrarSubmenu = true", 1000);
	}
}

function nodisplaySubmenu(strId){
	displayFrame(strId,false);
}

function displayFrame(strId,display){
	var idSubmenu = strId;
	var idFrame 	= strId.replace(/SUBMENU/, 'FRAME');
	if (display){
		document.getElementById(idFrame).style.display 			= "block";
		document.getElementById(idFrame).style.visibility 	= "visible";
		document.getElementById(idSubmenu).style.display 		= "block";
		document.getElementById(idSubmenu).style.visibility = "visible";
	}else{
		document.getElementById(idFrame).style.display 			= "none";
		document.getElementById(idFrame).style.visibility 	= "hidden";
		document.getElementById(idSubmenu).style.display 		= "none";
		document.getElementById(idSubmenu).style.visibility = "hidden";
	}
}

var tim = 0;
function ocultarTodo(val){
	if (val == 1){
		tim = setTimeout("ocultarTodo(0)", 5000);
	}else{
		clearTimeout(tim);
		ocultarSubmenuesActivos(0);
	}
}

function setActivo(strId)
{
  clearTimeout(tim);
}

function setActiva(strId){
	opcionActiva = strId;
	var arrOpciones = document.getElementsByTagName("tr");
	for(a = 0; a < arrOpciones.length; a++ ){
		if( arrOpciones[a].id.substr(0,7) == 'MENU_0_' ){
			document.getElementById(arrOpciones[a].id).style.backgroundColor = "#FFFFFF";
		}
	}
	document.getElementById(strId).style.backgroundColor = "#EFEFF7";
}

function recargarImagen()
{
	if (document.getElementById("partnerImagen"))
	{
		document.getElementById("partnerImagen").src = document.getElementById("partnerImagen").src;
	}
}


function GuardarNota(idx)
{
	var cook = getCookie("NotasGuardadas");
	
	if (cook==null)
	{
		cook = "";
	}
	if (cook.indexOf(idx)==-1)
	{
		cook += idx+"|";
		setCookie("NotasGuardadas",cook,30);
	}
	document.getElementById("idGuardarNotas").style.display = "none";
	ActualizarCantidadNotasGuardadas();
}

function getNotasGuardadas()
{
	var cook = getCookie("NotasGuardadas");
	var arr = new Array();
	var ret = new Array();
	
	arr = cook.split("|");
	for (i=0; i<= arr.length-2;i++)
	{
		ret[i] = arr[i];
	}
	return ret;	
}

function MostrarNotasGuardadas()
{
	var div = document.getElementById("idGuardarNotas");
	var frm = document.getElementById("idFrameNotasGuardadas");
	var cook = getCookie("NotasGuardadas");
	
	frm.src = "../secciones/iframe_notas_guardadas.php?notas="+cook;
	if(div.style.display == "none")
	{
		div.style.display = "block";
	}
	else
	{
		div.style.display = "none";
	}
}

function BorrarMisArtTodos()
{
	setCookie("NotasGuardadas","",30);
	document.frames['FrameNotasGuardadas'].window.location = "../secciones/iframe_notas_guardadas.php?notas=null";
	ActualizarCantidadNotasGuardadas();
}

function CerrarDivArticulos()
{
	var div = document.getElementById("idGuardarNotas");
	div.style.display = "none";
}

function BorrarSeleccionados()
{
	var arrElem = document.frames['FrameNotasGuardadas'].frmPrincipal.elements;
	
	for (i=0;i<arrElem.length;i++)
	{
		if(arrElem[i].name.substr(0,18) == "borrarNotaGuardada" && arrElem[i].checked)
		{
			idx = arrElem[i].name.substr(19,10);
			idx = idx.replace("]","");
			BorrarArticulo(idx);
		}
	}
	
	//document.getElementById("idGuardarNotas").style.display = "none";
	ActualizarCantidadNotasGuardadas();
}

function BorrarArticulo(idx)
{
	var cook = getCookie("NotasGuardadas");
	ncook = cook.replace(idx+"|","");
	setCookie("NotasGuardadas",ncook,30);
	document.frames['FrameNotasGuardadas'].window.location = "../secciones/iframe_notas_guardadas.php?notas="+ncook;
}

function ActualizarCantidadNotasGuardadas()
{
	var cook = getCookie("NotasGuardadas");
	if(cook!=null)
	{
		arr = cook.split("|");
		document.getElementById("idCantidadGuardadas").innerHTML = "<strong>"+parseInt(arr.length-1)+"</strong>";
	}
	else
	{
		document.getElementById("idCantidadGuardadas").innerHTML = 0;
	}
}

function abrirNotaGuardada(idx)
{
	parent.window.location = "../interior/index.php?p=nota&idx="+idx;
}

function noticiasfotoPopUp(idxNota, opcion, layout) {
  galleta = '1024x768';
  w = 550;
  h = 575;

  opcion = (typeof(opcion) == "undefined")? 0 : opcion;
  layout = (typeof(layout) == "undefined")? 1 : layout;
  window.open('../interior/noticiasfotoPopUp.php?idxNota=' + idxNota + '&opcion=' + opcion + '&layout=' + layout, 'noticiasfotoPopUp', 'status=no, top=0, left=0, toolbar=no, width=' + w + ', height=' + h);
}
function vidrierafotoPopUp(idxV, opcion, layout) {
  galleta = '1024x768';
  w = 550;
  h = 575;

  opcion = (typeof(opcion) == "undefined")? 0 : opcion;
  layout = (typeof(layout) == "undefined")? 1 : layout;
  window.open('../interior/vidrierafotoPopUp.php?idxV=' + idxV + '&opcion=' + opcion + '&layout=' + layout, 'vidrierafotoPopUp', 'status=no, top=0, left=0, toolbar=no, width=' + w + ', height=' + h);
}
function SetCookieDet( name, value, expires, path, domain, secure ) 
{
	var today = new Date();
	today.setTime( today.getTime() );
	
	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 abrirVideoVideoteca(idx)
{
	var frm = document.getElementById("frmPrincipal");
	frm.method = "POST";
	frm.idxvideo.value = idx;
	frm.p.value = "videoteca";
	frm.submit();
}


function Get_Cookie( check_name ) {
	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f
	
	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );
		
		
		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
	
		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			// we need to handle case where cookie has no value but exists (no = sign, that is):
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			// note that in cases where cookie is initialized but no value, null is returned
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}

function IrAPaginaVideoteca(num,def)
{
	if(typeof(def)=="undefined")
	{
		document.frmPrincipal.from_seccion.value = "tecnologia";
	}
	else
	{
		document.frmPrincipal.from_seccion.value = def;
	}
	
	document.frmPrincipal.pag.value = num - 1;
	document.frmPrincipal.accion.value = "buscar";
	document.frmPrincipal.method="POST";
	document.frmPrincipal.submit();
}

/*Funciones para Login con Ajax*/
var xmlHttp = null;
function crearXmlHTTP()
{
	try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
      document.myForm.time.value=xmlHttp.responseText;
      }
    }
}


function validarLoginComunidad(usr,password){
	crearXmlHTTP();
	var url = "../validarlog-com.php?user="+usr+"&pass="+password;
	xmlHttp.onreadystatechange=ajaxValidarUsuariosComunidad;
	xmlHttp.open("GET",url,true);		//acá true es para hacerlo sincronico o asincronico....fijate eso
	xmlHttp.send(null);
}


function validarLogin()
{
	usuario = document.getElementById('usuarioLog').value;
	password = document.getElementById('password').value;
	if (usuario.length > 0)	
	{
		crearXmlHTTP();
		var url="../validarlog.php?user="+usuario+"&pass="+password;
		xmlHttp.onreadystatechange=ajaxValidarUsuarios;
		xmlHttp.open("GET",url,true);		//acá true es para hacerlo sincronico o asincronico....fijate eso
		xmlHttp.send(null);
	}
	else alert('Ingrese un Usuario');
}
function ajaxValidarUsuariosComunidad(){
	
	if(xmlHttp.readyState==4)
	{	
		var result = xmlHttp.responseText;	//respuesta de request.php
		//resultado = result.split("|")

		if (result != "false")
		{
			//return result;

			//plantamos la cookie de front LoginCorporate
			setCookieFront('LoginCorporate',result,7,'/');
			return 1;	
		}
		
	}
}


function ajaxValidarUsuarios(){
	
	if(xmlHttp.readyState==4)
	{	
		var result = xmlHttp.responseText;	//respuesta de request.php
		resultado = result.split("|")
		
		if (resultado[0] == "No existe"){
			alert("El usuario ingresado no existe");
		}
		
		if (resultado[0] == "ok"){
			document.frmLogin.action = "../loginfront.php"
			//document.frmLogin.p1.value = "loginHome";
			document.frmLogin.submit();
		}
	}
}


