﻿// a window opener
function pdfWindow2(info) {
    contentWindow = window.open(info, "aWindow", "location=0,width=815,height=675,scrollbars=yes,resizable=yes,screenX=400,screenY=400,top=400,left=400")
    contentWindow.focus()
}

// another window opener
function agendaWindow(info) {
    contentWindow = window.open(info, "aWindow", "location=0,width=815,height=675,scrollbars=yes,resizable=yes,screenX=400,screenY=400,top=400,left=400")
    contentWindow.focus()
}

// disclaimer window opener
function disclaimerWindow(info) {
    contentWindow = window.open(info, "aWindow", "location=0,width=515,height=415,scrollbars=yes,resizable=yes,screenX=400,screenY=400,top=400,left=400")
    contentWindow.focus()
}

// never can have too many window openers!
function rssWindow(info) {
    contentWindow = window.open(info, "aWindow", "location=0,width=575,height=515,scrollbars=yes,resizable=yes,screenX=400,screenY=400,top=400,left=400")
    contentWindow.focus()
}

// HR gets a window opener, too
function menuVacanciesWindow(info) {
    contentWindow = window.open(info, "aWindow", "location=0,width=650,height=655,scrollbars=yes,resizable=yes,screenX=400,screenY=400,top=400,left=400")
    contentWindow.focus()
}

// photo info window opener
function photoWindow(info) {
    contentWindow = window.open(info, "aWindow", "location=0,width=660,height=650,scrollbars=yes,resizable=yes,screenX=400,screenY=400,top=400,left=400")
    contentWindow.focus()
}

// switch stylesheets
function switchStylesheets(stylesheetHref) {
    document.getElementById("stylesheetLink").href = stylesheetHref;
    document.getElementById("stylesheetNameSpan").innerHTML = stylesheetHref;
}

// make columns equal height
function makeEqual() {
    var middleHeight = document.getElementById("content").offsetHeight;
    document.getElementById("leftBox").style.height = middleHeight + 50 + "px";
    var leftHeight = document.getElementById("leftBox").offsetHeight;
    document.getElementById("rightBox").style.height = (leftHeight - 10) + "px";
}

// close the selected calendar box
function closeCalendarItemsWindow() {
    document.getElementById("selectedCalendarItemsWindow").style.display = "none";
}

// test the selected calendar box
function testCalendarItemsWindow() {
    var strCloseText = "[x] Close";
    var strBoxText = document.getElementById("selectedCalendarItemsWindow").innerHTML;
    var pos = strBoxText.indexOf(strCloseText);
    if (pos < 0) {
        document.getElementById("selectedCalendarItemsWindow").style.display = "none";
    } else {
        document.getElementById("selectedCalendarItemsWindow").style.display = "block";
    }
}

// off site alert
function offSiteAlerter_HOME() {
    var go = confirm("You are about to leave the Frederick County website.\r\n\r\nWhen you leave the Frederick County website, Frederick County\'s website privacy policy does not apply to any page you view or any subsequent links. This link from the Frederick County website is offered for your convenience and does not constitute an endorsement of any organizations, programs, people, or content on the destination site.");
    if (go) {
        return true;
    }
    else {
        return false;
    }
    /*
    var pageTitle = document.title.replace(/Frederick County, VA -- /, "Frederick County ");
    $("a").leaveNotice({
		        linkString: 'target="_blank" class="leaveLink" id="leaveLink"',
		        siteName: pageTitle,
		        exitMessage: "<h3>You are about to leave the {SITENAME} website.</h3><p class='disclaimerText'>When you leave the Frederick County website, Frederick County's website privacy policy does not apply to any page you view or any subsequent links. This link from the Frederick County website is offered for your convenience and does not constitute an endorsement of any organizations, programs, people, or content on the destination site.</p>",
		        preLinkMessage: "<p>Continue to:<br/><strong>{URL}</strong></p>",
		        timeOut: "0",
		        overlayAlpha: .7
	        });
	*/
}


// hide the ie 6 update test label
function hideLabel() {
    document.getElementById("lblIPTest").style.visibility = "hidden";
}

// window opener for the voter registration search
function precinctWindow(info) {
	contentWindow = window.open(info, "aWindow", "location=0,width=650,height=420,scrollbars=yes,resizable=yes,screenX=400,screenY=400,top=400,left=400")
	contentWindow.focus()
}

// redirect for comment form
function goComment() {
	var thisPage = window.location.href;
	window.location = "http://www.co.frederick.va.us/apps/PageHelpful/Default.aspx?refer=" + thisPage;
}		

// the disclaimer for Google survey
function gAlert()
{
	var pageTitle = document.title.replace(/Frederick County, VA -- /, "Frederick County ");
	alert("Links in the Google form will direct you away from the " + pageTitle + " website.\r\n\r\nWhen you leave the Frederick County website, Frederick County\'s website privacy policy does not apply to any page you view or any subsequent links. This link from the Frederick County website is offered for your convenience and does not constitute an endorsement of any organizations, programs, people, or content on the destination site.");
}

// AddThis disclaimer
function addThisAlert() {
    var pageTitle = document.title.replace(/Frederick County, VA -- /, "Frederick County ");
    alert("Clicking the AddThis buttons will take you away from the " + pageTitle + " website.\r\n\r\nWhen you leave the Frederick County website, Frederick County\'s website privacy policy does not apply to any page you view or any subsequent links. This link from the Frederick County website is offered for your convenience and does not constitute an endorsement of any organizations, programs, people, or content linked on the destination site.");
}

// loading iframe weather...
function testIframe() {
    document.getElementById("loadingText").style.display = "none";
}
