function pop_window(url,width,height)
{ thewindow = window.open(url,'popped','width='+width+',height='+height+',toolbars=no,scrollbars=yes,copyhistory=yes,status=no'); }

function toggle(id)
{
	if (document.layers)
	{
		current = (document.layers[id].display == 'none') ? 'block' : 'none';
		document.layers[id].display = current;
	}
	else if (document.all)
	{
		current = (document.all[id].style.display == 'none') ? 'block' : 'none';
		document.all[id].style.display = current;
	}
	else if (document.getElementById)
	{
		vista = (document.getElementById(id).style.display == 'none') ? 'block' : 'none';
		document.getElementById(id).style.display = vista;
	}
}

var defaultvalue = "Please enter keywords"; 

function check_search()
{

	if(document.form_search.keywords.value == "" || document.form_search.keywords.value == defaultvalue)
	{ document.form_search.keywords.value = defaultvalue; }
	else
	{ location.href = "search.php?keywords=" + document.form_search.keywords.value; }

}

function check_keywords()
{

	if(document.form_search.keywords.value == defaultvalue)
	{ document.form_search.keywords.value = ""; }

}


var gotu_count = 0; 
function refresh_gotu()
{ 
document.getElementById('div_gotu').innerHTML = '<img src=\"gotu/generate.php?mode=refresh&count='+gotu_count+'\" width=\"200\" height=\"50\" border=\"0\" alt=\"\"><br>'; 
gotu_count++; 
}


var image_count = 0; 
var image_alpha = 0; 
var image_pause = 0; 
var direction = "up"; 
var init; 

function fader_pause()
{ image_pause = 1; }

function fader_resume()
{ image_pause = 0; }

function run_images()
{ init = setTimeout("load_image(); run_images()", 15); }

function load_image()
{
var object = document.getElementById(image_array[image_count]).style; 
object.display = "block"; 
object.opacity = (image_alpha / 100); 
object.MozOpacity = (image_alpha / 100); 
object.filter = "alpha(opacity=" + image_alpha + ")"; 

	if(image_alpha >= 100 && image_pause == 1)
	{ }
	else
	{

		if(direction == "down")
		{ 
		image_alpha = image_alpha - 2; 
		if(image_alpha < -10) { next_image(); }
		}
		else
		{ 
		image_alpha = image_alpha + 2; 
		if(image_alpha > 200) { prev_image(); }
		}

	}

}

function prev_image()
{
	if(image_array.length <= 1)
	{ clearTimeout(init); }
	else
	{ direction = "down"; }	
}

function next_image()
{

	var object = document.getElementById(image_array[image_count]).style; 
	object.display = "none"; 
	object.opacity = 0; 
	object.MozOpacity = 0; 
	object.filter = "alpha(opacity=0)"; 
	image_count = image_count + 1; 
	if(image_count == image_array.length) { image_count = 0; }
	direction = "up"; 

}

function initial()
{ run_images(); }