function popup(lPage){
var iMyWidth;
var iMyHeight;
var lPage;
var strPage;
var strResize;
var strScroll;
var strHeight;
var strWidth;

switch(lPage){
	case 'photoUpload':
		strPage = ("/admin/Upload-Progress.asp")	
		strResize = "no"
		strScroll = "no"
		strHeight = "200"
		strWidth = "425"
		break
	case 'content_images':
		strPage = ("/admin/content_images.asp?src=tiny")	
		strResize = "yes"
		strScroll = "yes"
		strHeight = "500"
		strWidth = "425"
		break
	case 'print':
		strPage = ("/nrPrint.asp")	
		strResize = "yes"
		strScroll = "yes"
		strHeight = "600"
		strWidth = "900"
		break
	case 'ebookpw':
		strPage = ("/eBookPW.asp")	
		strResize = "no"
		strScroll = "no"
		strHeight = "145"
		strWidth = "600"
		break

}

//gets top and left positions based on user's resolution so hint window is centered.
iMyWidth = (window.screen.width/2) - ((strWidth/2) + 10)//half the screen width minus half the new window width (plus 5 pixel borders).
iMyHeight = (window.screen.height/2) - ((strHeight/2) + 50)//half the screen height minus half the new window height (plus title and status bars).
	var win2 = window.open(strPage,"NewbergReport","status,height=" + strHeight + ",width=" + strWidth + ",resizable=" + strResize + ",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=" + strScroll + "")
}

function doPopup(lid){
	var theState = formName.State.value;
	var theURL = "http://www.newbergreport.com/playAudio.asp?id=";
	theURL += lid;
	window.open(theURL);
} 

function popup2(lPage,lId){
var iMyWidth;
var iMyHeight;
var lPage;
lId
var strPage;
var strResize;
var strScroll;
var strHeight;
var strWidth;

switch(lPage){
	case 'audio':
		strPage = ("/playAudio.asp?id=" + lId)	
		strResize = "no"
		strScroll = "no"
		strHeight = "200"
		strWidth = "425"
		break
	case 'upload':
		strPage = ("/admin/Upload-Progress.asp?id=" + lId + "&a=affiliates")	
		strResize = "yes"
		strScroll = "yes"
		strHeight = "200"
		strWidth = "425"
		break
	case 'futures':
		strPage = ("/admin/Upload-Progress.asp?id=" + lId + "&a=futures")	
		strResize = "yes"
		strScroll = "yes"
		strHeight = "200"
		strWidth = "425"
		break
	case 'showImage':
		strPage = ("/admin/showImage.asp?id=" + lId)	
		strResize = "yes"
		strScroll = "yes"
		strHeight = "600"
		strWidth = "900"
		break
}

//gets top and left positions based on user's resolution so hint window is centered.
iMyWidth = (window.screen.width/2) - ((strWidth/2) + 10)//half the screen width minus half the new window width (plus 5 pixel borders).
iMyHeight = (window.screen.height/2) - ((strHeight/2) + 50)//half the screen height minus half the new window height (plus title and status bars).
	var win2 = window.open(strPage,"NewbergReport","status,height=" + strHeight + ",width=" + strWidth + ",resizable=" + strResize + ",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=" + strScroll + "")
} 

function popup3(lPage,lType,lId,lBook){
var iMyWidth;
var iMyHeight;
var lPage;
var lId;
var lBook;
var strPage;
var strResize;
var strScroll;
var strHeight;
var strWidth;
var lType;

switch(lPage){
	case 'showEBook':
		strPage = ("/eStore/showEBook.asp?ltype=" + lType + "&id=" + lId + "&lBook=" + lBook)	
		strResize = "no"
		strScroll = "no"
		strHeight = "800"
		strWidth = "800"
		break
}

//gets top and left positions based on user's resolution so hint window is centered.
iMyWidth = (window.screen.width/2) - ((strWidth/2) + 10)//half the screen width minus half the new window width (plus 5 pixel borders).
iMyHeight = (window.screen.height/2) - ((strHeight/2) + 50)//half the screen height minus half the new window height (plus title and status bars).
	var win2 = window.open(strPage,"NR","status,height=" + strHeight + ",width=" + strWidth + ",resizable=" + strResize + ",left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",scrollbars=" + strScroll + "")
}

function formFocus(){
	var bFound = false;
	// for each form
	for (f=0; f < document.forms.length; f++){
	// for each element in each form
	for(i=0; i < document.forms[f].length; i++){
	  // if it's not a hidden element
	  if (document.forms[f][i].type != "hidden"){
		// and it's not disabled
		if (document.forms[f][i].disabled != true){
			// set the focus to it
			document.forms[f][i].focus();
			var bFound = true;
		}
	  }
	  // if found in this element, stop looking
	  if (bFound == true)
		break;
	}
	// if found in this form, stop looking
	if (bFound == true)
	  break;
	}
}
