
/* Last Modified $Date: 5/18/06 6:52p $ by $Author: Csamant $ (Version history stored in Source Control) */

// set up browser detect vars
var isNS4 = (navigator.appName.indexOf("Netscape") != -1 && navigator.appVersion.charAt(0) == "4");
var isMOZ = (navigator.appName.indexOf("Netscape") != -1 && parseInt(navigator.appVersion.charAt(0)) >= 5);
var isIE = (navigator.appName.indexOf("Microsoft") != -1);

function openWindow(url, name, options) {
	var win = window.open(url,name,options);
    if (win != null) {
        win.focus();
    }
    return win;
}

function openSizedWindow(url, w, h, name) {
	if (!name) name = 'newWindow';
	var win = window.open(url,name,'toolbar=no,menubar=no,scrollbars=no,resizable=no,width=' + w + ',height=' + h);
    if (win != null) {
        win.focus();
    }
    return win;
}

function openReSizableWindow(url, w, h, name) {
	if (!name) name = 'newWindow';
	var win = window.open(url,name,'toolbar=no,menubar=no,resizable=yes,scrollbars=yes,width=' + w + ',height=' + h);
    if (win != null) {
        win.focus();
    }
    return win;
}

function openSizedWindowWithSB(url, w, h, name) {
	if (!name) name = 'newWindow';
//	var win = window.open(url,name,'toolbar=no,menubar=no,resizable=no,scrollbars=yes,width=' + w + ',height=' + h);
	var win = window.open(url,name,'toolbar=yes,menubar=yes,resizable=yes,scrollbars=yes,width=' + w + ',height=' + h);
    if (win != null) {
        win.focus();
    }
    return win;
}

function jumpTo(selectBox) {
	var url = selectBox.options[selectBox.selectedIndex].value;
	if (url != "") window.location.href = url;
}

function smWindow(url, name) {
    if (!name) name = 'newWindow';
    openReSizableWindow(url, 480, 220, name);
}

function openLocation(clubNumber) {
    openReSizableWindow('/locations/clubs/' + clubNumber + '.shtml', 500, 600, 'club' + clubNumber);
}

function gotoPartner(partnerURL) {
    var gotoURL = encodeURI(partnerURL);
    openSizedWindowWithSB('exit.html?GoToURL=' + gotoURL, 550, 400, 'partnerWarning');
    return false;
}

function gotoMail(mailURL) {
    var gotoURL = escape(mailURL);
    openSizedWindowWithSB('email.html?GoToURL=' + gotoURL, 550, 400, 'mailWarning');
    return false;
}

function mailPopup()
{
	alert("Please keep in mind that messages you send to us by e-mail are sent outside of areas of the Web site NOT using encryption. Do not send us any personal information (example: account numbers) by Internet e-mail.");
}	

function openFAQs(url, name) {
	return openReSizableWindow(url, 466, 490, name);
}


/**
 * This function returns a random number in the specified range
 *
 * @param	range- max integer value of the random number
 */
function pickRandom(range) {
	if (Math.random) {
		return Math.round(Math.random() * (range-1));
	}
	else {
		var now = new Date();
		return (now.getTime() / 1000) % range;
	}
}

/** Return the cookie value by its name. Returns null if no such cookie found.*/
function getCookie(cookieName)
{
	var results = document.cookie.match(cookieName + '=(.*?)(;|$)');

	if( results )
	{
		return (unescape(results[1]));
	}
  	else
  	{
    	return null;
    }
}


/** DEPRECATED FUNCTIONS **/

function deprecated() {
    alert("ERROR: The link you have clicked is using a deprecated function, please report this to the webmaster.");
}
function whatRewards() {
	deprecated();
}
function whatFHM() {
	deprecated();
}
function whatSupplemental() {
	deprecated();
}
function whatCID() {
	deprecated();
}
function changeName() {
    deprecated();
}


