var current_image = 0;
var dia_text = new Array();

dia_text[0] = "<b>Mechanical Engineering</b><br><div align='justify'>Con tu membresía en ASME Internacional como estudiante o profesional estarás subscrito a la revista de publicación Mensual Mechanical Engineering donde se muestran los más recientes avances técnológicos en el mundo de la Ingeniería.</div>";
dia_text[1] = "<b>ASME NEWS</b><br><div align='justify'>Mensualmente los miembros ASME tienen la oportunidad de leer las noticias más recientes de la sociedad y sobre las actividades que ASME organiza para sus miembros.</div>";
dia_text[2] = "<b>Divisiones Técnicas</b><br><div align='justify'>Como miembro ASME tienes la posibilidad de integrarte a varias de las 37 divisiones técnicas, las cuales estan enfocadas a multiples áreas de investigación.</div>";
dia_text[3] = "<b>Educación</b><br><div align='justify'>ASME ofrece multiples facilidades para el desarrollo profesional de sus miembros, es por ello que ofrece descuentos en los entrenamientos en cursos técnicos y especializados por áreas de desarrolllo.</div>";
dia_text[4] = "<b>Conferencias y eventos</b><br><div align='justify'>Con tu memebresía estudiantil puedes asistir sin cargo alguno a cualquier evento, conferencia o congreso organizado por ASME.</div>";


var dia_links = new Array();

dia_links[0] = "<br><br><a href='http://www.memagazine.org/' target='_blank' class='f11bluedark'><img src='Images/flecha_azul_left.gif' height='7' width='4' border='0'> Más acerca de esta revista en Línea...</a>";
dia_links[1] = "<br><br><a href='http://www.asmenews.org/' target='_blank' class='f11bluedark'><img src='Images/flecha_azul_left.gif' height='7' width='4' border='0'> Más acerca de este periódico en Línea...</a>";
dia_links[2] = "<br><br><a href='http://www.asme.org/EP/' target='_blank' class='f11bluedark'><img src='Images/flecha_azul_left.gif' height='7' width='4' border='0'> Más acerca de las divisiones técnicas...</a>";
dia_links[3] = "<br><br><a href='http://www.asme.org/education/' target='_blank' class='f11bluedark'><img src='Images/flecha_azul_left.gif' height='7' width='4' border='0'> Más acerca de este tópico...</a>";
dia_links[4] = "<br><br><a href='http://www.asme.org/events/' target='_blank' class='f11bluedark'><img src='Images/flecha_azul_left.gif' height='7' width='4' border='0'> Más acerca de eventos y conferencias organizados por ASME...</a>";



var dia_bild = new Array();

dia_bild[0] = "B_0.JPG";
dia_bild[1] = "B_1.JPG";
dia_bild[2] = "B_2.JPG";
dia_bild[3] = "B_3.JPG";
dia_bild[4] = "B_4.JPG";




//hasta aqui es el codigo de las matrices para la galeria, definicion de variables.

function getReference (idname) {
	if ((bw.ns6 || bw.ie6) &&  (document.getElementById(idname))) return document.getElementById(idname);
	if ((bw.ie4 || bw.ie5) && (document.all[idname]))  return document.all[idname];
	return null;
}


function makeBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns6=(this.dom && !document.all)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5 && !this.ver.indexOf("Netscape6")) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
    this.opera = (navigator.userAgent.indexOf("Opera") != -1);
	if (this.ie6) this.ie5=true;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5 || this.ns6 || this.opera)
	return this
}
bw=new makeBrowser();

function writeLayer(text,id,nestref) {
	var html  ='<table width="169" border="0" cellspacing="0" cellpadding="0"><tr>';
		html +='	<td><img src="../../shared/transparent.gif" width="6" height="3"></td>';
		html +='	<td><img src="../../shared/transparent.gif" width="162" height="1"></td>';
		html +='	<td><img src="../../shared/transparent.gif" width="1" height="1"></td>';
		html +='</tr><tr>';
		html +='	<td><img src="../../shared/transparent.gif" width="6" height="180"></td>';
		html +='	<td class="f11bluedark" valign="top">'+text+'</td>';
		html +='	<td><img src="../../shared/transparent.gif" width="1" height="1"></td>';
		html +='</tr><tr>';
		html +='	<td colspan="3"><img src="../../shared/transparent.gif" width="1" height="3"></td>';
		html +='</tr></table>';

	if (bw.ns4 ) {
		var lyr = (nestref)? eval('document.'+nestref+'.document.'+id+'.document') : document.layers[id].document;
		lyr.open();
		lyr.write(html);
		lyr.close();
	}
	else  if (bw.ns6) document.getElementById(id).innerHTML = html;
	else document.all[id].innerHTML = html;
}

function getLayerStyleRef (layername){
	if (bw.ns4)	return (document.layers[layername]);
	if (bw.ie5 || bw.ns6) if (document.getElementById(layername)) return (document.getElementById(layername).style);
	if (bw.ie4)	if (document.all[layername]) return (document.all[layername].style);
	return null;
}
function setLayerGalery(){
	if (getReference ("content")) return;
	
	if (bw.ns4 || bw.ns6) {
		w=window.innerWidth-16;
	} else if (bw.opera){
		w=window.innerWidth;
	}
	 else {
		w=document.body.clientWidth;
	}
	if (bw.ns6 && (window.innerHeight > document.height)) w = w+16;

	var main_ref = getLayerStyleRef ('diaLayer');
	main_ref.visibility = "show";
	
	if (bw.ns6) main_ref.left = (((w-720)/2));
	else main_ref.left = ((w/2)+187);

	infoTimer=setTimeout("setLayerGalery()", 100);
}

function showContent (text) {
	
	var ref = getReference ("content");
	if (ref) ref.innerHTML = text;
	else writeLayer(text,'diaLayer');		
}

function next_img(){
	if (current_image < (dia_bild.length-1)){
		current_image++;
	} else {
		current_image = 0;
	}
	displayImage();
	writeLayer(dia_text[current_image],'diaLayer');	
	showContent (dia_text[current_image]+dia_links[current_image]);
}

function prev_img(){
	if (current_image > 0) {
		current_image--;
	} else {
		current_image = (dia_bild.length-1);
	}
	displayImage();
	writeLayer(dia_text[current_image],'diaLayer');
	showContent (dia_text[current_image]+dia_links[current_image]);
}

function displayImage(){
	if (bw.ns4 || bw.ie4) document.images['dia'].src = ("images/"+dia_bild[current_image]);
	if (bw.ie5 || bw.ns6) document.getElementById('dia').src = ("images/"+dia_bild[current_image]);
}