//Declarando variables:

var imageName;
var number = 1;
var group;

//Declaración de variables de imagen con dirección de la imagen:

if (document.images) {
  mexflagon		= new Image(26,15); mexflagon.src= "images/extras/mx-flag_on.gif";
  mexflagoff		= new Image(26,15); mexflagoff.src= "images/extras/mx-flag_off.gif";
  usaflagon		= new Image(26,15); usaflagon.src= "images/extras/usa-flag_on.gif";
  usaflagoff		= new Image(26,15); usaflagoff.src= "images/extras/usa-flag_off.gif";
  grupoanterioroff	= new Image(40,28); grupoanterioroff.src= "images/photos/flecha-anterior-off.gif";
  grupoanterioron	= new Image(40,28); grupoanterioron.src= "images/photos/flecha-anterior-on.gif";
  gruposiguienteoff	= new Image(40,28); gruposiguienteoff.src= "images/photos/flecha-siguiente-off.gif";
  gruposiguienteon	= new Image(40,28); gruposiguienteon.src= "images/photos/flecha-siguiente-on.gif";
  group1		= new Image(84,455); group1.src = "images/photos/photosmenu1.gif";
  group2		= new Image(84,455); group2.src = "images/photos/photosmenu2.gif";
  group3		= new Image(84,455); group3.src = "images/photos/photosmenu3.gif";
  group4		= new Image(84,455); group4.src = "images/photos/photosmenu4.gif";
  group5		= new Image(84,455); group5.src = "images/photos/photosmenu5.gif";
  group6		= new Image(84,455); group6.src = "images/photos/photosmenu6.gif";
  group7		= new Image(84,455); group7.src = "images/photos/photosmenu7.gif";
  group8		= new Image(84,455); group8.src = "images/photos/photosmenu8.gif";
  foto1		= new Image(315,420); foto1.src = "images/photos/foto-01.gif";
  foto2		= new Image(315,420); foto2.src = "images/photos/foto-02.gif";
  foto3		= new Image(315,420); foto3.src = "images/photos/foto-03.gif";
  foto4		= new Image(315,420); foto4.src = "images/photos/foto-04.gif";
  foto5		= new Image(315,420); foto5.src = "images/photos/foto-05.gif";
  foto6		= new Image(315,420); foto6.src = "images/photos/foto-06.gif";
  foto7		= new Image(315,420); foto7.src = "images/photos/foto-07.gif";
  foto8		= new Image(315,420); foto8.src = "images/photos/foto-08.gif";
  foto9		= new Image(315,420); foto9.src = "images/photos/foto-09.gif";
  foto10		= new Image(315,420); foto10.src = "images/photos/foto-10.gif";
  foto11		= new Image(315,420); foto11.src = "images/photos/foto-11.gif";
  foto12		= new Image(315,420); foto12.src = "images/photos/foto-12.gif";
  foto13		= new Image(315,420); foto13.src = "images/photos/foto-13.gif";
  foto14		= new Image(315,420); foto14.src = "images/photos/foto-14.gif";
  foto15		= new Image(315,420); foto15.src = "images/photos/foto-15.gif";
  foto16		= new Image(315,420); foto16.src = "images/photos/foto-16.gif";
  foto17		= new Image(315,420); foto17.src = "images/photos/foto-17.gif";
  foto18		= new Image(315,420); foto18.src = "images/photos/foto-18.gif";
  foto19		= new Image(315,420); foto19.src = "images/photos/foto-19.gif";
  foto20		= new Image(315,420); foto20.src = "images/photos/foto-20.gif";
  foto21		= new Image(315,420); foto21.src = "images/photos/foto-21.gif";
  foto22		= new Image(315,420); foto22.src = "images/photos/foto-22.gif";
  foto23		= new Image(315,420); foto23.src = "images/photos/foto-23.gif";
  foto24		= new Image(315,420); foto24.src = "images/photos/foto-24.gif";
  foto25		= new Image(315,420); foto25.src = "images/photos/foto-25.gif";
  foto26		= new Image(315,420); foto26.src = "images/photos/foto-26.gif";
  foto27		= new Image(315,420); foto27.src = "images/photos/foto-27.gif";
  foto28		= new Image(315,420); foto28.src = "images/photos/foto-28.gif";
  foto29		= new Image(315,420); foto29.src = "images/photos/foto-29.gif";
  foto30		= new Image(315,420); foto30.src = "images/photos/foto-30.gif";
  foto31		= new Image(315,420); foto31.src = "images/photos/foto-31.gif";
  foto32		= new Image(315,420); foto32.src = "images/photos/foto-32.gif";
}

//Función "point" que cambiará la imagen en la posición donde se ubique el Mouse:

function point( imageName ) {
  if ( document.images ) {
    document[ imageName ].src = eval(imageName + "on.src");
  }
}

//Función "nopoint" que cambiará la imagen en la posición donde se quite el Mouse:

