// functions for security pages
var theField = new Array();
var theSpans = new Array();
/* Added by Scott 4-18-08 For Help Pages */
var mainUrl = 'http://design.ahika.com';
/* Relocated by Scott 4-18-08 */
function dEI(obj){
	var theObj = document.getElementById(obj);
	return theObj;
}
//
/////////////////////////////////////////
//GLOBALS
////////////////////////////////////////
// DIM PAGE OPACITY //
//
var ieopacity = "alpha(opacity = 50)";
var standardsopacity = "0.5";
//

var xmlhttp = false;
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e){
	try{
	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} catch(e){
		xmlhttp = false;
	}
}
if(!xmlhttp && typeof XMLHttpRequest != 'undefined'){
	xmlhttp = new XMLHttpRequest();
}


function getPageScroll(){
var xScroll, yScroll;
if (self.pageYOffset) {
yScroll = self.pageYOffset;
xScroll = self.pageXOffset;
} else if (document.documentElement && document.documentElement.scrollTop){ // Explorer 6 Strict
yScroll = document.documentElement.scrollTop;
xScroll = document.documentElement.scrollLeft;
} else if (document.body) {// all other Explorers
yScroll = document.body.scrollTop;
xScroll = document.body.scrollLeft;
}
arrayPageScroll = new Array(xScroll,yScroll)
return arrayPageScroll;
}
function getPageSize(){
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
xScroll = window.innerWidth + window.scrollMaxX;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
if (self.innerHeight) { // all except Explorer
if(document.documentElement.clientWidth){
windowWidth = document.documentElement.clientWidth;
} else {
windowWidth = self.innerWidth;
}
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
if(yScroll < windowHeight){
pageHeight = windowHeight;
} else {
pageHeight = yScroll;
}
if(xScroll < windowWidth){
pageWidth = xScroll;
} else {
pageWidth = windowWidth;
}
arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;
}


function showErr(id){
	var theId = id;
	var theObj = document.getElementById(id);
	var theErr = document.getElementById("formErr");
	theField = Array("username","password","email","useoemail");
	theSpans = Array("userfield","passfield","emailfield","useroremail");
	var theVal;
	for(var i = 0; i < theField.length; i++){
		if(theField[i] == theId){
			theVal = i;
		}
	}
	var theErrR = document.getElementById(theSpans[theVal]);
		if(theObj.value.length <= 0){
			theErr.className = "show";
			if(theErrR.className == "norm"){
				theErrR.className = "errspan";
			}
		
		} else {
			if(theObj.value.length >= 1){
				theErrR.className = "norm";
				for(var h = 0; h < theSpans.length; h++){
					if(document.getElementById(theSpans[h])){
						if(document.getElementById(theSpans[h]).className == "norm"){
							theErr.className = "hide";
						}
					}
				}
			} else {
				theErr.className = "hide";	
			}
		}
}
function checkInput(obj){
// get object
var theNum = "";
var theObj = obj;
// get length of input value
theNum = document.getElementById(obj).value.length;
var theObject = document.getElementById(obj);
var theTBox = document.getElementById(obj).value;
var theEcho = document.getElementById('numChars');

	if(theNum > 255){
		// if numChars >= 255 - stop keyboard input
		theTBox = theTBox.substr(0,255);
		theObject.value = theTBox;
		theEcho.innerHTML = theNum - 1;
	} else {
		// return input value to numChars span
		theEcho.innerHTML = theNum;
	}

}

function goAlert(obj){
var theObj = document.getElementById(obj);
var theWriteDiv = document.getElementById("otherInput");
	if(obj == 'other'){
		var theInput = "<textarea type=\"text\" name=\"otherCustom\" class=\"sInputCTA\" id=\"otherCustom\"></textarea>";
		theWriteDiv.innerHTML = theInput;
	} else {
		theWriteDiv.innerHTML = "&nbsp;";
	}
}

function checkField(obj,errloc,rowNum){
	//obj stands for the id of the input or select field
	// errloc stands for the id of the error field
	//rowNum stands for the row number of the span, this is used to change the error class if err
	var theObj = document.getElementById(obj);
	var theOutputLoc = document.getElementById(errloc);
	var theRow = document.getElementById(rowNum);
	//var theErrR = document.getElementById("formErr");
	if(theObj.value.length == 0){
		// if the error field is hidden
		if(theOutputLoc.style.display != "block"){
			theOutputLoc.style.display = "block";
		}
		theOutputLoc.innerHTML = "You must add a value to the field";
		theRow.className = "errspan";
		//theErrR.className = "show";
	} else {
		if(theOutputLoc.style.display == "block"){
			theOutputLoc.style.display = "none";
			theOutputLoc.innerHTML = "&nbsp;";
		}
		theOutputLoc.innerHTML = "";
		theOutputLoc.style.display = "none";
		theRow.className = "norm";
		//theErrR.className = "hide";
	}
}

function triggerPB(obj){
// trigger page build
var theObj = obj;
var theCancelField = document.getElementById('bottomArea');
var theRow1 = document.getElementById("row3");
var theRow2 = document.getElementById("row4");
var thePBtn = document.getElementById("pBtns");
if(theObj == "Cancel Account"){
theCancelField.className = "show";
theRow1.style.display = "none";
theRow2.style.display = "none";
thePBtn.style.display = "none";
// alert that the user selected to cancel account
// show the cancel account case, hide row3, row4
} else {
theCancelField.className = "hide";
theRow1.style.display = "block";
theRow2.style.display = "block";
thePBtn.style.display = "block";
// the user isn't canceling account, or has changed mind
// if the cancel account case is visible, hide, if row3 and row4 are hidden, show
}
}

function triggerPB2(obj){
// trigger page build
var theObj = obj;
var theCancelField = document.getElementById('bottomArea');
var theRow1 = document.getElementById("row3");
var theRow2 = document.getElementById("row4");
var thePBtn = document.getElementById("pBtns");
var theExtraInput = document.getElementById("enterasubject2");
var thenewfield = "<input name=\"enterasubject\" id=\"enterasubject\" value=\"\" class=\"sInput\" />";
	if(theObj == "Cancel Account"){
		theCancelField.className = "show";
		//theRow1.style.display = "none";
		theRow2.style.display = "none";
		thePBtn.style.display = "none";
		theExtraInput.className = "hide";
		theExtraInput.innerHTML = "";
	} 
	else if(theObj == "Enter a Subject"){
		if(theCancelField.className == "show"){
    		theCancelField.className == "hide";
  		}
  		if(theExtraInput.className = "hide"){
  			theExtraInput.innerHTML = thenewfield;
			theExtraInput.className = "show";
		}
		if(theRow2.style.display = "none"){
			theRow2.style.display = "block";
			thePBtn.style.display = "block";
		}
		if(theCancelField.className = "show"){
			theCancelField.className = "hide";
		}
	} else {
		theCancelField.className = "hide";
		//theRow1.style.display = "block";
		theRow2.style.display = "block";
		thePBtn.style.display = "block";
		theExtraInput.className = "hide";
		theExtraInput.innerHTML = "";
	}
}

function doCust(value, id){
	// look up the value of the selection, find the id of the select menu
	var theObj = value;
	var theSel = id;
	var theSelLookUp = new Array("secQuest1", "secQuest2", "secQuest3");
	var theSelCustRow = new Array("secQuestCust1","secQuestCust2","secQuestCust3");
	// use the parallel arrays to find the custom row to write the new html to by using theSel in theSelLookUp and 
	// matching it to theSelCustRow, by writing the position to a local variable
	var theVal = 0;
	if(theObj == "enterOwn"){ // got correct value to implement trigger
		for(var n = 0; n < theSelLookUp.length; n++){
			if(theSel == theSelLookUp[n]){
				theVal = n;
			}
		}
		var tmp = document.getElementById(theSelCustRow[theVal]);
		var theNum = theVal + 1;
		//var theInner = "<input type=\"text\" class=\"sInput\" name=\"theSelCust"+theNum+"\" id=\"theSelCust"+theNum+"\"/>";
		//tmp.innerHTML = theInner;
		var theNew = document.createElement('input');
		theNew.type = "text";
		theNew.className = "sInput";
		theNew.name = "theSelCust"+theNum;
		theNew.id = "theSelCust"+theNum;
		theNew.value = "";
		tmp.appendChild(theNew);
		tmp.className = "show";
	} else {
		if(theObj != "Enter your own security question"){
			for(var n = 0; n < theSelLookUp.length; n++){
				if(theSel == theSelLookUp[n]){
					theVal = n;
				}
			}
			var theRowN = document.getElementById(theSelCustRow[theVal]);
			if(theRowN.className == "show"){
				theRowN.className = "hide";
				theRowN.innerHTML = "";
			}
		}
	}
}

// if the password field is greater than one in length, open up security options
function openSecOptions(){
	var theDisabled = new Array('secQuest1','secQuest2','secQuest3','answer1','answer2','answer3');
	var theAssocRow = new Array('row2','row3','row4','row5','row6','row7');
		for(var k = 0; k < theDisabled.length; k++){
			var tmp = document.getElementById(theDisabled[k]);
			var tmpR = document.getElementById(theAssocRow[k]);
			if(tmp.getAttribute("disabled")){
				// has disabled attribute
				tmp.removeAttribute("disabled");
				tmpR.className = "norm";
			} else {
				// doesn't have disabled attribute
			}
		}
}

//
// Function Added By Scott
// Purpose: To take a text field and redraw it as a password field
function changeState(outside,obj){
var theObj = document.getElementById(obj);
var theVal = theObj.value;
var thePlace = document.getElementById(outside);
if(theVal.length >= 1){
if(theObj.getAttribute('type') == 'text'){
thePlace.innerHTML = '<input type="password" class="sInput" name="pass1" id="pass1" value="'+theVal+'"/>';
} else {
thePlace.innerHTML = '<input type="text" class="sInput" name="pass1" id="pass1" value="'+theVal+'"/>';
}
}
}

// Sending variables to and from a form with AJAX
// Written by Scott Haines
function getxmlhttp(){
var xmlhttp;
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e){
	try{
	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} catch(e){
		xmlhttp = false;
	}
}
if(!xmlhttp && typeof XMLHttpRequest != 'undefined'){
	xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}
function runajax(objID, serverPage, value)
{
	document.getElementById(objID).innerHTML = "checking";
	document.getElementById(objID).style.display = "block";
	var xmlhttp = getxmlhttp();
	var params = "pass="+value;
	xmlhttp.open("POST", serverPage);
	xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlhttp.setRequestHeader("Content-length", params.length);
	xmlhttp.setRequestHeader("Connection", "close");
	xmlhttp.onreadystatechange = function(){
		if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
			
			if(xmlhttp.responseText == "true"){
				document.getElementById(objID).style.display = "block";
				document.getElementById(objID).innerHTML = "<span class='avail'>available</span>";
				openSecOptions('password');
			} else {
				document.getElementById(objID).innerHTML = xmlhttp.responseText;
			}
		}
	}
	xmlhttp.send(params);
}

