// JavaScript Document
/* Archivo de noticias generado automáticamente 
 * Fuente: http://cocos.mty.itesm.mx/cocos/allevents.jsp
 * Generado: 26-Oct-2003 20:00hrs
 */
 
urlDetalle = "http://cocos.mty.itesm.mx/infodetalle.jsp?id=";

posID     = 0;
posTitulo = 1;
posURL    = 2;
posFoto   = 3;
posColor  = 4;

var aNoticias;
aNoticias = [
    [ 12, "Microsistemas conferencias  en abril", 
	  wwwroot+"noticias/n1.html", "", "#3194C6"],
    
	[ 13, "Asiste Martha Sahagun a Primer Foro de la Mujer",
	 wwwroot+"noticias/n1.html", "", "#013765"],
    
	[ 14, "Conoce los posgrados del Campus Monterrey",
	  "http://aquino.mty.itesm.mx/pos",
	  "", "#9D0504"],
    
	[ 15, "Doctorado en Ciencias de Ingeniería",
	  "http://aquino.mty.itesm.mx/dci",
	  "", "#CEAD08"]
];

aNoticias = [ // id, titulo, foto
	"123","Inauguran edificio CIAP con laboratiorios incluidos",    "",
	"345","Wake up, Neo ...",           "/campus/images/noticia1.jpg",
	"456","The Matrix has you ...",     "",
	"451","Follow the white rabbit ...","/campus/images/noticia2.jpg"
	]

aNotProfesional = [ // id, titulo, foto
	"123","Gánate una beca deportiva...", "/campus/images/noticia1.jpg",
	"345","Wake up, Neo ...",           "",
	"456","Estudia un semestre en el extranjero ...",     "",
	"451","Follow the white rabbit ...","/campus/images/noticia2.jpg"
	]

wideEvt = 170;

function eventos(num, categoria){
	var aNot;
	if (!categoria)
		aNot = aNoticias;
	else {
		// otras categorias
		aNot = categoria;
	}
	// numnot es el número de noticias disponibles en la categoría
	numnot = aNot.length/3;
	// n es el número de evento a partir del cuál se publicará
    n=Math.floor(Math.random() * numnot);
	if (num>numnot)  // validación por si hay pocas noticias
		num = numnot;
	
	// pos indica el evento que está sacando del arreglo aNot
	pos = n;
	// posFoto indica de qué lado pondrá la foto: 1=derecha y 0=izquierda
	posFoto = 1;
	document.write('<table width="190" height="137" bgcolor="#FFFFFF" border="0">');
	for (i=0; i<num; i++) {
		if (pos>(numnot-1))
			pos = 0;
		cve = aNot[pos*3];    // id del evento
		tit = aNot[pos*3+1];  // título del evento
		ico = aNot[pos*3+2];  // URL del ícono
		document.write('<tr><td align=center><div align="center">');
		if (ico=="") {// si no tiene icono
		    document.write('<table width="160" border="0" cellpadding="0" cellspacing="0"><tr><td>');
            document.write('<div id="noticia'+cve+'" style="color:'+noticiaTextoOff+'" class="noticias" onClick="return abrirNoticia(\''+cve+'\')" onMouseOver="onMouseOverNoticia('+cve+');" onMouseOut="onMouseOutNoticia('+cve+')">'+tit+'</div></td>');
//			document.write('<a href="'+urlDetalle+cve+'" class="noticias" target="_blank">'+tit+'</a>');
		    document.write('</td></tr></table>');
		} else {      // si tiene icono
		   if (posFoto==0){
		      document.write('<table width="160" border="0" cellpadding="0" cellspacing="0"><tr>');
		      document.write('<td width=110>');
			  document.write('<a href='+urlDetalle+cve+' class="noticias" target="_blank">'+tit+'</a>');
		      document.write('</td><td align=rigth>');
			  document.write('<a href='+urlDetalle+cve+' target="_blank"><img src="'+ico+'" width="40" height="30" border="0"></a>');
		      document.write('</td></tr></table>');
		      posFoto=1;
		   } else {
		      document.write('<table width="160" border="0" cellpadding="0" cellspacing="0"><tr>');
		      document.write('<td width=50 align=left>');
			  document.write('<a href='+urlDetalle+cve+' target="_blank"><img src="'+ico+'" width="40" height="30" border="0"></a>');
		      document.write('</td><td>');
			  document.write('<a href='+urlDetalle+cve+' class="noticias" target="_blank">'+tit+'</a>');
		      document.write('</td></tr></table>');
		      posFoto=0;
		   }
		}
		document.write('</div></td></tr>');
		if (i<(num-1)) {
			document.write('<tr><td height=6><div align=center>');
			document.write('<img src="/campus/images/sepNoticias.gif" width="140" height="6" border="0">');
			document.write('</div></td></tr>');
		}
		pos++;
	}
	document.write('</table>');
}


