﻿/*
Copyright Decode Studios All Rights Reserved
2007
*/
//Stores the Clients Window Height/Width
var cHeight;
var cWidth;
//Stores the Height/Width of the image
var pHeight = 0;
var pWidth = 0;
//the scroll for the X
var scrollPos;
//Settings for the Controls
var loginBox;
//Settings for the BlackOut
var greySec;
var windowHeight;
var windowWidth;
//Function to get the Height/width of the window
function screenSize()
{
//setting the big variables

	if (self.innerHeight) {	// all except Explorer
		cWidth = self.innerWidth;
		cHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		cWidth = document.documentElement.clientWidth;
		cHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		cWidth = document.body.clientWidth;
		cHeight = document.body.clientHeight;
	}
	if (self.pageYOffset) {
		scrollPos = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		scrollPos = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		scrollPos = document.body.scrollTop;	
	}
}
function windowLoad(boxId,screenId,wWidth,wHeight)
{
    //Run the Variables Function
    screenSize();
    //Setting for the Box
    windowBox = document.getElementById(boxId);
    //Settings for the BlackOut
    greySec = document.getElementById(screenId);
    windowHeight = wHeight;
    windowWidth = wWidth;
    windowBox.style.height = (wHeight + "px");
    windowBox.style.width = (wWidth + "px");
    windowBox.style.position = "absolute";
    windowBox.style.margin = "auto";
    windowBox.style.display = "block";
    windowBox.style.zIndex = "999";
    showWindow();
}
function showWindow()
{
    //set width and height to whole page
    greySec.style.height = (cHeight + "px");
    greySec.style.width = (cWidth + "px");
     
    //Reposition The Real Image 
    windowBox.style.top = (((((cHeight/2)-(windowHeight/2))-20)+scrollPos) + "px");
    windowBox.style.left = (((cWidth/2)-(windowWidth/2)) + "px");
    //Show BlackOut
    if(greySec.style.display != "block")
    {
        greySec.style.display = "block";
        Element.setOpacity(greySec, 0.0 );
        new Effect.Opacity(greySec, {duration:0.5, from:0.0, to:.8});
        //Display the Conrols
        windowBox.style.display = "block";
        Element.setOpacity(windowBox, 0.0 );
        new Effect.Opacity(windowBox, {duration:0.5, from:0.2, to:1});
    }
}
//Function To Close the box
function closeWindow()
{
windowBox.style.display="none";
}
function closeScreen()
{
closeWindow();
greySec.style.display = "none";
}