function updateStatus(){
	document.getElementById('passwordErr').innerHTML = "";
	document.getElementById('middiv').innerHTML = "<b>Checking Password</b>";
}

// functionsendmail.js

function sendmail(theframe,themessage){
	var location = "https://atlas.ahika.com/~scott/main/js/response.php?themessage=" + themessage;
	theframe.runajax("passwordErr",location);
}

function openOptions(theframe){
	openSecOptions("password");
	alert("firing function");
}

function getErr(theframe, theerr){
	var location = "err.php?theerr=" + theerr;
	theframe.processajax("err", location);
}

function sendThis(obj){
	//Submit the form
	var theVal = document.getElementById(obj).value;
	runajax('passwordErr', 'https://atlas.ahika.com/~scott/main/js/process_email.php',theVal);
}

//
// New Added By Scott 3-12-08

function displayVals(){
	disModDim();

}

function disModDim(){
	var pageSize = getPageSize();
	var pageScroll = getPageScroll();
if(document.getElementById("dim")){
	if(dEI("blockieselect")){
		launchBlock();
	}
		if(dEI("dim").style.display = "none"){
			dEI("dim").style.display = "block";	
			var theW = pageSize[2] + pageScroll[0];
			var theH = pageSize[3] + pageScroll[1];
			dEI("dim").style.width = theW + "px";
			dEI("dim").style.height = theH + "px";
			dEI("dim").style.top = "0px";
			dEI("dim").style.left = "0px";
		}
} else {
	var theNodeB = document.getElementsByTagName("body");
	var bodyNode = theNodeB[0];
	var theDim = document.createElement('div');
		theDim.id = "dim";
		theDim.style.background = "#000000";
		var theW = pageSize[0] + pageScroll[0];
		var theH = pageSize[1] + pageScroll[1];
		if(window.ActiveXObject){
		theDim.style.width = theW + "px";
		theDim.style.height = theH + "px";
		theDim.style.top = "0px";
		theDim.style.left = "0px";
		theDim.style.position = "absolute";
		} else{
		/*theDim.style.height = "100%";
		theDim.style.width = "100%";
		theDim.style.top = "0px";
		theDim.style.left = "0px";
		theDim.style.position = "fixed";
		*/
		theDim.style.width = theW + "px";
		theDim.style.height = theH + "px";
		theDim.style.top = "0px";
		theDim.style.left = "0px";
		theDim.style.position = "absolute";
		}
		// opacity values updated via globals
		theDim.style.filter = ieopacity;
		theDim.style.opacity = standardsopacity;
		theDim.style.zindex = "100";
		bodyNode.appendChild(theDim);
		/*theDim.onclick = function(){
			clear();
		}
		*/
		if(dEI("blockieselect")){
			launchBlock();
		}
			   
			  
		bodyAdd.push("dim");
}
}

