﻿function StartPage() {
    window.defaultStatus='Welcome to the Truro Council on Aging';
}
function SendMail(name, subject){
    document.location.href='mailto:'+name+'@truro-ma.gov?subject='+subject;
}
function FooterWrite(){
var today_date = new Date();
var year = today_date.getFullYear();
var last_change_length = document.lastModified.length;
var last_change = document.lastModified.substr(0, last_change_length -3);
var cText='<hr size="2" color="#000FF" width="95%" /><p class="Footer">Questions, Comments or Suggestions: <a href="mailto:coa@truro-ma.gov?subject=Comment from Web Site: ">webmaster</a><br />Copyright&copy; ' + year +' Truro Council on Aging - All Rights Reserved<br />Last Page Update: ' + last_change + '</p>';
document.write(cText);
}
function PDFOpen(Location, GoogleAnPath){
//OpenPDFs in new window and count them
	w=window.open(Location,'FromTruro', 'resizable=1, scrollbars=1, height=768,width=800');
	_gaq.push(['_trackPageview','/Documents/' + GoogleAnPath]);
	w.focus();
}
function URLOpen(URL, GoogleAnPath){
//URLOpen in new window and count them
	if (URL.indexOf('http://') < 0){
		URL = 'http://' + URL;
	}
	w=window.open(URL,'FromTruro', 'resizable=1, scrollbars=1, height=768,width=800');
	_gaq.push(['_trackPageview','/Links/' + GoogleAnPath]);
	w.focus();
}
function MapIt(Street, City, State, Zip) {
// Open Bing Map in New Window & Count It
	URL = 'http://bing.com/maps/default.aspx?where1=' + Street + ',' + City + ',' + State + ',' + Zip + ',USA';
	WindowResult=window.open(URL,'FromTruro', 'height=800, width=1024, resizable=yes, scrollbars=yes, status=yes, toolbar=yes');
	_gaq.push(['_trackPageview','/Links/BingMaps']);
	WindowResult.focus();
}
function Popup(Url, Features, Replace){
    window.open(Url,'random', Features);
    _gaq.push(['_trackPageview','/Popup/' + GoogleAnPath])
    return;
}
// Open file in Window, but skip select option
function OpenChoice(FiletoOpen, LogEntry) {
    if (FiletoOpen != '' && FiletoOpen != 'NewsLetters/') {
        _gaq.push(['_trackPageview','/Documents/' + LogEntry]);
        if (FiletoOpen.indexOf("http") >= 0) {
            window.open(FiletoOpen);
        } else {
            location.href = FiletoOpen;
        }
    }
}
// Notify user leaving truro-ma.gov & count it
function NotifySiteExit(URL, GoogleAnPath) {
	if (URL.indexOf('http://') < 0){
		URL = 'http://' + URL;
	}
	if (confirm("You have clicked on a link to a web site not part of www.truro-ma.gov:\n\n" + URL + "\n\nClick 'OK' to continue there, or 'Cancel' to stay here.")) {
			w=window.open(URL,'FromTruro', 'resizable=1, scrollbars=1, height=768,width=800');
			_gaq.push(['_trackPageview','/Links/' + GoogleAnPath]);
			w.focus();
	} else {
		alert("'Cancel' was clicked to stay here.");
	}
}
//Open NameURL in new window if not on our site
function OpenDoc(NameURL){
    if (NameURL != ''){
        if((NameURL.indexOf("http") >= 0) ||
        (NameURL.indexOf(".pdf")) >= 0){
            window.open(NameURL);
            }
        else{
            location.href=NameURL
            }
        }
}
