// JavaScript Document
function Set_Cookie( name, value, expires, path, domain, secure ){
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );
	
	if ( expires )
	{
	expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
	( ( path ) ? ";path=" + path : "" ) +
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}	

function correo_a(cual) 
{
	while (cual.search("#")!=-1) {cual=cual.replace("#","");}
	cual=cual.replace("%","@");
	cual='<a hr'+'ef="mai'+'lto:'+cual+'">'+cual+'</a>';
	document.write(cual);
}

function flash(capa, pelicula, id, ancho, altura, version_player, color_fondo, n){

	var pelicula_flash = new Array();
	
	pelicula_flash[n]= new SWFObject(pelicula, id, ancho, altura, version_player, color_fondo, false);
	pelicula_flash[n].write(capa);
}
function mostrar(nombreCapa){
	document.getElementById(nombreCapa).style.visibility="visible";
	//document.getElementById('myGallery2').style.zIndex="1";
}

function ocultar(nombreCapa){
	document.getElementById(nombreCapa).style.visibility="hidden";
} 

function mostrar_capa(nombreCapa){
	if (document.getElementById(nombreCapa).style.display=="block"){
		document.getElementById(nombreCapa).style.display="none";
	}else{
		document.getElementById(nombreCapa).style.display="block";
	}
}

function borrar_texto(texto, capa, defecto){
	if(texto==defecto){
		document.getElementById(capa).value="";
	}
}

function poner_texto(texto, capa, defecto){
	if(texto==''){
		document.getElementById(capa).value=defecto;
	}
}

$(document).ready(function() {

	var cssObj = { 'box-shadow' : '-3px 5px 25px #455A6F', // Added when CSS3 is standard
		'-webkit-box-shadow' : '-3px 5px 25px #455A6F', // Safari
		'-moz-box-shadow' : '-3px 5px 25px #455A6F'}; // Firefox 3.5+
	$("#suggestions").css(cssObj);

	//Fade out the suggestions box when not active
	 $("input").blur(function(){
	 	$('#suggestions').fadeOut();
	});
	 
	//Quitar el autocompletar
	var i = 0;
	for(var node; node = document.getElementsByTagName('input')[i]; i++){
		var type = node.getAttribute('type').toLowerCase();
		if(type == 'text'){
			node.setAttribute('autocomplete', 'off');
		}
	}

});

function lookup(inputString) {

	if(inputString.length == 0) {
		$('#suggestions').fadeOut(); // Hide the suggestions box
	} else {
		$.post("includes/resultado-buscador.php", {queryString: ""+inputString+""}, function(data) { // Do an AJAX call
			$('#suggestions').fadeIn(); // Show the suggestions box
			$('#suggestions').html(data); // Fill the suggestions box
		});
	}

}