function launchBlock(){
var pageSize = getPageSize();
var pageScroll = getPageScroll();
var blockie6sel = document.getElementById("blockieselect");
blockie6sel.style.visibility = "visible";
blockie6sel.style.height = (pageSize[1] + pageScroll[1]) + "px";
blockie6sel.style.width = (pageSize[0] + pageScroll[0]) + "px";
blockie6sel.style.top = "0";
blockie6sel.style.left = "0";
blockie6sel.style.position = "absolute";	
}

function killBlock(){
	var blockie6sel = document.getElementById("blockieselect");
	blockie6sel.style.visibility = "hidden";
	blockie6sel.style.height = "0";
	blockie6sel.style.width = "0";
	blockie6sel.style.top = "0";
	blockie6sel.style.left = "0";
	blockie6sel.style.position = "absolute";	
}

function createNode(name){
	var newElem = document.createElement('p');
	newElem.name = name;
	newElem.id = name;
	newElem.innerHTML = "Hello<br>I should fire a change<br>";
	dEI("body").appendChild(newElem);
}


// find width and height of new popup window after it has been called
function getWidth(obj){
var clientWidth = document.getElementById(obj).offsetWidth;
return clientWidth;
}

function getHeight(obj){
var element = document.getElementById(obj);
if(!element) return 0;
return element.offsetTop + getHeight(element.offsetParent);
}

