function SelectThisStyle(objThis) {
    if ((objThis.className == "MenuTDNoTopNoBottom") || (objThis.className == "MenuTDNoTop")) {
        objThis.oldClass = objThis.className;
        objThis.className = "MenuTDIsSelected";
        objThis.cursor = "hand";
        objThis.title = "Select This Camp Area";
        objThis.toolTip = "Select This Camp Area";

    }
}

function UnSelectThisStyle(objThis) {
    if (objThis.className == "MenuTDIsSelected")
        objThis.className = objThis.oldClass;
    objThis.cursor = "default";
}

function ChangeSearchPage(objThis) {
    var tdID = objThis.id;
    var g_UnSecureUrl = document.forms[0]._ctl0_LeftMenu1_hidUnSecureUrl.value;
    var g_SecureUrl = document.forms[0]._ctl0_LeftMenu1_hidSecureUrl.value;
    
    switch (tdID) {
        case "TDHome":
            //location.replace("Index.aspx?main=1");
            location.replace(g_UnSecureUrl + "Default.aspx");
            break;

        case "TDRegion":
            location.replace(g_UnSecureUrl + "SearchRegion.aspx");
            break;

        case "TDFacility":
            location.replace(g_UnSecureUrl + "SearchAmenity.aspx?reg=0");
            break;

        case "TDPARK":
            location.replace(g_UnSecureUrl + "SearchPark.aspx");
            break;
        case "TDHReservation":
            location.replace(g_UnSecureUrl + "SearchHarborPark.aspx");
            break;
        case "TDGenAvail":
            location.replace(g_UnSecureUrl + "GeneralAvailability.aspx");
            break;

        case "TDCMaps":
            location.replace(g_UnSecureUrl + "ParkCampgroundMap.aspx");
            break;
        case "TDADA":
            location.replace(g_UnSecureUrl + "Adacampsites.aspx");
            break;
        case "TDAreas":
            window.open("http://www.michigandnr.com/parksandtrails/listing.aspx?list=parks");

            break;
        case "TDInfo":
            window.open("http://www.michigandnr.com/ParksandTrails/parkmap.aspx");

            break;
        case "TDEstone":
            window.open("http://apps.michigan.gov/MichiganeStore/public/Home.aspx");

            break;
        case "TDFAQ":
            window.open("http://midnr.custhelp.com/cgi-bin/MiDNR.cfg/php/enduser/std_alp.php?&p_lva=&p_li=&p_page=1&p_prod_lvl1=3&p_prod_lvl2=81&p_search_text=&p_new_search=1&p_search_type=3&p_sort_by=dflt");

            break;
        case "TDHMap":
            window.open("http://www.michigan.gov/dnr/0,1607,7-153-10365_10884_11576-238175--,00.html");

            break;
        case "TDBoatingInfo":
            window.open("http://www.michigan.gov/dnr/1,1607,7-153-10365_10884---,0.html");

            break;
        case "TDSecurity":
            location.replace(g_UnSecureUrl + "Security.aspx");
            break;
        case "TDAlerts":
            location.replace("Includes/EABFirewoodPoster.pdf");
            break;
        case "TDCustomerProfile":
            location.replace(g_SecureUrl + "ChangeRegister.aspx");
            break;
        case "TDRHistory":
            location.replace(g_UnSecureUrl + "ReservationHistory.aspx");
            break;
        case "TDGIFTCARD":
            location.replace(g_SecureUrl + "GiftCardBalance.aspx");
            break;
        case "TDPassword":
            location.replace(g_SecureUrl + "ForgotPwd.aspx");
            break;
        default:
            location.replace(g_UnSecureUrl + "Default.aspx");
            break;
    }
}

function CheckedItemInList(objThis) {
    objThis.className = "CheckedItemInList";
}

function HighLight(objThis) {
    objThis.className = "GrayRow";
}
function UnHighLight(objThis) {
    objThis.className = '';
}

function FocusOnTagOfType(typeofFormElem, pos) {
    var arrFormsCollection = document.getElementsByTagName(typeofFormElem);
    if (arrFormsCollection.length > parseInt(pos)) {
        arrFormsCollection[pos].focus();
    }

}
function testCookies() {
    var exp = new Date();
    exp.setTime(exp.getTime() + 1800000);
    // first write a test cookie 
    setCookie("cookies", "cookies", exp, false, false, false);
    if (document.cookie.indexOf('cookies') != -1) {
        return true;
    }
    else {
        return false;
    }
    // now delete the test cookie 
    exp = new Date();
    exp.setTime(exp.getTime() - 1800000);
    setCookie("cookies", "cookies", exp, false, false, false);
}

function setCookie(name, value, expires, path, domain, secure) {
    var curCookie = name + "=" + escape(value) +
		((expires) ? "; expires=" + expires.toGMTString() : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "");
    document.cookie = curCookie;
}

function EnterDisabled(ev, OkElementName) {
    if (ev.srcElement.id == OkElementName) {
        ev.returnValue = true;
    }
    else {
        ev.returnValue = false;
    }
    return ev;
}
