﻿// JavaScript Document

//Funciones Operativas

function refresh() { 
	pu = window.open("../comun/refresh.html", "null","height=10,width=10,status=no,toolbar=no,menubar=no,location=no,resizable=no, titlebar=no,scrollbars=no,fullscreen=no,top=0,left=0"); 
	pu.blur(); 
	window.focus(); 
} 

function cerrarventana(){
	window.close();
}

function noticias(){
	setTimeout("location.href='/hagansegarras/rss/noticias.php'", 0000);
}

//Enlaces
function principal() {
    setTimeout("location.href='http://hagansegarras.tk'", 0000);
}  

function vallarta2000() {
	setTimeout("location.href='/hagansegarras/vallarta2000/vallarta2000.php'", 0000);
}  

function vallarta2001() {
	setTimeout("location.href='/hagansegarras/vallarta2001/vallarta2001.php'", 0000);
}

function vallarta2002() {
	setTimeout("location.href='/hagansegarras/vallarta2002/vallarta2002.php'", 0000);
}

function maruata2001() {
	setTimeout("location.href='/hagansegarras/maruata2001/maruata2001.php'", 0000);
}

function maruata2002() {
	setTimeout("location.href='/hagansegarras/maruata2002/maruata2002.php'", 0000);
}

function enlaces() {
	setTimeout("location.href='/hagansegarras/enlaces/enlaces.php'", 0000);
}

function comentarios() {
	window.open('/foro/index.php');
}

function perreadas(ItemSeleccionado) {
	setTimeout("location.href='/hagansegarras/perreadas/perreadas.php?ItemSeleccionado="+ItemSeleccionado+"'", 0000);
}

function caritas() {
	setTimeout("location.href='/hagansegarras/caritas/caritas.php'", 0000);
}

function df2001() {
	setTimeout("location.href='/hagansegarras/df2001/df2001.php'", 0000);
  }

function oaxaca() {
	setTimeout("location.href='/hagansegarras/oaxaca/oaxaca.php'", 0000);
}

function maruata2003() {
	setTimeout("location.href='/hagansegarras/maruata2003/maruata2003.php'", 0000);
}

function encuestas() {
	setTimeout("location.href='/hagansegarras/encuestas/encuestas.php'", 0000);
  }

function tv() {
	setTimeout("location.href='/hagansegarras/tv/tv.php'", 0000);
}

function ixtapa2004() {
	setTimeout("location.href='/hagansegarras/ixtapa2004/ixtapa2004.php'", 0000);
}

function vallarta2004() {
	setTimeout("location.href='/hagansegarras/vallarta2004/vallarta2004.php'", 0000);
}
  
function vallarta2005() {
	setTimeout("location.href='/hagansegarras/vallarta2005/vallarta2005.php'", 0000);
}
  
function maruata2002b() {
	setTimeout("location.href='/hagansegarras/maruata2002b/maruata2002b.php'", 0000);
}
  
function aticama2005() {
	setTimeout("location.href='/hagansegarras/aticama2005/aticama2005.php'", 0000);
}

function maruata2006() {
	setTimeout("location.href='/hagansegarras/maruata2006/maruata2006.php'", 0000);
}

function df2006() {
	medidasVentanaComun('sencillo');
	setTimeout("location.href='/hagansegarras/df2006/df2006.php?ancho="+ancho+"'", 0000);
}

function aticama2006() {
	medidasVentanaComun('sencillo');
	setTimeout("location.href='/hagansegarras/aticama2006/aticama2006.php?ancho="+ancho+"'", 0000);
}

function azufres2006() {
	medidasVentanaComun('sencillo');
	setTimeout("location.href='/hagansegarras/azufres2006/azufres2006.php?ancho="+ancho+"'", 0000);
}

function email() {
	window.open('http://mail.google.com/hosted/hagansegarras.tk');
}

function noticias_xml() {
	window.open('/hagansegarras/RSS/noticias_xml.php');
}  
  
