function insertFlashHere() {
	document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='537' height='193' hspace='0' vspace='0'><param name='wmode' value='transparent'><param name='movie' value='http://www.online.church123.com/church123/images/C123Home.swf' /><param name='quality' value='high' /><embed wmode='transparent' src='http://www.online.church123.com/church123/images/C123Home.swf' width='537' height='193' hspace='0' vspace='0' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' /></object>");
}
function randomImg() {
	document.getElementById('randomimg').src="http://www.online.church123.com/church123/TopRightImages/TR"+Math.floor(Math.random()*8)+".jpg";
}
function setCookie (name, value, days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires=" + date.toGMTString();
	} else {
		var expires = "";
	}
	document.cookie = name + "=" + value + expires + "; path=/";
}
function getCookie (name) {
	var nameEq = name + "=";
	var arrCookies = document.cookie.split(';');
	for(var i=0; i < arrCookies.length; i++) {
		var c = arrCookies[i];
		while (c.charAt(0)==' ') { c = c.substring(1, c.length); }
		if (c.indexOf(nameEq) == 0) {
			return c.substring(nameEq.length, c.length);;
		}
	}
	return null;
}
function getParam(vars, param) { //v9
	if (vars.indexOf("?")==0) vars = vars.substring(1); //remove initial "?" from querystrings
	var pairs = vars.split("&");
	var splitPair;
	for (var i = 0; i < pairs.length; i++) {
		splitPair = pairs[i].split("=");
		if (splitPair[0]==param) return decodeURIComponent(splitPair[1]);
	}
	return null;
}
function getReferrer() {
	hostname = document.location.hostname;
	referrer = document.referrer;
	hostnameOfReferrer = referrer.substring(7,referrer.indexOf('/',8));
	qref = getParam(document.location.search,"referrer");
	if ((hostnameOfReferrer!=hostname)&&(referrer!="")) setCookie ("ref", encodeURIComponent(referrer), 365);
	if (qref!=null) {
		setCookie ("qref", encodeURIComponent(qref), 365);
	}
}
