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;
	}
}


// scroller fader functions
var paused = 0; 
var image_count = 0; 
var image_alpha = 0; 
var direction = "up"; 
var prev_id = 0; 
var resume_id = 0; 

function switch_sector(id)
{
paused = 1; 
resume_id = id; 
image_alpha = 100; 

var object = document.getElementById('sector_img_'+image_count).style;
object.opacity = (0 / 100);
object.MozOpacity = (0 / 100);
object.filter = "alpha(opacity=" + 0 + ")"; 
document.getElementById("sector_"+image_count).style.backgroundImage = 'url(images/trans.gif)'; 
document.getElementById("sector_link_"+image_count).style.color = '#9C8679'; 

var object = document.getElementById('sector_img_'+id).style;
object.opacity = (image_alpha / 100);
object.MozOpacity = (image_alpha / 100);
object.filter = "alpha(opacity=" + image_alpha + ")"; 
document.getElementById("sector_"+id).style.backgroundImage = 'url(images/grad_red_mid.gif)'; 
document.getElementById("sector_link_"+id).style.color = '#FFFFFF'; 
}

function resume()
{ 
paused = 0; 
image_count = resume_id; 
direction = "down"; 

//var object = document.getElementById('sector_img_'+resume_id).style;
//object.opacity = (0 / 100);
//object.MozOpacity = (0 / 100);
//object.filter = "alpha(opacity=" + 0 + ")"; 
//document.getElementById("sector_"+resume_id).style.backgroundImage = 'url(images/trans.gif)'; 
//document.getElementById("sector_link_"+resume_id).style.color = '#9C8679'; 

document.getElementById("sector_"+image_count).style.backgroundImage = 'url(images/grad_red_mid.gif)'; 
document.getElementById("sector_link_"+image_count).style.color = '#FFFFFF'; 
}

function goto_sector()
{ location.href = array_urls[image_count]; }

function run_images()
{ init = setTimeout("load_image(); run_images()", 5); }

function load_image()
{

	if(paused != 1)
	{

		if(image_count != prev_id)
		{
		document.getElementById("sector_"+prev_id).style.backgroundImage = 'url(images/trans.gif)'; 
		document.getElementById("sector_link_"+prev_id).style.color = '#9C8679'; 
		prev_id = image_count; 
		}

		document.getElementById("sector_"+image_count).style.backgroundImage = 'url(images/grad_red_mid.gif)'; 
		document.getElementById("sector_link_"+image_count).style.color = '#FFFFFF'; 
		var object = document.getElementById('sector_img_'+image_count).style;
		object.opacity = (image_alpha / 100);
		object.MozOpacity = (image_alpha / 100);
		object.filter = "alpha(opacity=" + image_alpha + ")"; 

		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(paused != 1)
	{

		if(array_urls.length <= 1)
		{ clearTimeout(init); }
		else
		{ direction = "down"; }	

	}

}

function next_image()
{ 

	if(paused != 1)
	{
	var object = document.getElementById('sector_img_'+image_count).style;
	object.opacity = 0;
	object.MozOpacity = 0;
	object.filter = "alpha(opacity=0)"; 
	image_count = image_count + 1; 
	if(image_count == array_urls.length) { image_count = 0; }
	direction = "up"; 
	}

}
