/*** IMAGE SWAP ***/
var imgObjs = new Array();
var ii, jj, nn;

for(ii = 0; ii < imgNames.length; ii++)
  for(jj = 0; jj < imgStates.length; jj++){
    nn = imgNames[ii] + imgStates[jj];
    imgObjs[nn] = new Image();
    imgObjs[nn].src = imgPrefix + nn + imgSuffix;
  }

function swap(img, state){
  if(!document.images) return;
  document.images[img].src = imgObjs[img + state].src;
}


/*** OPEN WINDOW ***/
var forcedRefresh = true;
var alreadyopen = new Array();
var newwin = new Array();

function openCenteredWindow(theURL, winName, features, w, h){
  openWindow(theURL, winName, features + ',height=' + h + ',width=' + w + ',top=' + ((screen.height - h - 29) / 2) + ',left=' + ((screen.width - w - 10) / 2));
}

function openWindow(theURL, winName, features){
  if(forcedRefresh == false && alreadyopen[winName] && !newwin[winName].closed){
    newwin[winName].focus();
  }
  else{
    alreadyopen[winName] = 1;	
    newwin[winName] = window.open(theURL, winName, features);
    newwin[winName].focus();
  }
}


/*** STAY CONNECTED ***/
function stayConnected(){
	var usersEmail = document.forms[0].usersEmail.value;
	document.forms[0].usersEmail.value = "email address";
	openCenteredWindow('cfm/stay_connected/index.cfm?email=' + usersEmail,'pofwin','toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no','593','381');
}

function stayConnectedLibrary(){
	var usersEmail = document.forms[0].usersEmail.value;
	document.forms[0].usersEmail.value = "email address";
	openCenteredWindow('../stay_connected/index.cfm?email=' + usersEmail,'pofwin','toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no','593','381');
}

function stayConnectedWhatOthers(){
	var usersEmail = document.forms[0].usersEmail.value;
	document.forms[0].usersEmail.value = "email address";
	openCenteredWindow('../stay_connected/index.cfm?back=woad&email=' + usersEmail,'pofwin','toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=no','593','381');
}


/*** SEND IDEAS EMAIL ***/
function sendIdeas(){
	location.href="mailto:info@practicingourfaith.org?subject=POF%20-%20Ways%20To%20Practice";
}


/*** SEND MATERIAL EMAIL ***/
function sendMaterial(){
	location.href="mailto:info@practicingourfaith.org?subject=POF%20-%20Library%20Submission";
}
