/* 
 Al Payson Scripts File
*/
function xCoord(id) {
	object=document.getElementById(id);
	xc=parseInt(object.style.left);
	return xc;
	}	
function yCoord(id) {
	object=document.getElementById(id);
	yc=parseInt(object.style.top);
	return yc;
	}
function hideIt(id) {
	object=document.getElementById(id);
	object.style.visibility="hidden";
	}
function placeIt(id, x, y) {
	object=document.getElementById(id);
	object.style.left=x+"px";
	object.style.top=y+"px";
	}
function shiftIt(id, dx, dy) {
	object=document.getElementById(id);
	object.style.left=xCoord(id)+dx+"px";
	object.style.top=yCoord(id)+dy+"px";
	}
function showIt(id) {
	object=document.getElementById(id);
	object.style.visibility="visible";
	}	
function winWidth() {
	if (window.innerWidth) return window.innerWidth;
	else if (document.documentElement) return document.documentElement.offsetWidth;
	else if (document.body.clientWidth) return document.body.clientWidth;
	}
function winHeight() {
	if (window.innerHeight) return window.innerHeight;
	else if (document.documentElement) return document.documentElement.offsetHeight;
	else if (document.body.clientHeight) return document.body.clientHeight;
	}
function getFontSize(id) {
	object=document.getElementById(id);
	fs=parseInt(object.style.fontSize);
	return fs;
	}
function changeFontSize(id, dfs) {
	fs=getFontSize(id);
	setFontSize(id, (fs+dfs));
	}
function setFontSize(id, fs) {
	object=document.getElementById(id);
	object.style.fontSize= fs +"pt";
	}
        var BannerOff= new Image();
                BannerOff.src="images/buttons/AlPaysonMidNightSnackWh.gif"
        var BannerOn= new Image();
                BannerOn.src="images/buttons/AlPaysonMidNightSnackRed.gif"
	var HomeOff= new Image();
		HomeOff.src="images/buttons/HomeWh.gif"
	var HomeOn= new Image();
		HomeOn.src="images/buttons/HomeRed.gif"		
	var AudioOff= new Image();
		AudioOff.src="images/buttons/AudioWh.gif"
	var AudioOn= new Image();			
		AudioOn.src="images/buttons/AudioRed.gif"
	var BioOff= new Image();
		BioOff.src="images/buttons/BioWh.gif"
	var BioOn= new Image();
		BioOn.src="images/buttons/BioRed.gif"	
	var SchedOff= new Image();
		SchedOff.src="images/buttons/SchedWh.gif"
	var SchedOn= new Image();
		SchedOn.src="images/buttons/SchedRed.gif"
	var PicsOff= new Image();
		PicsOff.src="images/buttons/PicsWh.gif"
	var PicsOn= new Image();
		PicsOn.src="images/buttons/PicsRed.gif"
	var EbayOff= new Image();
		EbayOff.src="images/logos/EbayWh.jpg"
	var EbayOn= new Image();
		EbayOn.src="images/logos/EbayRed.jpg"
	var ServicesOff= new Image();
		ServicesOff.src="images/buttons/ServicesWh.gif"
	var ServicesOn= new Image();
		ServicesOn.src="images/buttons/ServicesRed.gif"
	var FaceBookOff= new Image();
		FaceBookOff.src="images/logos/FaceBookWh.jpg"
	var FaceBookOn= new Image();
		FaceBookOn.src="images/logos/FaceBookRed.jpg"
	var MySpaceOff= new Image();
		MySpaceOff.src="images/logos/MySpaceWh.jpg"
	var MySpaceOn= new Image();
		MySpaceOn.src="images/logos/MySpaceRed.jpg"
	var YouTubeOff= new Image();
		YouTubeOff.src="images/logos/YouTubeWh.jpg"
	var YouTubeOn= new Image();
		YouTubeOn.src="images/logos/YouTubeRed.jpg"
	var AddressOff= new Image();
		AddressOff.src="images/buttons/AddressWh.gif"
	var AddressOn= new Image();
		AddressOn.src="images/buttons/AddressRed.gif"
	var EmailOff= new Image();
		EmailOff.src="images/buttons/EmailWh.gif"
	var EmailOn= new Image();
		EmailOn.src="images/buttons/EmailRed.gif"
	var OnlineRaceOff= new Image();
		OnlineRaceOff.src="images/buttons/OnlineRaceWh.gif"
	var OnlineRaceOn= new Image();
		OnlineRaceOn.src="images/buttons/OnlineRaceRed.gif"
        var LinksOff= new Image();
                LinksOff.src="images/buttons/LinksWh.gif"
        var LinksOn= new Image();
                LinksOn.src="images/buttons/LinksRed.gif"
        var MusiciansOff= new Image();
                MusiciansOff.src="images/buttons/MusiciansWh.gif"
        var MusiciansOn= new Image();
                MusiciansOn.src="images/buttons/MusiciansRed.gif"
        var Gallery1Off= new Image();
		Gallery1Off.src="images/buttons/Gallery1Wh.gif"
	var Gallery1On= new Image();
		Gallery1On.src="images/buttons/Gallery1Red.gif"
        var Gallery2Off= new Image();
		Gallery2Off.src="images/buttons/Gallery2Wh.gif"
	var Gallery2On= new Image();
		Gallery2On.src="images/buttons/Gallery2Red.gif"
        var Gallery3Off= new Image();
		Gallery3Off.src="images/buttons/Gallery3Wh.gif"
	var Gallery3On= new Image();
		Gallery3On.src="images/buttons/Gallery3Red.gif"
        var Gallery4Off= new Image();
		Gallery4Off.src="images/buttons/Gallery4Wh.gif"
	var Gallery4On= new Image();
		Gallery4On.src="images/buttons/Gallery4Red.gif"
        var SkypeOff= new Image();
		SkypeOff.src="images/logos/skypeWh.jpg"
	var SkypeOn= new Image();
		SkypeOn.src="images/logos/skypeRed.jpg"

        var HomeFootOff= new Image();
		HomeFootOff.src="images/buttons/HomeFootOff.gif"
	var HomeFootOn= new Image();
		HomeFootOn.src="images/buttons/HomeFootOn.gif"		
	var AudioFootOff= new Image();
		AudioFootOff.src="images/buttons/AudioFootOff.gif"
	var AudioFootOn= new Image();			
		AudioFootOn.src="images/buttons/AudioFootOn.gif"
        var BioFootOff= new Image();
		BioFootOff.src="images/buttons/BioFootOff.gif"
	var BioFootOn= new Image();			
		BioFootOn.src="images/buttons/BioFootOn.gif"        
        var PicsFootOff= new Image();
		PicsFootOff.src="images/buttons/PicsFootOff.gif"
	var PicsFootOn= new Image();
		PicsFootOn.src="images/buttons/PicsFootOn.gif"
        var SchedFootOff= new Image();
		SchedFootOff.src="images/buttons/SchedFootOff.gif"
	var SchedFootOn= new Image();
		SchedFootOn.src="images/buttons/SchedFootOn.gif"
        var LinksFootOff= new Image();
                LinksFootOff.src="images/buttons/LinksFootOff.gif"
        var LinksFootOn= new Image();
                LinksFootOn.src="images/buttons/LinksFootOn.gif"
        var MusiciansFootOff= new Image();
                MusiciansFootOff.src="images/buttons/MusiciansFootOff.gif"
        var MusiciansFootOn= new Image();
                MusiciansFootOn.src="images/buttons/MusiciansFootOn.gif"
        var ServicesFootOff= new Image();
		ServicesFootOff.src="images/buttons/ServicesFootOff.gif"
	var ServicesFootOn= new Image();
		ServicesFootOn.src="images/buttons/ServicesFootOn.gif" 
        var EmailFootOff= new Image();
		EmailFootOff.src="images/buttons/EmailFootOff.gif"
	var EmailFootOn= new Image();
		EmailFootOn.src="images/buttons/EmailFootOn.gif"       