// for DHTML --- any popups ---
function popDhtml(obj, size){
var size2 = size + "px";
if(dEI(obj)){
// do popup with current popup	
mergePopDim(obj);
if(dEI("formFrame")){
	dEI("formFrame").style.width = size2;	
}
} else {
var thePop = document.createElement('div');
thePop.id = obj;
thePop.name = obj;
thePop.style.display = "none";
thePop.style.width = size2;
thePop.style.height = (size / 2) + "px";
var theBody = document.getElementsByTagName("body");
theBody[0].appendChild(thePop);
mergePopDim(obj);
}
}
var size2 = 0;
var size3 = 0;
// for ajax calls
function popAjax(obj,page,size){
	size2 = size + "px";
	size3 = (size / 2) + "px";
	if(dEI(obj)){
		if(dEI(obj).style.width != size){
			dEI(obj).style.width = size + "px";
			dEI(obj).style.height = size3;
		}
		// do popup with current popup	
		mergePopDim(obj);
	} else {
		var thePop = document.createElement('div');
		thePop.id = obj;
		thePop.name = obj;
		thePop.style.display = "none";
		thePop.style.width = size +"px";
		thePop.style.height = (size / 2) + "px";
		var theBody = document.getElementsByTagName("body");
		theBody[0].appendChild(thePop);
	}
	//
	var xmlhttp = getxmlhttp();
	xmlhttp.open("GET", page);
	xmlhttp.onreadystatechange = function(){
		if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
			dEI(obj).innerHTML = xmlhttp.responseText;
			mergePopDim(obj);
		}
	}
	xmlhttp.send(null);
}
// for iframe pop
var widthX = 0;
var heightY = 0;
//
function popIFrame(obj,frame,page,sizeW,sizeH){
	// if iframe is gone?
	// this is only if pop4 has been called from a pop3 instance
	if(!dEI(frame)){
		// formFrame has been deleted, must rebuild
		var theparent = dEI(obj);
		var theFrame = document.createElement('iframe');
		theFrame.name = frame;
		theFrame.id = frame;
		theFrame.frameBorder = 0;
		theFrame.src = page;
		theFrame.style.display = "none";
		theparent.appendChild(theFrame);
		// now we have it back
	}
	widthX = sizeW;
	heightY = sizeH;
	var width2 = sizeW + "px";
	var height2 = sizeH + "px";
	if(dEI(obj)){
		if(dEI(obj).style.width != width2){
			dEI(obj).style.width = sizeW + "px";
			dEI(obj).style.height = (sizeW / 2) + "px";
		}
		//
		dEI(frame).style.width = width2;
		dEI(frame).style.height = height2;
		dEI(frame).style.top = "0px";
		dEI(frame).style.left = "0px";
		dEI(frame).src = page;
		//
		bodyAdd.push(obj);
		mergePopDimIF(obj, sizeW, sizeH);
	} else {
		var thePop = document.createElement('div');
		thePop.id = obj;
		thePop.name = obj;
		thePop.style.display = "none";
		thePop.style.width = width2;
		thePop.style.height = height2;
		thePop.style.zindex = "999";
		//
		var theBody = document.getElementsByTagName("body");
		theBody[0].appendChild(thePop);
		dEI(frame).style.width = width2;
		dEI(frame).style.height = height2;
		dEI(frame).style.top = "0px";
		dEI(frame).style.left = "0px";
		mergePopDimIF(obj);
		bodyAdd.push(obj);
	}
}
// pop4 for AJAX page call to AJAX page call
// if you have a dim page open and want to call another
// page to replace the page already popped up on the stage
function popToPop(obj,page,size){
	var size2 = size + "px";
	var size3 = (size / 2) + "px";
	if(dEI(obj)){
		dEI(obj).innerHTML = "";
		if(dEI(obj).style.width != size){
			dEI(obj).style.width = size + "px";
			dEI(obj).style.height = size3;
		}
	}
	//
	var xmlhttp = getxmlhttp();
	xmlhttp.open("GET", page);
	xmlhttp.onreadystatechange = function(){
		if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
			dEI(obj).innerHTML = xmlhttp.responseText;
			mergePopDim(obj);
		}
	}
	xmlhttp.send(null);
}


