﻿function callLogin(callingURL, LoginPos) { /*Function to Log In frame.   This is called from the include LoginFrame.inc.php    */
	DHTMLWinVar=dhtmlwindow.open('DHTMLFrame', 'iframe', '../Forms/LogInForm.php', "Login to O'Heller.net", 
	'width=550px,height=275px,resize=0,scrolling=0,left=140,top='+LoginPos);
	DHTMLWinVar.onclose=function() { // FUNCTION [DHTML Window onclose by user]
		parent.overlay.style.display='none';  //remove the overlay
		location.href = callingURL ; //return to calling page
		window.location.reload(); 
		return false; 
	} // ENDFUNCTION [DHTML Window onclose by user] (Reload calling page)
}

function callPlainReg() {
	DHTMLWinVar=dhtmlwindow.open('DHTMLFrame', 'iframe', '../Forms/RegForm.php', "O'Heller.net Registration", 
	'width=650px,height=420px,resize=0,scrolling=0,left=120,top=360');
	DHTMLWinVar.onclose=function() {  // FUNCTION [DHTML Window onclose by user]
		window.location.reload();
		return true; 
	} // ENDFUNCTION [DHTML Window onclose by user]
	return false;
}

// Displays overlay (Z-Index=50) disabling access to semi-visible page content below
// overlayColor is optional.  Defaults to ohellerOrange if not supplied.
function ShowOverlay(overlayColor) {
	var body = document.getElementsByTagName ('BODY')[0];
//	var pageScroll = getPageScroll();  //[1]=null, [2]=yScroll
	var pageSize = getPageSize();  //[0]=pageWidth, [1]=pageHeight, [2]=windowWidth, [3]=windowHeight
	overlayColor = overlayColor ? overlayColor : '#FE4E0B';
//default 'Overlay' div is created on the fly using css in ohellerstyles; others must be supplied
	overlay = document.getElementById('Overlay');  
	if(!overlay) {
		overlay = document.createElement('div');
		overlay.setAttribute('id','Overlay');
		overlay.style.display = 'none';
		overlay.style.backgroundColor = overlayColor;
		body.appendChild(overlay);
	}
	overlay.style.width=pageSize[0]+'px';  
	coords = findPos('bd');  
	overlay.style.height=pageSize[1]-coords[1]+'px'; //Size overlay to cover Process Steps to bottom of page
	placeObj('Overlay', 0, coords[1]);  //Place Overlay
	overlay.style.display='block';    //Display Overlay
	overlay.visibility='visible';    //Display Overlay
//	showByID('Overlay');  //didn't seem to work??
}  //ENDFUNCTION

function CheckLogin() {
	return ( getCookieValue('UID') == -1 ) ? false : getCookieValue('UID');  
}  

function ShowMessageBox() {
	if ( getCookieValue('UID') == -1 ) {  // IF [Logged In = NO]
	// Not logged in, show the overlay
//		ShowOverlay();  //Show the overlay
		showByID('MessageBox');  //show the MessageBox with user options to pick from
		var body = document.getElementsByTagName ('BODY')[0];
	//	var pageScroll = getPageScroll();  //[1]=null, [2]=yScroll
		var pageSize = getPageSize();  //[0]=pageWidth, [1]=pageHeight, [2]=windowWidth, [3]=windowHeight			
		jQuery.isReady = true;
		$(document).ready(function() {
			$('#MessageBox').slideUp(.01);  //takes it away super fast
			$('#MessageBox').slideDown(1350);  //brings it back slowly
		});  // ENDFUNCTION [ready]
		return false;  //stop key entry on OTweets [MAY NOT BE APPLICABLE TO OTHER APPLICATIONS]
	} //ENDIF [Logged In]
}  //ENDFUNCTION