function nopoint( imageName ) {
  if ( document.images ) {
    document[ imageName ].src = eval(imageName + "off.src");
  }
}

function group( num ) {
	if (num == 0) {
		number = number + 1;
		if ( number >= 9) {
			number = 8;
		}
		else {
			if ( document.images ) {
				document.images[ "groupall" ].src = eval( "group" + number + ".src" );
			}
		}
	}
	else {
		if (num == 1) {
			number = number - 1;
			if ( number <= 0) {
				number = 1;
			}
			else {
				if ( document.images ) {
					document.images[ "groupall" ].src = eval( "group" + number + ".src" );
				}
			}
		}
	}
}

function updatefoto( expo ) {
	if ( number == 1 ) {
		if ( expo == 1 ) {
			ventana=open("images/photos/foto_01.html","Fotos","alwaysRaised=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
		}
		else {
			if (expo == 2) {
				ventana=open("images/photos/foto_02.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
			}
			else {
				if (expo == 3) {
					ventana=open("images/photos/foto_03.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
				}
				else {
					if (expo == 4) {
						ventana=open("images/photos/foto_04.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
					}
				}
			}
		}
	}
	else {
		if ( number == 2 ) {
			if ( expo == 1 ) {
				ventana=open("images/photos/foto_05.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
			}
			else {
				if (expo == 2) {
					ventana=open("images/photos/foto_06.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
				}
				else {
					if (expo == 3) {
						ventana=open("images/photos/foto_07.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
					}
					else {
						if (expo == 4) {
							ventana=open("images/photos/foto_08.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
						}
					}
				}
			}
		}
		else {
			if ( number == 3 ) {
				if ( expo == 1 ) {
					ventana=open("images/photos/foto_09.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
				}
				else {
					if (expo == 2) {
						ventana=open("images/photos/foto_10.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
					}
					else {
						if (expo == 3) {
							ventana=open("images/photos/foto_11.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
						}
						else {
							if (expo == 4) {
								ventana=open("images/photos/foto_12.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
							}
						}
					}
				}
			}
			else {
				if ( number == 4 ) {
					if ( expo == 1 ) {
						ventana=open("images/photos/foto_13.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
					}
					else {
						if (expo == 2) {
							ventana=open("images/photos/foto_14.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
						}
						else {
							if (expo == 3) {
								ventana=open("images/photos/foto_15.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
							}
							else {
								if (expo == 4) {
									ventana=open("images/photos/foto_16.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
								}
							}
						}
					}
				}
				else {
					if ( number == 5 ) {
						if ( expo == 1 ) {
							ventana=open("images/photos/foto_17.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
						}
						else {
							if (expo == 2) {
								ventana=open("images/photos/foto_18.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
							}
							else {
								if (expo == 3) {
									ventana=open("images/photos/foto_19.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
								}
								else {
									if (expo == 4) {
										ventana=open("images/photos/foto_20.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
									}
								}
							}
						}
					}
					else {
						if ( number == 6 ) {
							if ( expo == 1 ) {
								ventana=open("images/photos/foto_21.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
							}
							else {
								if (expo == 2) {
									ventana=open("images/photos/foto_22.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
								}
								else {
									if (expo == 3) {
										ventana=open("images/photos/foto_23.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
									}
									else {
										if (expo == 4) {
											ventana=open("images/photos/foto_24.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
										}
									}
								}
							}
						}
						else {
							if ( number == 7 ) {
								if ( expo == 1 ) {
									ventana=open("images/photos/foto_25.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
								}
								else {
									if (expo == 2) {
										ventana=open("images/photos/foto_26.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
									}
									else {
										if (expo == 3) {
											ventana=open("images/photos/foto_27.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
										}
										else {
											if (expo == 4) {
												ventana=open("images/photos/foto_28.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
											}
										}
									}
								}
							}
							else {
								if ( number == 8 ) {
									if ( expo == 1 ) {
										ventana=open("images/photos/foto_29.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
									}
									else {
										if (expo == 2) {
											ventana=open("images/photos/foto_30.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
										}
										else {
											if (expo == 3) {
												ventana=open("images/photos/foto_31.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
											}
											else {
												if (expo == 4) {
													ventana=open("images/photos/foto_32.html","Fotos","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=420,height=315");
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
}

//Función "preload" que dejará en memoria caché los elementos que serán leídos o cambiados al ejecutar la página web:

function preload(){
	if(document.images){
		
	}
}

//Función que iniciará al descargar la página web, para optimización de navegador y objetos en memoria caché:

function init(){

		//Sección que detecta que navegador estoy utilizando:

		if (navigator.appName.indexOf("Microsoft") != -1) {
			isIE = true;
		}else {
		
			if (parseInt(navigator.appVersion) >= 5) {
				isIE = true;
			}else {
				isNav = true;
			}
		}
		
		//Sección que manda llamar a la función "preload" para dejar en Cache los objetos seleccionados después:
		preload();
}