// JavaScript Document
// JavaScript popup window function
	function newWindow(url) {
popupWindow = window.open(url,'popUpWindow','left=100,top=100,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no, status=no')
	}
	function newWindowHiRes(url) {
popupWindow = window.open(url,'popUpWindow','left=20,top=20,height=820,width=950,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no, status=no');
	}
// Set Netscape up to run the "captureMousePosition" function whenever
// the mouse is moved. For Internet Explorer and Netscape 6, you can capture
// the movement a little easier.
    document.onmousemove = captureMousePosition;
// Global variables
xMousePos = 0; // Horizontal position of the mouse on the screen
yMousePos = 0; // Vertical position of the mouse on the screen
xMousePosMax = 0; // Width of the page
yMousePosMax = 0; // Height of the page
mousePosNew = 0;
mousePosNewY = 0;
displaceY = 150;
displace = 248;
addx = 300;
addy = 150;
main_div = document.getElementById('main');

function captureMousePosition(e) {
	if (navigator.appName == "Microsoft Internet Explorer") {
        // When the page scrolls in IE, the event's mouse position 
        // reflects the position from the top/left of the screen the 
        // user is looking at. scrollLeft/Top is the amount the user
        // has scrolled into the page. clientWidth/Height is the height/
        // width of the current page the user is looking at. So, to be
        // consistent with Netscape (above), add the scroll offsets to
        // both so we end up with an absolute value on the page, no 
        // matter if the user has scrolled or not.
        xMousePos = window.event.x+document.documentElement.scrollLeft;
        yMousePos = window.event.y+document.documentElement.scrollTop;
        xMousePosMax = document.body.clientWidth+document.documentElement.scrollLeft;
        yMousePosMax = document.body.clientHeight+document.documentElement.scrollTop;
		mousePosNew = xMousePos - displace;
		mousePosNewY = yMousePos - displaceY;
		mousePosNew1 = xMousePos + addx;
		mousePosNew1Y = yMousePos - addy;
    } else {
        // Netscape 6 behaves the same as Netscape 4 in this regard 
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
		mousePosNew = xMousePos - displace;
		mousePosNewY = yMousePos - displaceY;
		mousePosNew1 = xMousePos + addx;
		mousePosNew1Y = yMousePos - addy;
    }
}
function tab_right(tabname)
{
	tab = document.getElementById(tabname);
	setTimeout('tab_right1(tab)', 300);
}


function tab_right1(tab)
{
	tab.style.left = mousePosNew + 'px';
	tab.style.top = mousePosNewY + 'px';
	new Effect.Opacity(tab,
		{duration:.3, from:0, to:1});
}

function tab_left(tabname1)
{
tab1 = document.getElementById(tabname1);
new Effect.Opacity(tab1,
	{duration:.3, from:1, to:0});
	setTimeout('slide_left(tab1)', 300);
}
function slide_left(tab1)
{
	tab1.style.left = '-300px';
}

function screen_down()
{
	screendown = document.getElementById('screen');
	screendown.style.opacity = 0;
}

function lights_down()
{
	downmain = document.getElementById('main');
	upscreen = document.getElementById('screen');
	new Effect.Opacity(downmain,
		{duration:5, from:1, to:.3});
	new Effect.Opacity(upscreen,
		{duration:5, from:0, to:.7});
}
function lights_up()
{
	downmain = document.getElementById('main');
	upscreen = document.getElementById('screen');
	new Effect.Opacity(downmain,
		{duration:3, from:.3, to:1});
	new Effect.Opacity(upscreen,
		{duration:3, from:.7, to:0});
}
function move_div(div_name)
{
	move_me = document.getElementById(div_name);
	move_me.style.top = mousePosNew1Y + 'px';
	new Effect.Move(move_me,
		{x:mousePosNew1, duration:1});
	new Effect.Opacity(move_me,
		{duration:1, from:.01, to:.99});
	lights_down();
}
function div_back(div_name)
{
	lights_up();
	hovertab = document.getElementById(div_name);
	new Effect.Move(hovertab,
		{x:0-2000,y:0,duration:1})
	setTimeout('div_back1(hovertab)', 1100);
}
function div_back1(hovertab)
{
	hovertab.style.left = '-600px';
	hovertab.style.top = '-300px';
	new Effect.Opacity(hovertab,
		{duration:.3, from:.99, to:.01});
}
function mousehand()
{
	document.body.style.cursor = 'hand';
}
function  mousedefault()
{
	document.body.style.cursor = 'default';
}

var curimg=0;
var i=0;
var timeout_cancel;
var timeout_cancel1;
var timeout_cancel2;
var timeout_cancel3;

function startup(){
	slideshow_div = document.getElementById("slide_container");
	new Effect.SlideDown (slideshow_div,
		{duration:2});
	timeout_cancel3=setTimeout('rotateimages()', 3000);
	downmain = document.getElementById('main');
	upscreen = document.getElementById('screen');
	new Effect.Opacity(downmain,
		{duration:5, from:1, to:.3});
	new Effect.Opacity(upscreen,
		{duration:5, from:0, to:.7});
}

function rotateimages(){
slideshow_img = document.getElementById("slideshow");
new Effect.Opacity (slideshow_img,
	{duration:.5, from:.99, to:.01});	
timeout_cancel2=setTimeout('rotateimages1()', 1000);
}

function rotateimages1(){
slideshow_img = document.getElementById("slideshow");
slideshow_prepare = document.getElementById("slideshow_prep");
slideshow_img.setAttribute("src", "slide_img/"+galleryarray[curimg]);
curimg1 = curimg + 1;
slideshow_prepare.setAttribute("src", "slide_img/"+galleryarray[curimg1]);
curimg=(curimg<galleryarray.length-1)? curimg+1 : 0;
timeout_cancel=setTimeout('opacity_up()', 100);
}

function opacity_up(){
slideshow_img = document.getElementById("slideshow");
new Effect.Opacity (slideshow_img,
	{duration:.5, from:.01, to:.99});
timeout_cancel1=setTimeout('rotateimages()', 5000);
}

function slide_up(){
	slideshow_div = document.getElementById("slide_container");
	new Effect.SlideUp (slideshow_div,
		{duration:2});
	clearTimeout(timeout_cancel);
	clearTimeout(timeout_cancel1);
	clearTimeout(timeout_cancel2);
	clearTimeout(timeout_cancel3);
	curimg=0;
	downmain = document.getElementById('main');
	upscreen = document.getElementById('screen');
	new Effect.Opacity(downmain,
		{duration:3, from:.3, to:1});
	new Effect.Opacity(upscreen,
		{duration:3, from:.7, to:0});
}

function slideup_quick(){
	slideshow_div = document.getElementById("slide_container");
	new Effect.SlideUp (slideshow_div,
		{duration:.01});
}