// JavaScript Document

//window.onload = setTimeout("load_boxes();", 500);
//window.onresize = setTimeout("set_size();", 500);

var start_top = 885;

function load_boxes ()
{
	set_size();
	load_div ("pop_up");
}

var WindowHeight, WindowWidth;
function set_size ()
{
	if (parseInt(navigator.appVersion)>3) 
	{
 		if (navigator.appName=="Netscape") 
		{
  			WindowWidth = window.innerWidth;
  			WindowHeight = window.innerHeight;
 		}
 		
		if (navigator.appName.indexOf("Microsoft")!=-1) 
		{
  			WindowWidth = document.body.offsetWidth;
  			WindowHeight = document.body.offsetHeight;
 		}
	}
}

function load_div ( id )
{
	var obj = document.getElementById(id);
	var width, height;
	width 	= (obj.style.width).replace("px", "");
	height 	= (obj.style.height).replace("px", "");
	
	obj.style.display = "";
	fade_div (id, 0, 0, 0);
	//obj.style.left 	= ((WindowWidth/2) - (width /2)) - 20 + "px"; // center it

	/*if (height == "")
		obj.style.top = "100px";
	else
		obj.style.top 	= ((WindowHeight / 2) - (height/2) - 70) + "px";*/
		
	
		
	open_box('pop_up');
}

function move_div (id, start, end, speed)
{
	document.getElementById(id).style.top = start + "px";
	
	if (start < end)
		setTimeout("move_div('" + id + "', " + eval(start+2) + ", " + end + ", " + speed + ");", speed);
	else
		return;
}

function fade_div (id, start, end, speed)
{
	set_transparency(id, start);
	
	if (start < end)
	{
		if (end < (start+=.25))
			set_transparency(id, end);
		else
			setTimeout("fade_div('" + id + "', " + eval(start) + ", " + end + ", " + speed + ");", speed);
	}
	
	if (end < start)
	{
		if (end > (start-=.25))
			set_transparency(id, end);
		else
			setTimeout("fade_div('" + id + "', " + eval(start) + ", " + end + ", " + speed + ");", speed);
	}
}

function set_transparency (id, level)
{
	if (navigator.appName == "Microsoft Internet Explorer")
		document.getElementById(id).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + eval(level*100) + ");"
	else
		document.getElementById(id).style.opacity = level;
		
	if (level == 0)
		document.getElementById(id).style.display = "none";
	else
		document.getElementById(id).style.display = "";
}

function run_png_fix ()
{
	/*var ary_png_ids = new Array("pop_up");
	
	for (i = 0; i < ary_png_ids.length; i++)
		png_fix(ary_png_ids[i]);*/
}

function open_box (id)
{
	
	
	//move_div (id, start_top, start_top+20, 10);
	fade_div (id, 0, .95, 1);
	
	//fade_div ("content", .3, .3, 0);
}

function close_box (id)
{
	var start = parseInt(get_top(id));

	//move_div (id, start_top+20, start_top+40, 10);
	fade_div (id, .95, 0, 1);
	
	//fade_div ("content", 1, 1, 200);
}

function get_top (id)
{
	var top = document.getElementById(id).style.top;
	
	return top.replace("px", "");
}
