// DATE Functionality *** Script BEGIN *** -->
function print_date(){
var currentTime = new Date()
var month = currentTime.getMonth()// + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
months = new Array ('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');
//document.write(month + "/" + day + "/" + year);
  
document.write("<a href='http://devotional.upperroom.org/devotionals/"+year+"-"+months[month]+"-"+day+"' class='lightwindow page-options' title='External site - UPPER ROOM'>Upper Room</a>");


}
//DATE Functionality *** Script END *** -->

// NEW WINDOW Functionality *** Script BEGIN *** -->
<!--
function externalLinks() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "external") 
     anchor.target = "_blank"; 
 } 
} 
window.onload = externalLinks;
// NEW WINDOW Functionality *** Script END *** -->


// Focus on the Family SCRIPT -->
function FFRealOne(){
    var FFRO = new Date();
    FFROday   = FFRO.getDay();
    FFROdate  = FFRO.getDate();
    FFROmonth = FFRO.getMonth();
	FFROdays = new Array ('ffd', 'ffd', 'ffd', 'ffd', 'ffd', 'ffd', 'ffw','');
    FFROnumdates = new Array ('01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31');
    FFROmonths = new Array ('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');
    
	// Real Player FUNCTION Script Begins 
	document.write("<a href=javascript:void(window.open('http://www.oneplace.com/common/player/oneplace/CustomPlayer.asp?url=http://boss.streamos.com/real/swn/oneplace/rm/"+FFROdays[FFROday]+"/"+FFROdays[FFROday]+""+FFRO.getFullYear(),FFROmonths[FFROmonth],FFROnumdates[FFROdate-1]+".ram&MinTitle=Focus+on+the+Family&MinURL=http://www.oneplace.com/ministries/focus_on_the_family/&MinArchives=http://www.oneplace.com/ministries/focus_on_the_family/archives.asp&Refresh=&AdsCategory=MINISTRY.FOTF&Show_ID=132','player','toolbar=no,location=no,status=no,directories=no,menubar=no,scrolling=auto,scrollbars=auto,width=500,height=400,resizable=no'))>Real Player</a>");
}
//end Script-->


function FFMediaPlayer(){
	var FFMP = new Date();
	FFMPday   = FFMP.getDay();
	FFMPdate  = FFMP.getDate();
	FFMPmonth = FFMP.getMonth();
	FFMPdays = new Array ('ffd', 'ffd', 'ffd', 'ffd', 'ffd', 'ffd', 'ffw','');
	FFMPnumdates = new Array ('01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31');
	FFMPmonths = new Array ('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');
	document.write("<a  href=javascript:void(window.open('http://www.oneplace.com/common/player/oneplace/CustomPlayer.asp?url=http://boss.streamos.com/wmedia/swn/oneplace/wm/"+FFMPdays[FFMPday]+"/"+FFMPdays[FFMPday]+""+FFMP.getFullYear(),FFMPmonths[FFMPmonth],FFMPnumdates[FFMPdate-1]+".wax&MinTitle=Focus+on+the+Family&MinURL=http://www.oneplace.com/ministries/focus_on_the_family/&MinArchives=http://www.oneplace.com/ministries/focus_on_the_family/archives.asp&Refresh=&AdsCategory=MINISTRY.FOTF&Show_ID=132','player','toolbar=no,location=no,status=no,directories=no,menubar=no,scrolling=auto,scrollbars=auto,width=500,height=400,resizable=no'))>MS Media Player</a>");
}
//end Script-->

//Walk with the Word SCRIPT -->

function WWRealOne(){
    var WWRO = new Date();
    WWROday   = WWRO.getDay();
    WWROdate  = WWRO.getDate();
    WWROmonth = WWRO.getMonth();
	WWROdays = new Array ('ww', 'ww', 'ww', 'ww', 'ww', 'ww', 'ww','');
    WWROnumdates = new Array ('01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31');
    WWROmonths = new Array ('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');
    
	// Real Player FUNCTION Script Begins 
	document.write("<a href=javascript:void(window.open('http://www.oneplace.com/common/player/oneplace/CustomPlayer.asp?bcd="+WWROmonths[WWROmonth]+"/"+WWROnumdates[WWROdate-1]+"/"+WWRO.getFullYear()+"&url=http://boss.streamos.com/real/swn/oneplace/rm/"+WWROdays[WWROday]+"/"+WWROdays[WWROday]+""+WWRO.getFullYear(),WWROmonths[WWROmonth],WWROnumdates[WWROdate-1]+".ram&MinTitle=Walk+in+the+Word&MinURL=http://www.oneplace.comhttp://www.oneplace.com/ministries/walk_in_the_word/&MinArchives=http://www.oneplace.comhttp://www.oneplace.com/ministries/walk_in_the_word/archives.asp&Refresh=&AdsCategory=MINISTRY.WW&Show_ID=79','player','toolbar=no,location=no,status=no,directories=no,menubar=no,scrolling=auto,scrollbars=auto,width=500,height=400,resizable=no'))>Real Player</a>");
}
//end Script-->

