﻿<!--
var choirPwrd = 'sing';
var colorMode = 'Color';

function FP_changeProp() {//v1.0
 var args=arguments,d=document,i,j,id=args[0],o=FP_getObjectByID(id),s,ao,v,x;
 d.$cpe=new Array(); if(o) for(i=2; i<args.length; i+=2) { v=args[i+1]; s="o"; 
 ao=args[i].split("."); for(j=0; j<ao.length; j++) { s+="."+ao[j]; if(null==eval(s)) { 
  s=null; break; } } x=new Object; x.o=o; x.n=new Array(); x.v=new Array();
 x.n[x.n.length]=s; eval("x.v[x.v.length]="+s); d.$cpe[d.$cpe.length]=x;
 if(s) eval(s+"=v"); }
}

function FP_getObjectByID(id,o) {//v1.0
 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
 else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
 if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
 for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
 f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
 for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
 return null;
}

function FP_changePropRestore() {//v1.0
 var d=document,x; if(d.$cpe) { for(i=0; i<d.$cpe.length; i++) { x=d.$cpe[i];
 if(x.v=="") x.v=""; eval("x."+x.n+"=String(x.v)"); } d.$cpe=null; }
}

function FP_highliteDate(idDate) {//v1.0
 var idDate = 'Date' + idDate.substring(4) 
 FP_changeProp(idDate,1,'style.background','#fff26c');
 var idMess = 'Mess' + idDate.substring(4) + 'a';
 FP_changeProp(idMess,1,'style.background','#fff26c');
 var idMess = 'Mess' + idDate.substring(4) + 'b';
 FP_changeProp(idMess,1,'style.background','#fff26c');
}

function FP_restoreDate(idDate) {//v1.0
 var idDate = 'Date' + idDate.substring(4) 
 FP_changeProp(idDate,1,'style.background','none');
 var idMess = 'Mess' + idDate.substring(4) + 'a';
 FP_changeProp(idMess,1,'style.background','none');
 var idMess = 'Mess' + idDate.substring(4) + 'b';
 FP_changeProp(idMess,1,'style.background','none');
}

function FP_goToURL(url) {//v1.0
  var sPath	 = window.location.pathname;
  var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
  var sPag4 = sPage.substring(0, 2);
  //alert("sPath.."+sPath+"  --  sPage.."+sPage+"  --  sPag4.."+sPag4+" --");
  if (sPag4 == "20") {
  	url = "../"+url;
  } 
  window.location = url;
}

function FP_popUpURL(url) {//v1.0
  window.location = url;
    <!-- var ww = document.body.clientWidth, wh = document.body.clientHeight; -->
    var ww = 1300, wh = 900;
    var w  = 1000, h  = 800;
    var leftPos = (ww-w)/2, topPos = (wh-h)/2;
    var win = window.open(url, 'ffPrint', 
       'width=' + w + ', height=' + h + ', ' +
       'left=' + leftPos + ', top=' + topPos + ', ' +
       'location=no, menubar=no, ' +
       'status=no, toolbar=yes, scrollbars=yes, resizable=yes');
    win.resizeTo(w, h);
    win.focus();
    return false;
}

function Ev_changeProp() {//v1.0
 var args=arguments,d=document,i,j,id=args[0],o=FP_getObjectByID(id),s,ao,v,x;
 d.$cpe=new Array(); if(o) for(i=2; i<args.length; i+=2) { v=args[i+1]; s="o"; 
 ao=args[i].split("."); for(j=0; j<ao.length; j++) { s+="."+ao[j]; if(null==eval(s)) { 
  s=null; break; } } x=new Object; x.o=o; x.n=new Array(); x.v=new Array();
 x.n[x.n.length]=s; eval("x.v[x.v.length]="+s); d.$cpe[d.$cpe.length]=x;
 if(s) eval(s+"=v"); }
}

function Ev_getObjectByID(id,o) {//v1.0
 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
 else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
 if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
 for(n=0; n<c.length; n++) { el=Ev_getObjectByID(id,c[n]); if(el) return el; }
 f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
 for(m=0; m<els.length; m++){ el=Ev_getObjectByID(id,els[n]); if(el) return el; } }
 return null;
}

function Ev_changePropRestore() {//v1.0
 var d=document,x; if(d.$cpe) { for(i=0; i<d.$cpe.length; i++) { x=d.$cpe[i];
 if(x.v=="") x.v=""; eval("x."+x.n+"=String(x.v)"); } d.$cpe=null; }
}