function BusquedaGoogle(){
  var google = "<FORM method=GET action='http://www.google.com/search' target='_blank'>"
		+"<TABLE><tr><td>"
		+"<A HREF='http://www.google.com/' target='_blank'>"
		/*+"<IMG SRC='http://www.google.com/logos/Logo_25wht.gif' border='0' ALT='Google' align='absmiddle'></A>"*/
		+"<INPUT TYPE=text name=q size=22 maxlength=255 value=''>"
		+"<INPUT TYPE=hidden name=hl value=es>"
		+"<INPUT type=submit name=btnG VALUE='Buscar'>"
		+"</td><td align='center' style='font-size:90%'>"
		+"<div id='busqueda'><a href='#' title='Buscar solo en Hagansegarras.tk'><input type='checkbox'  name='sitesearch' value='hagansegarras.tk' /></a></div>"
		/*+"Buscar sólo en Hagansegarras.tk"*/
		+"</td></tr></TABLE>"
		+"</FORM>";
 	document.write(google);
}

function menuComun(){
var Temail = "Aquí está tu email de hagansegarras.tk. Revisalo";
var Tcomentarios = "Revisa los comentarios finos!. Escribe alguno.";
var Tperreadas = "Sube tus fotos y comentalas para que todos te vean, ¡y usurpa!";
var Tencuestas = "Mira las encuestas de hagansegarras y sugiere algunas nuevas. ¡Vota!";
var Tenlaces = "Entra a los sitios de las bandas más selektas para los compas y pon los tuyos.";
var Tdf2006 = "¡Entra!";
var Tmaruata2006 = "¡Entra!";
var Ttv = "Ve el canal de TV de hagansegarras.tk y pasanos más videos.";
var Tcaritas = "Checa las caritas y toda la información de los compas y de los resagados.";
var Taticama2005 = "Después de los mosquitos y los tequilas en Aticama y San Blas. Mira más.";
var Tvallarta2005 = "No crean que Vallarta es solo canibales, también hay cosas chidas, fijate...";
var Tixtapa2004 = "El viaje más concha y con el Todo Incluido más barato, asi es!";
var Toaxaca = "Una de los estados más selektos de México, guerrereamos a más no poder. Miralo.";
var Tdf2001 = "Ni la vuelta que nos dimos hasta el DF, todo por causas fuera de nuestro control. Ve el caos.";
var Tvallarta2004 = "También fuimos a Santa Maria del Oro aunque vimos la playa hasta el tercer día.";
var Tmaruata2003 = "Fueron todos los compas, estuvo bien chingón y surgieron varios conflictos!";
var Tmaruata2002 = "La primera de dos veces que fuimos ese año, en verano, mirala!";
var Tmaruata2002b = "Esta es la segunda vez, para pasar el año nuevo ya en invierno.";
var Tmaruata2001 = "El primer viaje a Maruata, nos marcó y sangramos a los alemanes bien cabron.";
var Tvallarta2002 = "Un viaje selekto aunque el Chac nos diga que es su casa y es su camioneta!";
var Tvallarta2001 = "El viaje más culero, nos engañaron y sufrimos bien cabrón, la caminadita!!!";
var Tvallarta2000 = "El primer viaje de los compas, de los más selektos que se recuerdan. Entra y ve.";
var Taticama2006 = "¡Entra!";
var Tazufres2006 = "¡Entra!";
var Tnoticias = "Revisa las últimas noticias de la comunidad, y escribe algunas, ¡nomás no pongas verbos!";
var menu = "<div id='menu' align='center' style='background-image:url(../comun/css/images/fondoTopeMenu.jpg); background-repeat:repeat-x'>"
+"<div class='topeBoxMenu'><a href='http://hagansegarras.tk'><img src='../comun/css/images/Titulo.gif' alt='HAGANSEGARRAS.TK' border='0' width='185' height='25'/></a></div>"
+"	<div id='centro' class='centroBoxMenu' align='center'>"
+"	<table width='96%' border='0' cellspacing='0' cellpadding='0' align='center'>"
+"  <tr>"
+"    <td width='16%' align='left'><strong>Secciones populares</strong> </td>"
+"    <td width='16%' align='left'><strong>Servicios Selektos</strong> </td>"
+"    <td width='16%' align='left'><strong>Las más recientes</strong> </td>"
+"    <td width='16%' align='left'><strong>Algunos viajes</strong> </td>"
+"    <td width='16%' align='left'><strong>Viajes Guerrerazos</strong>  </td>"
+"    <td width='16%' align='left'><strong>Viajes de antaño</strong> </td>"
+"  </tr>"
+"  <tr>"
+"    <td width='16%' align='left'><a href='javascript:perreadas()' title='"+ Tperreadas +"'>Perreadas</a></td>"
+"    <td width='16%' align='left'><a href='javascript:email()' title='"+ Temail +"'>Correo Electrónico</a> </td>"
+"    <td width='16%' align='left'><a href='javascript:df2006()' title='"+ Tdf2006 +"'>Ciudad de México 2006 </a></td>"
+"    <td width='16%' align='left'><a href='javascript:vallarta2005()' title='"+ Tvallarta2005 +"'>Vallarta 2005</a></td>"
+"    <td width='16%' align='left'><a href='javascript:maruata2003()' title='"+ Tmaruata2003 +"'>Maruata 2003 </a></td>"
+"    <td width='16%' align='left'><a href='javascript:vallarta2002()' title='"+ Tvallarta2002 +"'>Vallarta 2002 </a></td>"
+"  </tr>"
+"  <tr>"
+"    <td width='16%' align='left'><a href='javascript:encuestas()' title='"+ Tencuestas +"'>Encuestas</a></td>"
+"    <td width='16%' align='left'><a href='javascript:enlaces()' title='"+ Tenlaces +"'>Enlaces</a></td>"
+"    <td width='16%' align='left'><a href='javascript:aticama2006()' title='"+ Taticama2006 +"'>Aticama / San Blas 2006 </a></td>"
+"    <td width='16%' align='left'><a href='javascript:aticama2005()' title='"+ Taticama2005 +"'>Aticama / San Blas 2005</a> </td>"
+"    <td width='16%' align='left'><a href='javascript:maruata2002()' title='"+ Tmaruata2002 +"'>Maruata 2002</a> / <a href='javascript:maruata2002b()' title='"+ Tmaruata2002b +"'>Invierno </a></td>"
+"    <td width='16%' align='left'><a href='javascript:vallarta2001()' title='"+ Tvallarta2001 +"'>Vallarta 2001 </a></td>"
+"  </tr>"
+"  <tr>"
+"    <td width='16%' align='left'><a href='javascript:caritas()' title='"+ Tcaritas +"'>Caritas</a></td>"
+"    <td width='16%' align='left'><a href='javascript:comentarios()' title='"+ Tcomentarios +"'>Comentarios</a></td>"
+"    <td width='16%' align='left'><a href='javascript:maruata2006()' title='"+ Tmaruata2006 +"'>Maruata 2006</a> </td>"
+"    <td width='16%' align='left'><a href='javascript:ixtapa2004()' title='"+ Tixtapa2004 +"'>Ixtapa 2004 </a></td>"
+"    <td width='16%' align='left'><a href='javascript:maruata2001()' title='"+ Tmaruata2001 +"'>Maruata 2001 </a></td>"
+"    <td width='16%' align='left'><a href='javascript:vallarta2000()' title='"+ Tvallarta2000 +"'>Vallarta 2000</a> </td>"
+"  </tr>"
+"  <tr>"
+"    <td width='16%' align='left'><a href='javascript:tv()' title='"+ Ttv +"'>Hagansegarras TV</a> </td>"
+"    <td width='16%' align='left'><a href='javascript:noticias()' title='"+ Tnoticias +"'>Últimas noticias</a></td>"
+"    <td width='16%' align='left'><a href='javascript:azufres2006()' title='"+ Tazufres2006 +"'>Los Azufres 2006 </a></td>"
+"    <td width='16%' align='left'><a href='javascript:vallarta2004()' title='"+ Tvallarta2004 +"'>Vallarta 2004</a> </td>"
+"    <td width='16%' align='left'><a href='javascript:oaxaca()' title='"+ Toaxaca +"'>Oaxaca</a> </td>"
+"    <td width='16%' align='left'><a href='javascript:df2001()' title='"+ Tdf2001 +"'>Ciudad de México 2001 </a></td>"
 +" </tr>"
+"</table>"
+"	</div>"
+"	<div class='inferiorBox'></div>"
+"</div>";
document.write(menu);
}