function WWMediaPlayer(){
	var WWMP = new Date();
	WWMPday   = WWMP.getDay();
	WWMPdate  = WWMP.getDate();
	WWMPmonth = WWMP.getMonth();
	WWMPdays = new Array ('ww', 'ww', 'ww', 'ww', 'ww', 'ww', 'ww','');
	WWMPnumdates = new Array ('01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31');
	WWMPmonths = new Array ('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');
	document.write("<a  href=javascript:void(window.open('http://www.oneplace.com/common/player/oneplace/CustomPlayer.asp?bcd="+WWMPmonths[WWMPmonth]+"/"+WWMPnumdates[WWMPdate-1]+"/"+WWMP.getFullYear()+"&url=http://boss.streamos.com/wmedia/swn/oneplace/wm/"+WWMPdays[WWMPday]+"/"+WWMPdays[WWMPday]+""+WWMP.getFullYear(),WWMPmonths[WWMPmonth],WWMPnumdates[WWMPdate-1]+".wax&MinTitle=Walk+in+the+Word&MinURL=http://www.oneplace.comhttp://www.oneplace.com/ministries/walk_in_the_word/&MinArchives=http://www.oneplace.comhttp://www.oneplace.com/ministries/walk_in_the_word/archives.asp&Refresh=&AdsCategory=MINISTRY.WW&Show_ID=79','player','toolbar=no,location=no,status=no,directories=no,menubar=no,scrolling=auto,scrollbars=auto,width=500,height=400,resizable=no'))>MS Media Player</a>");
}
//end Script-->

// GOOGLE Map Link from Contact Page // -->

function GMLink(){
	document.write("<a href='http://maps.google.ca/maps?f=q&hl=en&q=1+world+drive,+mississauga,+ontario&sll=49.891235,-97.15369&sspn=26.396618,59.765625&layer=&ie=UTF8&z=16&ll=43.634367,-79.689074&spn=0.007222,0.014591&om=1&iwloc=addr'>Map and Direction</a>");
}
//end Script-->


// POP-UP WINDOW Functionality -->
// ***** This section is customizable.  Change the values of the parameters to match your global.xml file *****

  var contentW     = "500";
  var contentH     = "390";

// ***** End of customizable section *****

  var winHeight = parseInt(contentH);
  var winWidth = (parseInt(contentW));
  var posX = ((screen.width-winWidth) /2) -6;
  var posY = ((screen.height-winHeight) /2)  -15;
  if ((screen.width - winWidth) <= 10)
   posX = 0 ;
  if ((screen.height - winHeight) <= 50)
   posY = 0 ;

function new_window(url) {
link = 
window.open(url,"Link",'"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left='+posX +',top=' + posY +',width=' + winWidth + ',height=' + winHeight + '"');
}
//end Script-->

// News Stand Archive Function //

var enablepersist="on" //Enable saving state of content structure using session cookies? (on/off)
var collapseprevious="no" //Collapse previously open content when opening present? (yes/no)

if (document.getElementById){
document.write('<style type="text/css">')
//document.write('.switchcontent{display:none;}')//
document.write('.switchcontent{display:none;}')
document.write('</style>')
}

function getElementbyClass(classname){
ccollect=new Array()
var inc=0
var alltags=document.all? document.all : document.getElementsByTagName("*")
for (i=0; i<alltags.length; i++){
if (alltags[i].className==classname)
ccollect[inc++]=alltags[i]
}
}

function contractcontent(omit){
var inc=0
while (ccollect[inc]){
if (ccollect[inc].id!=omit)
ccollect[inc].style.display="none"
inc++
}
}

function expandcontent(cid){
if (typeof ccollect!="undefined"){
if (collapseprevious=="yes")
contractcontent(cid)
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
}
}

function revivecontent(){
contractcontent("omitnothing")
selectedItem=getselectedItem()
selectedComponents=selectedItem.split("|")
for (i=0; i<selectedComponents.length-1; i++)
document.getElementById(selectedComponents[i]).style.display="block"
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function getselectedItem(){
if (get_cookie(window.location.pathname) != ""){
selectedItem=get_cookie(window.location.pathname)
return selectedItem
}
else
return ""
}

function saveswitchstate(){
var inc=0, selectedItem=""
while (ccollect[inc]){
if (ccollect[inc].style.display=="block")
selectedItem+=ccollect[inc].id+"|"
inc++
}

document.cookie=window.location.pathname+"="+selectedItem
}

function do_onload(){
uniqueidn=window.location.pathname+"firsttimeload"
getElementbyClass("switchcontent")
if (enablepersist=="on" && typeof ccollect!="undefined"){
document.cookie=(get_cookie(uniqueidn)=="")? uniqueidn+"=1" : uniqueidn+"=0" 
firsttimeload=(get_cookie(uniqueidn)==1)? 1 : 0 //check if this is 1st page load
if (!firsttimeload)
revivecontent()
}
}


if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload

if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitchstate

//-->


// GOOGLE MAP

    //<![CDATA[

    function load() {
      if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        //map.setCenter(new GLatLng(43.634367,-79.689074), 13);
		map.setCenter(new GLatLng(43.622889,-79.669847), 13);

		// Creates a marker at the given point with the given number label
			function createMarker(point, AddInfo) {
			  var marker = new GMarker(point);
			  GEvent.addListener(marker, "mouseover", function() {
				marker.openInfoWindowHtml(AddInfo);
			  });
			  return marker;
			}

			var point= new GLatLng(43.634367,-79.689074);
			map.addOverlay(createMarker(point, "<b>Grace Methodist - Worhip Centre</b><br /><small> 1 World Drive, Mississauga, Ontario CANADA<br />Telephone Number: 905.696.2216<br />By Bus - Route 19 from Square One</small>"));
			var point= new GLatLng(43.602024,-79.640386);
			map.addOverlay(createMarker(point, "<b>Grace Methodist - Office</b><br /><small>Lower Level, 4315 Village Square Court,<br />Mississauga, Ontario - L4Z 1S2<br />Telephone Number: 905.696.2216<br />Email : <a href='mailto:graceadmin@gracemethodist.ca'>graceadmin@gracemethodist.ca</a>"));
			var point= new GLatLng(43.597736,-79.641953);
			map.addOverlay(createMarker(point, "<b>Square One Shopping Centre</b><br /><small>By Bus - Route 19 One</small>"));
        }
    }

    //]]>