function mergePopDim(value){
	displayVals();
	findLocWin(value);
}
// if the page is an iframe
function mergePopDimIF(value){
	displayVals();
	findLocWinIF(value);
}

var bodyAdd = new Array();
//
function findLocWin(obj){
	followObj(obj);
	var pageSize = getPageSize();
	var pageScroll = getPageScroll();
	var theObj = dEI(obj);
	var theWidth = theObj.style.width;
	if(theWidth.substr(0,3) == 'p'){
	var theNumber = theWidth.substr(0,4);
	} else {
		var theNumber = theWidth.substr(0,3);
	}
	if(pageSize[0] > pageSize[2]){
		var pageSizeX = (pageSize[0] + pageScroll[0]);
	} else{
	var pageSizeX = (pageSize[2] + pageScroll[0]);
	}
	if(pageSize[1] > pageSize[3]){
		var pageSizeY = (pageSize[3] + pageScroll[1]);
	} else {
	var pageSizeY = (pageSize[1] + pageScroll[1]);
	}
	var halfPSX = Math.ceil(pageSizeX / 2);
	var halfPSY = Math.ceil(pageSizeY / 2);
	var theHeight = dEI(obj).style.height;
	if(theHeight.substr(0,3) == 'p'){
	var theHeight = theHeight.substr(0,4);
	} else {
		var theHeight = theHeight.substr(0,3);
	}
	var theY = theHeight;
	var theXPos = halfPSX - (theNumber / 2);
	if(!window.ActiveXObject){
	var theYPos = halfPSY - (theHeight * .72);
	} else {
	var theYPos = halfPSY - (theHeight * .82);	
	}
	if(theYPos <= 1){
		theYPos = 20;	
	}
	theObj.style.top = theYPos + "px";
	theObj.style.left = theXPos + "px";
    theObj.style.position = "absolute";
	theObj.style.zindex = "999";
	bodyAdd.push(obj);
	if(theObj.style.display = "none"){
		theObj.style.display = "block";
	}
}
// In the case of an iframe
function findLocWinIF(obj){
	followObjIF(obj);
	var pageSize = getPageSize();
	var pageScroll = getPageScroll();
	var theObj = dEI(obj);
	var theWidth = widthX;
	if(theWidth.substr(0,3) == 'p'){
	var theNumber = theWidth.substr(0,4);
	} else {
		var theNumber = theWidth.substr(0,3);
	}
	if(pageSize[0] > pageSize[2]){
		var pageSizeX = (pageSize[0] + pageScroll[0]);
	} else{
	var pageSizeX = (pageSize[2] + pageScroll[0]);
	}
	if(pageSize[1] > pageSize[3]){
		var pageSizeY = (pageSize[3] + pageScroll[1]);
	} else {
	var pageSizeY = (pageSize[1] + pageScroll[1]);
	}
	var halfPSX = Math.ceil(pageSizeX / 2);
	var halfPSY = Math.ceil(pageSizeY / 2);
	var theXPos = halfPSX - (theNumber / 2);
	// get height of element
	var theY = heightY;
	if(!window.ActiveXObject){
		if(halfPSY - (theY / 2) > 5){
	var theYPos = halfPSY - (theY / 2);
		} else{
			theYPos = 20;
		}
	} else {
		if(halfPSY - (theY / 2) > 5){
	var theYPos = halfPSY - (theY / 2);
		} else {
			var theYPos = 20;
		}
	}
	theObj.style.top = theYPos + "px";
	theObj.style.left = theXPos + "px";
	//theObj.style.background = "#000000";
    theObj.style.position = "absolute";
	bodyAdd.push(obj);
	if(theObj.style.display = "none"){
		theObj.style.display = "block";
	}
	if(dEI("formFrame")){
		dEI("formFrame").style.display = "block";	
	}
}

function clear(){
	if(dEI("blockieselect")){
	killBlock();
	}
	if(dEI("formFrame")){
		dEI("popwin").innerHTML = "";
	}
	// if not in array
	if(dEI("dim")){
		dEI("dim").style.display = "none";
	}
for(var k = 0; k < bodyAdd.length;k++){
	var tmp = dEI(bodyAdd[k]);
	if(tmp.style.display = "block"){
		tmp.style.display = "none";
	}
}
}