function medidasVentanaComun(tipo){
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
			winW = window.innerWidth-20;
			winH = window.innerHeight-182;
			//Validación  para mandar ancho de ventana a PHP
			if(tipo=='sencillo'){			
				if(winW < 1024){
					ancho = 800;
					return(ancho);
				}else{
					ancho = 1024;
					return(ancho);
				}
			}
 		}
		if (navigator.appName.indexOf("Microsoft")!=-1) {
			winW = document.documentElement.clientWidth;
			winH = document.documentElement.clientHeight-180;
			//Validación  para mandar ancho de ventana a PHP
			if(tipo!='sencillo'){
			mensaje = "Si estás utilizando Internet Explorer y tienes problemas viendo las fotos presiona"
					+"'REVOLVER LAS FOTOS'.\nHagansegarras recomienda utilizar Mozilla Firefox para no tener"
					+"este ni ningún otro problema. Si no, ignora este mensaje";
			alert(mensaje);  
			}else{
				if(winW < 1024){
					ancho = 800;
					return(ancho);
				}else{
					ancho = 1024;
					return(ancho);
				}
			}
		}
	} 
}

function writeFlashComun() {   
		var imStr = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+ winW +"' height='"+ winH +" id='seccionComun' align='left'>"
	+ " <param name='allowScriptAccess' value='sameDomain' />"
	+ " <param name='movie' value='../comun/seccionComun.swf?scaleX=" + winW + "&scaleY=" + winH + "' />"
	+ " <param name='quality' value='high' />"
	+ "<param name='wmode' value='transparent' />"
	+ " <param name='bgcolor' value='#FFFFFF' />"
    + " <param name='SCALE' value='exactfit'>"
	+ " <embed src='../comun/seccionComun.swf?scaleX=" + winW + "&scaleY=" + winH + "'"
		+ " width='" + winW + "' height='" + winH +" quality='high' wmode='transparent' bgcolor='#FFFFFF' name='seccionComun' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' scale='exactfit'/>";
		document.write(imStr);
}

