var height = screen.height;
var width = screen.width;
function encode(str) 
{ // Netscape fix 
	return escape(str.replace(/ /g,'+'));
}

function view(what,w,h) 
{
	var leftpos = width/2 - (w+12)/2;
	var toppos = height/2 - (h+31)/2;
	var url = 'viewer.php?pic='+encode(what)+'&w='+w+'&h='+h;
	window.open(url,'WIN','scrollbars=no,status=no,toolbar=no,resizable=1,location=no,menu=no,width='+w+',height='+h+',left=' + leftpos + ',top=' + toppos);
}

function getParams() {
	var idx = document.URL.indexOf('?');
	var params = new Array();
	if (idx != -1) {
		var pairs = document.URL.substring(idx+1, document.URL.length).split('&');
		for (var i=0; i<pairs.length; i++) {
			nameVal = pairs[i].split('=');
			params[nameVal[0]] = nameVal[1];
		}
	}
	return params;
}
params = getParams();

function resize() {
	if (eval(pic).height) 
	{
		var name = navigator.appName
		if (name == "Microsoft Internet Explorer")
		{
			myHeight = eval(pic).height+31;
			myWidth = eval(pic).width+12;
		} else {
			myHeight = eval(pic).height;
			myWidth = eval(pic).width;
		}
		clearTimeout();
		var height = screen.height;
		var width = screen.width;
		var leftpos = width/2 - myWidth/2;
		var toppos = height/2 - myHeight/2; 
		self.moveTo(leftpos, toppos);
		self.resizeTo(myWidth, myHeight);
	} else {
		setTimeOut(resize(), 100);
	}
}


function popUp(page) {
var windowprops = ('toolbars=0,scrollbars=0,location=0,statusbars=1,menubars=0,resizable=1,width=350,height=350,left=0,top=0');

var URL = document.location.src=(page);
popup = window.open(URL,"MenuPopup",windowprops);
}

var s=0;
function popUpScripture(script,s) {
var windowprops = ("toolbars=0,scrollbars="+s+",location=0,statusbars=1,menubars=0,resizable=1,width=300,height=350,left=250,top=125");

var URL = document.location.src="scripture.php?scripture="+script;
popup = window.open(URL,"MenuPopup",windowprops);
}
 
 
function RemoveDot()
{
for (a in document.links) document.links[a].onfocus = document.links[a].blur;
}
if (document.all)
{
document.onmousedown = RemoveDot;
}


function password(){
var allcookies = document.cookie;
var pos = allcookies.indexOf("pswrd");

if (pos>0) {
document.location.href = "main.php?action=church&password=pos";
}else{
var pass;
pass = prompt("Enter Password", "");
if (pass!=null){
document.location.href = "main.php?action=church&password=" + pass;
}else{
}
}
}


if (!document.layers&&!document.all)
event="test";
function showtip(text){
if (document.all&&(document.readyState=="interactive"||document.readyState=="complete")){
document.all.tooltip.innerHTML="<div style=\"border:1px solid black;padding-left:2px;padding-right:2px\">"+text+"</div>";
document.all.tooltip.style.pixelLeft=event.clientX+document.body.scrollLeft+15;
document.all.tooltip.style.pixelTop=event.clientY+document.body.scrollTop-10;
document.all.tooltip.style.visibility="visible";
}

}
function hidetip() {
	if (document.all) {
		document.all.tooltip.style.visibility="hidden";
	}
}