function followObj(val){
	var theObj = val;
	window.onresize = function(){
		if(dEI("popwin")){
			if(dEI("popwin").style.display == "none"){
				// don't do anything
			} else {
				if(dEI("popwin").style.display == "block"){
					displayVals();
					findLocWin(theObj);
				}
			}
		}
	}
	/*window.onscroll = function(){
		var pageSize = getPageSize();
		var sX = pageSize[0];
		var sY = pageSize[1];
		dEI("dim").style.width = sX + "px";
		dEI("dim").style.height = sY + "px";
	}*/
	
	
	if(window.ActiveXObject){
		var bodyB = document.getElementsByTagName("body");
		bodyB[0].onchange = function(){
			findLocWin(theObj);
			displayVals();
		}
		window.onscroll = function(){
		if(dEI("popwin").style.display == "none"){
		// don't do anything
		} else {
			if(dEI("popwin").style.display == "block"){
				findLocWin(theObj);
				displayVals();
			}
		
		}
	}
	}
}
//
function followObjIF(val){
	var theObj = val;
	
	window.onresize = function(){
		if(dEI("popwin")){
		findLocWinIF("popwin");
		}
		var state = document.getElementById("dim").style.display;
		if(state === "none"){
		} else {
			displayVals();
		}
	}

		if(window.ActiveXObject){
		var bodyB = document.getElementsByTagName("body");
		bodyB[0].onchange = function(){
			findLocWinIF("popwin");
			displayVals();
		}
		window.onscroll = function(){
		findLocWinIF("popwin");
		displayVals();
	}
	} else {
		/*window.addEventListener('scroll',function(){updateDim();}, false);*/
	}
}
function updateDim(){
	var pageSize = getPageSize();
	var sX = pageSize[0];
	var sY = pageSize[1];
	if(window.ActiveXObject){
	dEI("dim").style.width = sX + "px";
	dEI("dim").style.height = sY + "px";
	} else {
		dEI("dim").style.width = "100%";
		dEI("dim").style.height = "100%";
	}
}

function closewin(obj){
var theObj = document.getElementById(obj);
theObj.style.display = "none";
theObj.innerHTML = "";
clear();
}

function hide(obj){
document.getElementById(obj).style.display="none";
}

function show(obj){
var theObj = dEI(obj);
	if(theObj.style.display == "none"){
		theObj.style.display = "block";
	} else {
		theObj.style.display = "none";
	}
}

// legacy 
function createWin(page, obj){
	var theObj = document.getElementById(obj);
	var dimEff = document.getElementById('dim');
	var serverPage = page;
		xmlhttp.open("GET", serverPage);
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				theObj.innerHTML = xmlhttp.responseText;
				mergePopDimL(obj);
				displayVals();
			}
		}
		xmlhttp.send(null);
}

function mergePopDimL(value){
	// pop Dim
	displayVals();
	findLocWinL(value);
}

function findLocWinL(obj){
	if(dEI("mid")){
		var theWidth = 360 + "px";
		var theHeight = (360 / 2) + "px";
	}
	if(dEI("allinbox")){
		var theWidth = 600 + "px";
		var theHeight = 600 + "px";
	}
	
	followObjL(obj);	
	var pageSize = getPageSize();
	var pageScroll = getPageScroll();
	var theObj = dEI(obj);
	if(theWidth.substr(0,3) == 'p'){
	var theNumber = theWidth.substr(0,4);
	} else {
		var theNumber = theWidth.substr(0,3);
	}
	if(pageSize[0] > pageSize[2]){
		var pageSizeX = (pageSize[0] + pageScroll[0]);
	} else{
	var pageSizeX = (pageSize[2] + pageScroll[0]);
	}
	if(pageSize[1] > pageSize[3]){
		var pageSizeY = (pageSize[3] + pageScroll[1]);
	} else {
	var pageSizeY = (pageSize[1] + pageScroll[1]);
	}
	var halfPSX = Math.ceil(pageSizeX / 2);
	var halfPSY = Math.ceil(pageSizeY / 2);
	if(theHeight.substr(0,3) == 'p'){
	var theHeight = theHeight.substr(0,4);
	} else {
		var theHeight = theHeight.substr(0,3);
	}
	var theY = theHeight;
	var theXPos = halfPSX - (theNumber / 2);
	if(!window.ActiveXObject){
	var theYPos = halfPSY - (theHeight * .72);
	} else {
	var theYPos = halfPSY - (theHeight * .82);	
	}
	if(theYPos <= 1){
		theYPos = 20;	
	}
	theObj.style.top = theYPos + "px";
	theObj.style.left = theXPos + "px";
	theObj.style.width = theWidth;
	theObj.style.height = theHeight;
    theObj.style.position = "absolute";
	theObj.style.zindex = "999";
	bodyAdd.push(obj);
	if(theObj.style.display = "none"){
		theObj.style.display = "block";
	}
}