function on(img) {
    document[img].src = eval(img+'on').src;
    }
function off(img) {
    document[img].src = eval(img+'off').src;
    }

function openNewSmWindow(url){
window.open(url,"newsmwindow","width=500,height=400");
}
function openNewLgWindow(url){
window.open(url,"newlgwindow","width=1280,height=1024,toolbar=yes,menubar=yes,scrollbars=yes,resizable=yes");
}
  
function nameDefined(ckie,nme)
{
   var splitValues
   var i
   for (i=0;i<ckie.length;++i)
   {
      splitValues=ckie[i].split("=")
      if (splitValues[0]==nme) return true
   }
   return false
}

function delBlanks(strng)
{
   var result=""
   var i
   var chrn
   for (i=0;i<strng.length;++i) {
      chrn=strng.charAt(i)
      if (chrn!=" ") result += chrn
   }
   return result
}
function getCookieValue(ckie,nme)
{
   var splitValues
   var i
   for(i=0;i<ckie.length;++i) {
      splitValues=ckie[i].split("=")
      if(splitValues[0]==nme) return splitValues[1]
   }
   return ""
}
function insertCounter() {
 readCookie()
 displayCounter()
}
 function displayCounter() {
 document.write('<H5 ALIGN="CENTER">')
 document.write("You've visited this page ")
 if(counter==1) document.write("the first time.")
 else document.write(counter+" times.")
 document.writeln('</H3>')
 }
function readCookie() {
 var cookie=document.cookie
 counter=0
 var chkdCookie=delBlanks(cookie)  //are on the client computer
 var nvpair=chkdCookie.split(";")
 if(nameDefined(nvpair,"pageCount"))
 counter=parseInt(getCookieValue(nvpair,"pageCount"))
 ++counter
 var futdate = new Date()
 var expdate = futdate.getTime()
 expdate += 3600000 * 24 *30  //expires in 1 hour
 futdate.setTime(expdate)

 var newCookie="pageCount="+counter
 newCookie += "; expires=" + futdate.toGMTString()
 window.document.cookie=newCookie
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}          
/*  GOOGLE ANALYTICS CODE BELOW
var _gaq = _gaq || [];
                _gaq.push(['_setAccount', 'UA-4822616-1']);
                _gaq.push(['_trackPageview']);

                (function() {
                var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
                ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
                var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
                })();
*/    