function writeFlash(nombre, ancho, alto){
	var flash = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+ancho+"' height='"+alto+"' id='"+nombre+"' align='middle'>"
	+ "<param name='allowScriptAccess' value='sameDomain' />"
	+ "<param name='movie' value='"+nombre+".swf' />"
	+ "<param name='quality' value='high' />"
	+ "<param name='wmode' value='transparent' />"
	+ "<param name='bgcolor' value='#ffffff' />"
	+ "<embed src='"+nombre+".swf' quality='high' wmode='transparent' bgcolor='#ffffff' width='"+ancho+"' height='"+alto+"' name='"+nombre+"' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"
	+"</object>";
document.write(flash);
}

function writeFlashNoTransparent(nombre, ancho, alto){
	var flash = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+ancho+"' height='"+alto+"' id='"+nombre+"' align='middle'>"
	+ "<param name='allowScriptAccess' value='sameDomain' />"
	+ "<param name='movie' value='"+nombre+".swf' />"
	+ "<param name='quality' value='high' />"
	+ "<param name='bgcolor' value='#ffffff' />"
	+ "<embed src='"+nombre+".swf' quality='high' bgcolor='#ffffff' width='"+ancho+"' height='"+alto+"' name='"+nombre+"' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"
	+"</object>";
document.write(flash);
}

function toggleLayer(whichLayer){
	if (document.getElementById){
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display? "":"block";
	}
	else if (document.all){
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
	else if (document.layers){
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
}

function toggleLayer2(whichLayer){
	if (document.getElementById){
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display? "":"none";
	}
	else if (document.all){
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = style2.display? "":"none";
	}
	else if (document.layers){
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = style2.display? "":"none";
	}
}

/* FUNCION BANNER PRINCIPAL ALEATORIO */
function getRandom(nums)
{
    var ranNum= Math.round(Math.random()*nums);
    return ranNum;
}

function banner_principal(){
// Tells us how many images we have available.
var numSlots = 30;
var numberOfImages = numSlots;
var randomNumber = getRandom(numberOfImages);

// Create an array to hold the names of all images.
var image = new Array(numberOfImages);
for(i=0; i<=numSlots; i++){
image[i]="banner"+i+".jpg";
}

// Write the img tag with a random image name.
document.write("<img src='hagansegarras/comun/banners/" + image[randomNumber] + "' />");
//Por Cumple 2007 se comentò la linea anterior y se añadìo esta:
//document.write("<img src='hagansegarras/comun/banners/flyer_08_diciembre_2007_web.jpg' />")
}