function followObjL(val){
	var theObj = val;
	
	window.onresize = function(){
		if(dEI("popwin")){
			if(dEI("popwin").style.display == "none"){
				// don't do anything
			} else {
				if(dEI("popwin").style.display == "block"){
					displayVals();
					findLocWinL(theObj);
				}
			}
		}
	}
	
	window.onscroll = function(){
		var pageSize = getPageSize();
		var sX = pageSize[0];
		var sY = pageSize[1];
		dEI("dim").style.width = sX + "px";
		dEI("dim").style.height = sY + "px";
	}
	
	if(window.ActiveXObject){
		var bodyB = document.getElementsByTagName("body");
		bodyB[0].onchange = function(){
			findLocWinL(theObj);
			displayVals();
		}
	}
}

// Functions for the Reminders Pages 
function checkall(obj, formname){
// get object type
var pageObj = obj; //ex: checkbox
// find all obj types on page
var theForm = document.forms[formname];
var theSet = theForm.selectReminder;
	for(var k = 0; k < theSet.length; k++){
		var tmp = theSet[k];
		if(tmp.checked == true){
			tmp.checked = false;
		} else {
			tmp.checked = true;
		}
	}
}


// function to open any window with the linked obj, and the imbedded class of hide
function showWin(obj){
	var theObj = document.getElementById(obj);
	if(theObj.className == "hide"){
		theObj.className = "show";
	} else {
		theObj.className = "hide";
	}
}

/* Functions added for the Billeo Help Pages - Added by Scott 4-18-08 */
// go to a nwe page - replaces standard web anchor 
function goto(obj){
	window.location.href = mainUrl + obj;	
}

function advanceDownPage(obj, e){
	// call Event.pointerY(e) from prototype lib
	var thePosY = Event.pointerY(e);
	var theObj = dEI(obj);
	// Event.pointerY will be off by the offset of the top of the page
	var theOffset = 60;
	theObj.style.top = (thePosY - theOffset) + "px";
	theObj.style.marginTop = "5px";
	//
	if(theObj.style.display == "none"){
		theObj.style.display = "block";
	} else {
		theObj.style.display = "none";
	}
}

function getLeftOffset(cloneToObj, theObj, e){
	// cloneToObj is the object you are trying to find the X position of
	// theObj is the object you are looking to move on the page
	var theCloneObj = dEI(cloneToObj);
	var theXOffset = Position.cumulativeOffset(theCloneObj);
	var thePosY = Event.pointerY(e);
	if(window.ActiveXObject){
		if(document.documentElement && typeof document.documentElement.style.maxHeight!="undefined"){
		// is IE7
		var theNewXPos = (theXOffset[0] + 5) + "px";
		} else {
			var theNewXPos = (theXOffset[0] + 3) + "px";
		}
	} else {
		var theNewXPos = (theXOffset[0] + 5) + "px";	
	}
	var theObjMove = dEI(theObj);
	
	if(window.ActiveXObject){
		theObjMove.style.top = (thePosY - 50) + "px";
	} else {
		theObjMove.style.top = (thePosY + 18) + "px";
	}
	theObjMove.style.marginTop = "5px";
	theObjMove.style.left = theNewXPos;
	if(theObjMove.style.display == "none"){
		theObjMove.style.display = "block";
	} else {
		theObjMove.style.display = "none";
	}
}