function Ev_goToURL(url) {//v1.0
  var urla = url.split(".");
  var urlt = urla.pop();
  if (urlt=="pps" || urlt=="pdf" || urlt=="flv" || urlt=="avi" || urlt=="swf") {
  	window.open(url);
  }
  else {
  	var sPath	 = window.location.pathname;
  	var w = document.body.clientWidth, h = document.body.clientHeight;
  	var popw = 720, poph = 640;
  	var leftPos = (w-popw)/2, topPos = (h-poph)/2;  
  	window.open("eventswindow.asp?event="+url, "EventsWindow", "width=" + popw + ",height=" + poph
  	    + ",toolbar=0,menubar=1,scrollbars=1,status=0,resizable=1,location=0,top=" + topPos + ",left=" + leftPos);
  }
  return false;
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function mapWindow(url, name, w, h) {
    <!-- var ww = document.body.clientWidth, wh = document.body.clientHeight; -->
    var ww = 1300, wh = 800;
    var leftPos = (ww-w)/2, topPos = (wh-h)/2;
    var win = window.open(url, name, 
       'width=' + w + ', height=' + h + ', ' +
       'left=' + leftPos + ', top=' + topPos + ', ' +
       'location=no, menubar=no, ' +
       'status=no, toolbar=no, scrollbars=no, resizable=no');
    win.resizeTo(w, h);
    win.focus();
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		img_church = newImage("Images/church.jpg");
		img_church_banner = newImage("Images/church_banner.jpg");
		img_church_front = newImage("Images/church_front.jpg");
		img_church_sidebar = newImage("Images/church_sidebar.jpg");
		img_InfoBox_bg = newImage("Images/InfoBox_bg.jpg");
		img_Sidebar_bg = newImage("Images/Sidebar_bg.jpg");
		img_StaffBox_bg = newImage("Images/StaffBox_bg.jpg");
		preloadFlag = true;
	}
}

function doSubmit() {
   if (pick.doAction.value == 'SaintDay') {
   	  SaintDays();
   }
   if (pick.doAction.value == 'Edit') {
   	  EditDays();
   }
}

function SaintDays() {
   var setBlock;
   if (pick.setBlock.value == null) {
      now = new Date();
      nowYr = now.getFullYear();
      nowMo = now.getMonth() + 1;
      nowDa = now.getDate();
      if (nowMo < 10) {
         nowMo = ("0" + nowMo);
      }
      setBlock = (nowYr + '' + nowMo + '' + nowDa);
      <!-- alert("setBlock.." + setBlock); -->
   }
   else {
      setBlock = pick.setBlock.value+'';
   }
   var setMonth = setBlock.substring(4, 6);
   var mm = parseInt(setMonth,10) - 1;
   var tabMonths = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
   <!-- alert("setBlock=" + pick.setBlock.value + " .. setMonth=" + setMonth + " .. mm=" + mm + " .. tabMonths=" + tabMonths[mm]); -->
   var setDay = setBlock.substring(6);
   <!-- if (setDay < 10) { setDay = setDay.substring(1); } -->
   pick.action = ("http://www.catholic.org/saints/sofd.php?month=" + tabMonths[mm] + "&day=" + setDay);
   <!-- alert("action.." + pick.action); -->
   return true;
}

function EditDays() {
   var callPgm = ("CKEcaledit.asp?Day=" + pick.setBlock.value);
   var w = document.body.clientWidth, h = document.body.clientHeight;
   var popw = 600, poph = 500;
   var leftPos = (w-popw)/2, topPos = (h-poph)/2;
   window.open(callPgm, "EditCal", "width=" + popw + ",height=" + poph
       + ",toolbar=0,menubar=0,scrollbars=1,status=0,resizable=0,location=0,top=" + topPos + ",left=" + leftPos);
   return true;
}


function showCalendar() {
   var shortMonths = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
   var now = new Date();
   var nowMo = now.getMonth()+1;
   var nowMo2 = nowMo;
   if (nowMo < 10) { nowMo2 = ("0" + nowMo) };
   var nowYr = now.getFullYear();
   var callTo = ("/*href*/../calendar/" + nowYr + "_" + nowMo2 + "_" + shortMonths[nowMo-1] + ".asp")
   FP_goToURL(callTo);
}

function printMsg() {
alert("Calendars print best when set to Landscape and resized to 90%   ")
}

function setColorMode() {
	if (colorMode == "B&W") {
		colorMode = "Color";
		fConn.ColorMode.value = "Black&White";
	}
	else {
		colorMode = "B&W"
		fConn.ColorMode.value = "Color";
	}
}
function setFConnMode(fConnURL) {
	if (colorMode == "Color") {
		window.location.href = "FaithConnection/FC_" + fConnURL;
	}
	else {
		window.location.href = "FaithConnection/FCbw_" + fConnURL;
	}
}	

// -->

