// JavaScript Document
// Contains: PreLoad, Switch Image, Detail ToolTip, emailTo,
// Menu Template VERTICAL, Menu Template HORIZONTAL, Menu Items, Menu.js


// Preload
// page's body tag to have -> onload="Preload( 'IMG URL1', 'IMG URL2' )" - Two Shown, Can Be More
function Preload()
{ 
  var args = Preload.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++)
  {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }
}


// Switch Image
var img_count=1  
function switchImage(object_name,img_group,img_type,num_images) 
{ 
  if (document.images)
  {
    if (img_count<num_images) 
      {	    
	  img_count++
	  source_name= img_group+img_count+"."+img_type
	  document.images[object_name].src = source_name;
	  return
	  }
	  
	  {
      img_count=1
	  source_name= img_group+img_count+"."+img_type
	  document.images[object_name].src = source_name;
	  return
	  }	
	  
	}
  }


// Detail ToolTip
/***********************************************
* Fixed ToolTip script- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
// Script Call from web page is: <a href="ENTER HREF HERE, OR DELETE THE HREF="" IF NONE" onMouseover="fixedtooltip('ENTER TOOLTIP TEXT AND TAGS FOR<b>WANTED TOOLTIP</b> DISPLAY', this, event, '150px')" onMouseout="delayhidetip()">ENTER LINK TEXT HERE</a>
// where the first parameter of "fixedtooltip()" is the tooltip text, and the final parameter ("150px"),
// which is an optional string you pass in to modify this particular tooltip's width, if different from the default tooltip width.
// Enter a blank string instead ("") if the tooltip width will be the same as the default width specified in the global variable
// near the top of the script.
	
var tipwidth='150px' //default tooltip width
var tipbgcolor='lightyellow'  //tooltip bgcolor
var disappeardelay="250"  //tooltip disappear speed onMouseout (in miliseconds)
var vertical_offset="10px" //horizontal offset of tooltip from anchor link
var horizontal_offset="0px" //horizontal offset of tooltip from anchor link

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="fixedtipdiv" style="visibility:hidden;width:'+tipwidth+';background-color:'+tipbgcolor+'" ></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, tipwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (tipwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=tipwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
}
return edgeoffset
}

function fixedtooltip(menucontents, obj, e, tipwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidetip()
dropmenuobj=document.getElementById? document.getElementById("fixedtipdiv") : fixedtipdiv
dropmenuobj.innerHTML=menucontents

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", tipwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}
}

function hidetip(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidetip(){
if (ie4||ns6)
delayhide=setTimeout("hidetip()",disappeardelay)
}

function clearhidetip(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}


// Email To
function email(where)
{
if (where=="office") office()
if (where=="cs") officeCareandShare()
if (where=="pr") officePrayerRequest()
if (where=="manager") manager()
if (where=="ppsubscribe") ppsubscribe()
if (where=="pastor") pastor()
if (where=="beacon") beacon()
}
function office()
{             
self.location="mailto:office.dundeeumc@frontier.com"
}
function officeCareandShare()
{
self.location="mailto:office.dundeeumc@frontier.com?subject=Caring and Sharing"
}
function officePrayerRequest()
{
self.location="mailto:office.dundeeumc@frontier.com?subject=Prayer Request"
}
function manager()
{
self.location="mailto:Site Manager <webmaster.dundeeumc@frontier.com>?Subject=Dundee UMC Web Site"
}
function ppsubscribe()
{
alert ('The Email address used will be the one shown in the FROM field of this request. If you want a different address used, please type it in the body of the message')	
self.location="mailto:pastorpage.dundeeumc@verizon.net?subject=Pastor's Page Subscription Request&body=Please add me to the Pastor's Page Email Subscribers list."
}
function pastor()
{             
self.location="mailto:Rev. Doug <revolsen.dundeeumc@frontier.com>"
}
function beacon()
{             
self.location="mailto:Mary Sandefur <beacon.dundeeumc@frontier.com>"
}




