/*********************************************************************************************
	GLOBALA VARIABLER
*********************************************************************************************/


/*********************************************************************************************
		Height, Width, Position, etc
*********************************************************************************************/
// Cross Browser DOM
// copyright Stephen Chapman, 4th Jan 2005
// you may copy this code but please keep the copyright notice as well
var aDOM = 0, ieDOM = 0, nsDOM = 0; var stdDOM = document.getElementById;
if (stdDOM) aDOM = 1; else {ieDOM = document.all; if (ieDOM) aDOM = 1; else {
var nsDOM = ((navigator.appName.indexOf('Netscape') != -1)
&& (parseInt(navigator.appVersion) ==4)); if (nsDOM) aDOM = 1;}}
function xDOM(objectId, wS) {
if (stdDOM) return wS ? document.getElementById(objectId).style:
document.getElementById(objectId);
if (ieDOM) return wS ? document.all[objectId].style: document.all[objectId];
if (nsDOM) return document.layers[objectId];
}    

// Object Functions
// copyright Stephen Chapman, 4th Jan 2005
//  you may copy these functions but please keep the copyright notice as well
function objWidth(objectID) {
	var obj = xDOM(objectID,0); 
	if(obj.offsetWidth) 
	return  obj.offsetWidth; 
	if (obj.clip) 
	return obj.clip.width; 
	return 0;
}        

function objHeight(objectID) {
	var obj = xDOM(objectID,0); 
	if(obj.offsetHeight) 
	return  obj.offsetHeight; 
	if (obj.clip) 
	return obj.clip.height; 
	return 0;
}

// Browser Window Size and Position
// copyright Stephen Chapman, 3rd Jan 2005, 8th Dec 2005
// you may copy these functions but please keep the copyright notice as well
function pageWidth() {
	return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ?       document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
} 
function pageHeight() {
	return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;
}

function posTop() {
	return typeof window.pageYOffset != 'undefined' ?  window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;
}

//Copyright end

function documentWidth(){
	var docWidth = (document.width !== undefined) ? document.width : document.body.offsetWidth;
	return docWidth;
}

function documentHeight(){
	var docHeight = (document.height !== undefined) ? document.height : document.body.offsetHeight;
	return docHeight;
}

function makeMiddleCenter(objectID){
	var myPageWidth = pageWidth();
	var myPageHeight = pageHeight();
	
	var currentStateDisplay = document.getElementById(objectID).style.display;
	document.getElementById(objectID).style.display = 'block';
	
	var objectWidth = objWidth(objectID);
	var objectHeight = objHeight(objectID);
	
	var positionLeft = (pageWidth()/2)-(objWidth(objectID)/2);
	
	var positionTop = (pageHeight()/2)-(objHeight(objectID)/2) + posTop();
	
	document.getElementById(objectID).style.position="absolute";
	document.getElementById(objectID).style.left = positionLeft + 'px';
	document.getElementById(objectID).style.top = positionTop + 'px';
	document.getElementById(objectID).style.zIndex = 2000;
	
	//document.getElementById(objectID).style.display = currentStateDisplay;
}

function black(){
	document.getElementById('blackBack').style.position = 'absolute';
	document.getElementById('blackBack').style.top = '0px';
	document.getElementById('blackBack').style.left = '0px';
	document.getElementById('blackBack').style.width = documentWidth() + 'px';
	document.getElementById('blackBack').style.height = documentHeight() + 'px';
	document.getElementById('blackBack').style.display = 'block';
}

function openGreenbox(divID){
	black();
	makeMiddleCenter(divID);
}

function closeGreenbox(divID){
	hideFromID('blackBack');
	hideFromID(divID);
}

function openLostPassword(alreadyOpenDiv){
	hideFromID(alreadyOpenDiv);
	openGreenbox('lostPassword');
}

function openBecomeMember(alreadyOpenDiv){
	hideFromID(alreadyOpenDiv);
	openGreenbox('becomeMember');
}

function hideFromID(id){
		document.getElementById(id).style.display = 'none';
}

function showFromID(id){
		document.getElementById(id).style.display = 'block';
}

function toggleFromID(id){
	if(document.getElementById(id).style.display == 'none'){
		document.getElementById(id).style.display = 'block';
	} else {
		document.getElementById(id).style.display = 'none';
	}
	
}