// JavaScript Document
// gwol-default.js - For God's Way Of Love website
frameId = "frame01"
divId = "div00"

function setIframeSize() 
{
	// Sets the iframe size to suit any sized html inserted
	if (document.all) {
		var iframe = document.all[frameId];
		var div = document.all[divId];
		var h = iframe.contentWindow.document.body.scrollHeight;
		var w = iframe.contentWindow.document.body.scrollWidth;
		frameSet = true;
	} else {
		if (document.getElementById) {
			var iframe = document.getElementById(frameId);
			var div = document.getElementById(divId);
			var h = iframe.contentDocument.body.scrollHeight;
			var w = iframe.contentDocument.body.scrollWidth;
			frameSet = true;
		} else {
			var h = 0;
			var w = 0;
			var iframe = null;
			var div = null;
			var frameSet = false;
		}
	}
	// window.alert("Height :" + h + ":  Width :" + w + ":");
	if (frameSet==true) {
		var new_h = (h+15);
		var new_w = (w+15);
		iframe.style.height = new_h + "px";
		iframe.style.width = new_w + "px";
		if (new_h > 440) {
			div.style.height = new_h + "px";
		} else {
			div.style.height = 440 + "px";
		}
	}
}

function jumpToIndex(mainURL, jumpURL)
{
	globalURL = mainURL;
	var findMain = new Array();
	var i=0;
	findMain[i] = globalURL.indexOf("/", 0);
	while (findMain[i]>0)
	{
		findMain[i+1] = globalURL.indexOf("/", findMain[i]+1);
  		i++;
 	}	
	var rootStr = ""
	var i=0;
	while (findMain[i]>0)
  	{
		rootStr = rootStr + "../"
  		i++;
 	}	

	if (!(globalURL == "index.htm")) {
		window.location = rootStr + "index.htm?jumpURL=" + jumpURL;
		// window.alert("in jumpToIndex :" + rootStr + "index.htm?jumpURL=" + jumpURL + ":");
	}	
}

function setIframeSrc(pageURL)
{
	var iframeEl = document.getElementById? document.getElementById(frameId): document.all? document.all[frameId]: null;
	if (iframeEl) {
		iframeEl.src = pageURL;
	}
}

function findSetFrameSrc(pageURL) {
	globalURL = pageURL;
	jumpURL = queryString("jumpURL");
	// window.alert("findSetFrameSrc = globalURL :"+ globalURL + ":  jumpURL :" +  jumpURL + ":");
	if ((!(jumpURL)) || (jumpURL == false) || (jumpURL == "false")) {
		globalURL = "index.htm";
		jumpURL = "home.htm";
		// window.alert("globalURL :"+ globalURL + ":  jumpURL :" +  jumpURL + ":");
	}
	setIframeSrc(jumpURL);
	// window.alert("setIframeSrc = globalURL :"+ globalURL + ":  jumpURL :" +  jumpURL + ":");
}

function setGlobalURL(pageURL) {
	globalURL = pageURL;
	// window.alert("globalURL afer setGlobalURL :" + globalURL + ":");
}

function PageQuery(q) 
{
	if(q.length > 1) this.q = q.substring(1, q.length);
	else this.q = null;
	this.keyValuePairs = new Array();
	if(q) 
	{
		for(var i=0; i < this.q.split("&").length; i++)
		{
			this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}
	this.getKeyValuePairs = function() { return this.keyValuePairs; }
	this.getValue = function(s) 
	{
		for(var j=0; j < this.keyValuePairs.length; j++) 
		{
			if(this.keyValuePairs[j].split("=")[0] == s)
			return this.keyValuePairs[j].split("=")[1];
		}
		return false;
	}
	this.getParameters = function() 
	{
		var a = new Array(this.getLength());
		for(var j=0; j < this.keyValuePairs.length; j++)
		{
			a[j] = this.keyValuePairs[j].split("=")[0];
		}
		return a;
	}
	this.getLength = function() { return this.keyValuePairs.length; }
}

function queryString(key)
{
	var page = new PageQuery(window.location.search);
	return unescape(page.getValue(key));
}

function queryKeyPair(key)
{
	if(queryString(key)=='false')
	{
		return ("Unkown=Unknown");
	} else
	{
		return (queryString(key));
	}
}

