function showdiv(div, am)
    {
	 var a;
	 var i;	 
	 a = am;
		for (i=1; i<3; i++){

        //document.getElementById('m'+i).style.display = 'none';
		}
	if( document.getElementById(div).style.display == 'block')
	   {
	   document.getElementById(div).style.display = 'none';
	   } 
	   else
	   {
	   document.getElementById(div).style.display = 'block';
	   } 	   
    }
	
function mostrar(tabla, div, enl)
    {
        document.getElementById(tabla+'div1').style.display = 'none'; /* y repetis esto por cada div, o lo haces automatico */
        document.getElementById(tabla+'div2').style.display = 'none'; /* y repetis esto por cada div, o lo haces automatico */
        document.getElementById(tabla+'div3').style.display = 'none'; /* y repetis esto por cada div, o lo haces automatico */		

        document.getElementById(tabla+'enl1').className = ''; /* y repetis esto por cada div, o lo haces automatico */
        document.getElementById(tabla+'enl2').className = ''; /* y repetis esto por cada div, o lo haces automatico */
        document.getElementById(tabla+'enl3').className = ''; /* y repetis esto por cada div, o lo haces automatico */		

        document.getElementById(tabla+'enl'+enl).className = 'current'; /* y repetis esto por cada div, o lo haces automatico */		
        document.getElementById(div).style.display = 'block'; /* mostras el que queres mostrar */
    }


function nuevoAjax()
{ 
	/* Crea el objeto AJAX. Esta funcion es generica para cualquier utilidad de este tipo, por
	lo que se puede copiar tal como esta aqui */
	var xmlhttp=false; 
	try 
	{ 
		// Creacion del objeto AJAX para navegadores no IE
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
	}
	catch(e)
	{ 
		try
		{ 
			// Creacion del objet AJAX para IE 
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
		} 
		catch(E) { xmlhttp=false; }
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp=new XMLHttpRequest(); } 

	return xmlhttp; 
}

function carga(div, archivo)
{
	// Recibo el número correspondiente al combo que se debe llenar de datos
		ajax=nuevoAjax(); // Envio al servidor el valor seleccionado y el combo al cual se le deben poner los
		ajax.open("GET",archivo, true);
		ajax.onreadystatechange=function() 
		{ 
			if (ajax.readyState==1)
			{
			document.getElementById(div).innerHTML='';
/*			// Mientras carga elimino la opcion "Elige" y pongo una que dice "Cargando"
				elemento=document.getElementById("select_"+selectACargar);
				elemento.length=0;
				var opcionCargando=document.createElement("option"); opcionCargando.value=0; opcionCargando.innerHTML="Cargando...";
				elemento.appendChild(opcionCargando); elemento.disabled=true;	*/
			}
			if (ajax.readyState==4)
			{
				// Coloco en la fila contenedora los datos que recivo del servidor
				document.getElementById(div).innerHTML=ajax.responseText;
				//initLightbox();
			} 
		}
		ajax.send(null);
	
	

		
}

// idea & code by RGdesign.org - 2009

/* -------- */

$(document).ready(function(){
	$("a.zoom").fancybox();
	$("a.zoom1").fancybox({
		'overlayOpacity'	:	0.5,
		'overlayColor'		:	'#000'
	});
	$("a.zoom2").fancybox({
		'zoomSpeedIn'		:	500,
		'zoomSpeedOut'		:	500
	});						   
	$("a.group").fancybox({
		'hideOnContentClick': false,
		'overlayOpacity'	:	0.5,		
		frameHeight: 450,
		frameWidth: 1000		
		
	});			
	$("a.group2").fancybox({
		'hideOnContentClick': false,
		'overlayOpacity'	:	0.5,		
		frameHeight: 450,
		frameWidth: 1000

		
	});				
	$('body').pngFix( { blankgif:'images/blank.gif' } );
	
	// ----------------- //
	// ChangeImgOver
	jQuery.fn.ChangeImgOver = function(obj){
		return this.each(function() {			
			$(this).hover(
				function(){
					if(obj){
						element = $(obj);
						}else{
						element = $(this);
					}
					imgsrc = element.attr("src");
					matches = imgsrc.match(/_over/);
					if (!matches) {
						imgsrcON = imgsrc.replace(/.gif$/ig,"_hover.gif");
						
						element.attr("src", imgsrcON);
					}
				},
				function(){
					if(obj){
						element = $(obj);
						}else{
						element = $(this);
					}
					element.attr("src", imgsrc);
				}
			);
			if(obj){
				element = $(obj);
				}else{
				element = $(this);
			}
			rollsrc = element.attr("src");
			rollON = rollsrc.replace(/.gif$/ig,"_hover.gif");
			$("<img>").attr("src", rollON);
		});
	}
	$('.imgHover').ChangeImgOver();
	$('#creditosT').ChangeImgOver('#creditosI');
	$('#creditosI').hover(function(){
		$('#creditosT').addClass('over');
		},function(){
			$('#creditosT').removeClass('over');
		});
	// ----------------- //
	
	// ----------------- //
	// General forms focus/blur, etc
	$('input[type="text"], input[type="password"]').focus(function(){if(this.value==this.defaultValue){this.value='';}if(this.value!=this.defaultValue){this.select();}});
	$('input[type="text"], input[type="password"]').blur(function(){if($.trim(this.value)==''){this.value=(this.defaultValue?this.defaultValue:'');	}
	});
	$('#mascota').click(function(){
		$("input[type='text']:first", document.forms[1]).focus();
	});
	// ----------------- //
	
	// ----------------- //
	// fadeLink fn
	jQuery.fn.fadeLink = function(start,end,vel){
		return this.each(function() {			
			$(this).hover(
				function(){$(this).animate({"opacity":end}, vel);},
				function(){$(this).animate({"opacity":start}, vel);}
			);
			$(this).css({"opacity":start});
		});
	}
	// ----------------- //
	/* ejemplo de uso fadeLink(alpha inicial/rollout, alpha rollover, velocidad) */
	$('#header .bt_registrame').fadeLink(1,.8,100);
	
	$('.bigmore').hover(
		function(){
			$(this).css('background-position', '0 -34px');
		},
		function(){
			$(this).css('background-position', '0 0');
		});
});
/* -------- */