/* Functions Used on the FAQ page */
function createActions(){
var theSearch = dEI("searchInput");
var theSearchPress = dEI("faqSearchBtn");
theSearch.onfocus = function(){
if(theSearch){
if(theSearch.value == "EX: How do I install the Toolbar?"){
	theSearch.value = "";
	}
}
theSearch.onblur = function(){
	if(theSearch.value == ""){
		theSearch.value = "EX: How do I install the Toolbar?";
}
}
}
theSearchPress.onclick = function(){
	window.location.href = "/faq/faq_search.html";
}
}
function openanswer(obj){
	var theObj = dEI(obj);
	if(theObj.className == "hide"){
		theObj.className = "show";
	} else {
		theObj.className = "hide";
	}
}
/* openclose is used to do just that in menus with the open close arrow */
function openclose(obj){
	var theObj = dEI(obj);
	if(theObj.className == "opensubmenu"){
		theObj.className = "closesubmenu";
	} else {
		theObj.className = "opensubmenu";
	}
	window.onload = function(){createActions();}
}
/* */
/* Function that replaces the Flash Video for the video tour pages */
function updateFlash(obj,num){
var theObj = document.getElementById(obj);
// numbers : 0 = Toolbar, 1 = eWallet, 2 = Passwords, 3 = Fill Form, 4 = Save Receipt, 5 = Bill Pay, 6 = Shopping, 7 = Reports
if(num == 0){
	var theString = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"720\" height=\"575\" id=\"videotour\">";
	var theString = theString + "<param name=\"movie\" value=\"/help/videotours/ToolbarViewFinalAudio_skin.swf\">";
	var theString = theString + "<param name=\"quality\" value=\"high\">";
	var theString = theString + "<param name=\"loop\" value=\"0\">";
	var theString = theString + "<embed src=\"/help/videotours/ToolbarViewFinalAudio_skin.swf\" width=\"720\" height=\"575\" loop=\"0\" quality=\"high\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" menu=\"false\"></embed>";
	var theString = theString + "</object>";
	theObj.innerHTML = theString;
	} else if(num == 1){
		var theString = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"720\" height=\"575\" id=\"videotour\">";
	var theString = theString + "<param name=\"movie\" value=\"/help/videotours/eWalletFinalwAudio_skin.swf\">";
	var theString = theString + "<param name=\"quality\" value=\"high\">";
	var theString = theString + "<param name=\"loop\" value=\"0\">";
	var theString = theString + "<embed src=\"/help/videotours/eWalletFinalwAudio_skin.swf\" width=\"720\" height=\"575\" loop=\"0\" quality=\"high\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" menu=\"false\"></embed>";
	var theString = theString + "</object>";
	theObj.innerHTML = theString;
	} else if(num == 2){
		var theString = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"720\" height=\"575\" id=\"videotour\">";
	var theString = theString + "<param name=\"movie\" value=\"/help/videotours/FinalPasswords_skin.swf\">";
	var theString = theString + "<param name=\"quality\" value=\"high\">";
	var theString = theString + "<param name=\"loop\" value=\"0\">";
	var theString = theString + "<embed src=\"/help/videotours/FinalPasswords_skin.swf\" width=\"720\" height=\"575\" loop=\"0\" quality=\"high\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" menu=\"false\"></embed>";
	var theString = theString + "</object>";
	theObj.innerHTML = theString;
	} else if(num == 3){
		var theString = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"720\" height=\"575\" id=\"videotour\">";
	var theString = theString + "<param name=\"movie\" value=\"/help/videotours/fillFormFinal2_skin.swf\">";
	var theString = theString + "<param name=\"quality\" value=\"high\">";
	var theString = theString + "<param name=\"loop\" value=\"0\">";
	var theString = theString + "<embed src=\"/help/videotours/fillFormFinal2_skin.swf\" width=\"720\" height=\"575\" loop=\"0\" quality=\"high\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" menu=\"false\"></embed>";
	var theString = theString + "</object>";
	theObj.innerHTML = theString;
	} else if(num == 4){
		var theString = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"720\" height=\"575\" id=\"videotour\">";
	var theString = theString + "<param name=\"movie\" value=\"/help/videotours/saveReceiptFinalwAudio_skin.swf\">";
	var theString = theString + "<param name=\"quality\" value=\"high\">";
	var theString = theString + "<param name=\"loop\" value=\"0\">";
	var theString = theString + "<embed src=\"/help/videotours/saveReceiptFinalwAudio_skin.swf\" width=\"720\" height=\"575\" loop=\"0\" quality=\"high\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" menu=\"false\"></embed>";
	var theString = theString + "</object>";
	theObj.innerHTML = theString;
	} else if(num == 5){
		var theString = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"720\" height=\"575\" id=\"videotour\">";
	var theString = theString + "<param name=\"movie\" value=\"/help/videotours/PayBillFinalWAudio_skin.swf\">";
	var theString = theString + "<param name=\"quality\" value=\"high\">";
	var theString = theString + "<param name=\"loop\" value=\"0\">";
	var theString = theString + "<embed src=\"/help/videotours/PayBillFinalWAudio_skin.swf\" width=\"720\" height=\"575\" loop=\"0\" quality=\"high\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" menu=\"false\"></embed>";
	var theString = theString + "</object>";
	theObj.innerHTML = theString;
	} else if(num == 6){
		var theString = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"720\" height=\"575\" id=\"videotour\">";
	var theString = theString + "<param name=\"movie\" value=\"/help/videotours/shoppingFinalwAudio_skin.swf\">";
	var theString = theString + "<param name=\"quality\" value=\"high\">";
	var theString = theString + "<param name=\"loop\" value=\"0\">";
	var theString = theString + "<embed src=\"/help/videotours/shoppingFinalwAudio_skin.swf\" width=\"720\" height=\"575\" loop=\"0\" quality=\"high\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" menu=\"false\"></embed>";
	var theString = theString + "</object>";
	theObj.innerHTML = theString;
	} else if(num == 7){
		var theString = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"720\" height=\"575\" id=\"videotour\">";
	var theString = theString + "<param name=\"movie\" value=\"/help/videotours/ReportsView_skin.swf\">";
	var theString = theString + "<param name=\"quality\" value=\"high\">";
	var theString = theString + "<param name=\"loop\" value=\"0\">";
	var theString = theString + "<embed src=\"/help/videotours/ReportsView_skin.swf\" width=\"720\" height=\"575\" loop=\"0\" quality=\"high\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" menu=\"false\"></embed>";
	var theString = theString + "</object>";
	theObj.innerHTML = theString;
	}
}
/* */

-->