function eventosInt(num, categoria){
	var aNot;
	if (!categoria)
		aNot = aNoticias;
	else {
		// otras categorias
		aNot = categoria;
	}
	// numnot es el número de noticias disponibles en la categoría
	numnot = aNot.length/3;
	// n es el número de evento a partir del cuál se publicará
    n=Math.floor(Math.random() * numnot);
	if (num>numnot)  // validación por si hay pocas noticias
		num = numnot;
	
	// pos indica el evento que está sacando del arreglo aNot
	pos = n;
	// posFoto indica de qué lado pondrá la foto: 1=derecha y 0=izquierda
	posFoto = 1;
	// anchoNot indica el ancho de la noticia
	anchoNot = 120;
	document.write('<table width="'+170+'" bgcolor="#FFFFFF" border="0">');
	for (i=0; i<num; i++) {
		if (pos>(numnot-1))
			pos = 0;
		cve = aNot[pos*3];    // id del evento
		tit = aNot[pos*3+1];  // título del evento
		ico = aNot[pos*3+2];  // URL del ícono
		document.write('<tr><td align=center><div align="center">');
		if (ico=="") {// si no tiene icono
		    document.write('<table width="'+anchoNot+'" border="0" cellpadding="0" cellspacing="0"><tr><td>');
			document.write('<a href="'+urlDetalle+cve+'" class="noticias" target="_blank">'+tit+'</a>');
		    document.write('</td></tr></table>');
		} else {      // si tiene icono
		   if (posFoto==0){
		      document.write('<table width="'+anchoNot+'" border="0" cellpadding="0" cellspacing="0"><tr>');
		      document.write('<td width=110>');
			  document.write('<a href='+urlDetalle+cve+' class="noticias" target="_blank">'+tit+'</a>');
		      document.write('</td><td align=rigth>');
			  document.write('<a href='+urlDetalle+cve+' target="_blank"><img src="'+ico+'" width="40" height="30" border="0"></a>');
		      document.write('</td></tr></table>');
		      posFoto=1;
		   } else {
		      document.write('<table width="'+anchoNot+'" border="0" cellpadding="0" cellspacing="0"><tr>');
		      document.write('<td width=50 align=left>');
			  document.write('<a href='+urlDetalle+cve+' target="_blank"><img src="'+ico+'" width="40" height="30" border="0"></a>');
		      document.write('</td><td>');
			  document.write('<a href='+urlDetalle+cve+' class="noticias" target="_blank">'+tit+'</a>');
		      document.write('</td></tr></table>');
		      posFoto=0;
		   }
		}
		document.write('</div></td></tr>');
		if (i<(num-1)) {
			document.write('<tr><td height=6><div align=center>');
			document.write('<img src="/campus/images/sepNoticias.gif" width="'+anchoNot+'" height="6" border="0">');
			document.write('</div></td></tr>');
		}
		pos++;
	}
	document.write('</table>');
}

noticiaTextoOff = '#003366';
noticiaTextoOn = '#AA0000';

function onMouseOverNoticia(cve){ //vicBd 
  if ((opcion=MM_findObj('noticia'+cve))!=null){
	opcion.style.color=noticiaTextoOn;}
  return;
}

function onMouseOutNoticia(cve){ //vicBd 
  if ((opcion=MM_findObj('noticia'+cve))!=null){
	opcion.style.color=noticiaTextoOff;}
  return;
}

function abrirNoticia(cve){
  noticias = window.open(urlDetalle+cve,'noticias', 'height=200,width=250');
  if (window.focus)
  	noticias.focus();
  return false;
}	
//  hgcc

