/* NOTE: When making this live, change menu1.cgi to menu.cgi in this file, in menu1.cgi*/
/* ALSO change main_style1.css to main_style in menu1.cgi and upload_file.html, upload_file.cgi and also the html window, put_page_in_parent.js*/
/* Change the application version and add record to revision history. */

/* Ask bruce if he remembers who wanted a link to our calendar*/
/* Update the "How to use this site" file */

/*
* Have report for finances received from ARDF events
*/
/*
* Get rid of user_id reference to everything - change to user_s7_id.  In fact, add a unique non s7_id ID  to each table, the way i should have done a long time ago. Once this is done, allow user IDs to be updated by members and committe.
* Have "away" option for members, so if someone tries to contact them, an email will be sent out telling them an answer might be delayed until they get back.
* Multiple file uploads
* Backup images and report files periodically.  Have flag in relevant DBs and check - if not backed up, then send email to me and I put it somewhere.
*  One day = modify all css so there are NO width commands; just define all the styles .  If custom needed, call them tblInputCarPool, for example
*/
try {
	var oPopup = window.createPopup();
}
catch (e) {}

var isOpera = !(navigator.userAgent.toLowerCase().indexOf("opera") == -1); //|| !(navigator.userAgent.toLowerCase().indexOf("safari") == -1);
var isSafari = !(navigator.userAgent.toLowerCase().indexOf("safari") == -1);
var isFirefox = !(navigator.userAgent.toLowerCase().indexOf("firefox") == -1);


var MAX_NAV_LEVEL = 6;
var nw;
var html_w;
/* Create a new JSON object and Ajax connection - needed when doing Ajax to put html pages into frames */
var jsObj = new JSONscriptRequest();
var menuConn = new RemoteConnection();

/* HTML pages called from various other pages*/
var HOME_PG = '../about/home_aj.html';
var CONTACTS_PG = '../about/contacts_aj.html';
var EMAIL_PG = '../about/email_aj.html';
var CAL_PG = '../events/calendar_aj.html';
var LOCAL_PG = '../events/local_aj.html';
var INTERN_PG = '../events/intern_aj.html';
var	EVENT_PG = '../events/event_aj.html';
var	EVENT_CASH_PG = '../events/event_cash_aj.html';
var EVENT_CASH_RPT_PG = '../committee/event_cash_report_aj.html';
var PIC_PG = '../events/pictures_aj.html';
var PIC_UP_PG = '../events/pictures_upload_aj.html';
var RPT_PG = '../events/report_aj.html';
var STREET_CASH_PG = '../events/event_cash_aj.html';
var	UPL_PG = '../about/upload_file_aj.html';
var ACTION_PG = '../committee/action_pts_aj.html';
var LEVY_PG = '../committee/levy_aj.html';
var MINUTE_PG = '../committee/minutes_aj.html';
var NEWS_PG = '../events/news_aj.html';
var HTML_PG = '../about/write_html_aj.html';
var FOX_SCORES_PG = '../fox_hunting/fox_scores_aj.html';
var FOX_CALC_PG = '../fox_hunting/fox_calculator_aj.html';
var FOX_CALENDAR_PG = '../fox_hunting/fox_calendar_aj.html';
var FOX_MAIN_PG = '../fox_hunting/fox_main_aj.html';
var CAR_POOL_INSTR_PG = '../services/car_pool_instr_aj.html';

/* Script pages called to populate pages and perform server side actions */
var ACTION_SPG = '../cgi-bin/action_pts_aj.cgi';
var CAR_REGISTER_SPG = '../cgi-bin/car_pool_aj.cgi';
var CAR_MAINT_SPG = '../cgi-bin/car_pool_maint_aj.cgi';
var CAR_MEMBERS_SPG = '../cgi-bin/car_pool_members_aj.cgi';
var BUG_RPT_SPG = '../cgi-bin/bug_rpt_aj.cgi';
var BUGS_SPG = '../cgi-bin/bugs_aj.cgi';
var CALENDAR_SPG = '../cgi-bin/calendar_aj.cgi';
var CONTACTS_SPG = '../cgi-bin/contacts_aj.cgi';
var EMAIL_SPG = '../cgi-bin/email_aj.cgi';
var EVENT_SPG = '../cgi-bin/event_aj.cgi';
var EVENT_CASH_SPG = '../cgi-bin/event_cash_aj.cgi';
var EVENT_CASH_RPT_SPG = '../cgi-bin/event_cash_report_aj.cgi';
var HOME_SPG = '../cgi-bin/home_pts_aj.cgi';
var INTERN_SPG = '../cgi-bin/intern_aj.cgi';
var INVENTORY_SPG = '../cgi-bin/inventory_aj.cgi';
var LEVY_SPG = '../cgi-bin/levy_aj.cgi';
var LINKS_SPG = '../cgi-bin/links_aj.cgi';
var LOCAL_SPG = '../cgi-bin/local_aj.cgi';
var MEMBERS_SPG = '../cgi-bin/members_aj.cgi';
var MINUTES_SPG = '../cgi-bin/minutes_aj.cgi';
var NEWS_SPG = '../cgi-bin/news_aj.cgi';
var PICS_SPG = '../cgi-bin/pictures_aj.cgi';
var PICS_UP_SPG = '../cgi-bin/pictures_upload_aj.cgi';
var RPT_SPG = '../cgi-bin/report_aj.cgi';
var SCHEDULE_SPG = '../cgi-bin/schedule_aj.cgi';
var UPL_SPG = '../cgi-bin/upload_file_aj.cgi';
var UPDATE_LOGIN_SPG = '../cgi-bin/update_login_aj.cgi';
var FOX_SCORES_SPG = '../cgi-bin/fox_scores_aj.cgi';
var FOX_CALC_SPG = '../cgi-bin/fox_calculator_aj.cgi';
var FOX_CALENDAR_SPG = '../cgi-bin/fox_calendar_aj.cgi';
var FOX_MAIN_SPG = '../cgi-bin/fox_main_aj.cgi';

/************ Maintain scroll Position stuff **********/
var sx, sy, sxd, syd, dvObj, sxd1, syd1, dvObj1, sxd2, syd2, dvObj2, sxd3, syd3, dvObj3, sxd4, syd4, dvObj4;

function listenForScroll (sx_id, sy_id, sxd_id, syd_id, dv_id, sxd1_id, syd1_id, dv1_id, sxd2_id, syd2_id, dv2_id, sxd3_id, syd3_id, dv3_id, sxd4_id, syd4_id, dv4_id) {
	sx = document.getElementById(sx_id);
	if (!sx || sx == null)	return;

	sy = document.getElementById(sy_id);
	sxd = document.getElementById(sxd_id);
	syd = document.getElementById(syd_id);
	dvObj = document.getElementById(dv_id);

	try {
		sxd1 = document.getElementById(sxd1_id);
		syd1 = document.getElementById(syd1_id);
		dvObj1 = document.getElementById(dv1_id);
	} catch (e) { sxd1 = null; syd1 = null; dvObj1 = null; }

	try {
		sxd2 = document.getElementById(sxd2_id);
		syd2 = document.getElementById(syd2_id);
		dvObj2 = document.getElementById(dv2_id);
	} catch (e) { sxd2 = null; syd2 = null; dvObj2 = null; }

	try {
		sxd3 = document.getElementById(sxd3_id);
		syd3 = document.getElementById(syd3_id);
		dvObj3 = document.getElementById(dv3_id);
	} catch (e) { sxd3 = null; syd3 = null; dvObj3 = null; }

	try {
		sxd4 = document.getElementById(sxd4_id);
		syd4 = document.getElementById(syd4_id);
		dvObj4 = document.getElementById(dv4_id);
	} catch (e) { sxd4 = null; syd4 = null; dvObj4 = null; }
}

function setScroll() {
	try {
        sx.value = document.documentElement.scrollLeft;
        sy.value = document.documentElement.scrollTop;
		sxd.value = dvObj.scrollLeft;
		syd.value = dvObj.scrollTop;
		sxd1.value = dvObj1.scrollLeft;
		syd1.value = dvObj1.scrollTop;
		sxd2.value = dvObj2.scrollLeft;
		syd2.value = dvObj2.scrollTop;
		sxd3.value = dvObj3.scrollLeft;
		syd3.value = dvObj3.scrollTop;
		sxd4.value = dvObj4.scrollLeft;
		syd4.value = dvObj4.scrollTop;
    } catch (e) { }
}

function scrollTo() {
    var x, y;
	try {
		// Window
        x = sx.value;
        if (x == '') { x = 0; }
	    y = sy.value;
	    if (y == '') { y = 0; }
	    window.scroll(x, y);
	    // Div
		x = sxd.value;
		if (x == '') { x = 0; }
		y = syd.value;
		if (y == '') { y = 0; }
		dvObj.scrollLeft = x;
		dvObj.scrollTop = y;
		// Div 1
		x = sxd1.value;
		if (x == '') { x = 0; }
		y = syd1.value;
		if (y == '') { y = 0; }
		dvObj1.scrollLeft = x;
		dvObj1.scrollTop = y;
		// Div 2
		x = sxd2.value;
		if (x == '') { x = 0; }
		y = syd2.value;
		if (y == '') { y = 0; }
		dvObj2.scrollLeft = x;
		dvObj2.scrollTop = y;
		// Div 3
		x = sxd3.value;
		if (x == '') { x = 0; }
		y = syd3.value;
		if (y == '') { y = 0; }
		dvObj3.scrollLeft = x;
		dvObj3.scrollTop = y;
		// Div 3
		x = sxd4.value;
		if (x == '') { x = 0; }
		y = syd4.value;
		if (y == '') { y = 0; }
		dvObj4.scrollLeft = x;
		dvObj4.scrollTop = y;

	} catch (e) {}
}


/************ Nav link stuff **************/

function removeNav(nav_id) {
	var i;
	for (i = nav_id + 1; i <= MAX_NAV_LEVEL; i++) {
		document.getElementById("spnArrow" + eval(i - 1)).innerHTML = "";
		var spnl = document.getElementById("spnLink" + i);
		spnl.innerHTML = "";
		spnl.className = "lblNavNoLink";
		document.getElementById("spnURL" + i).value = "";
	}
	document.getElementById("spnLink" + nav_id).className = "lblNavNoLink";
	document.getElementById("spnIndex").value = nav_id;
	if (nav_id == 1)  {
		document.getElementById("btnMenuBack").style.display = "none";
		document.getElementById("spnLink1").className = "lblNavNoLinkFirst";
	}
}

function changeCurLink(url_nm, item_nm) {
	var ti = document.getElementById("spnIndex");
	if (item_nm && item_nm != '' && ti.value == 1) // Only link is home page but you are on another page, so probably arrived directly
		setLinks(url_nm, item_nm);
	else
		document.getElementById("spnURL" + ti.value).value = url_nm;
}

function setNav(url_nm, item_nm) {
	document.getElementById("txtMainSrc").value = url_nm;
	setMainDiv();
	setLinks(url_nm, item_nm);
	document.getElementById("btnMenuBack").style.display = "";
}

function setLinks(url_nm, item_nm) {
	var ti = document.getElementById("spnIndex");
	for(var i = 1; i <= eval(ti.value); i++) {	// Check if link to item already exists (mainly for back button issues)
		if (document.getElementById("spnLink" + i).innerHTML == item_nm) {
			removeNav(i);
			return;
		}
		if (document.getElementById("spnLink" + i).innerHTML == 'New Event' && item_nm == 'View Event') {
			document.getElementById("spnLink" + i).innerHTML = 'View Event';
			removeNav(i);
			return;
		}
	}
	document.getElementById("spnArrow" + ti.value).innerHTML = ">>";
	document.getElementById("spnLink" + ti.value).className = "lblNavLink";
	ti.value = eval(ti.value) + 1;
	document.getElementById("spnURL" + ti.value).value = url_nm;
	var spnl = document.getElementById("spnLink" + ti.value);
	spnl.innerHTML = item_nm;
}

function goBack() {
	var ti = document.getElementById("spnIndex");
	if (ti.value == 1)
		return;
	if (document.getElementById("spnLink" + eval(ti.value - 1)).innerHTML == 'View Event') { document.getElementById('txtUpdate').value = 0; }
	document.getElementById("txtMainSrc").value = document.getElementById("spnURL" + (eval(ti.value) - 1)).value;
	setMainDiv();
	removeNav(eval(ti.value - 1));

}

/********** Opening links **************/

function openWindow(url_nm) {
	if (nw != null)
		try {nw.close();} catch (e) {}
	nw = window.open(url_nm, '');
}

function openHTMLWindow() {
	if (html_w != null)
		try {html_w.close();} catch (e) {}
	html_w = window.open(HTML_PG, '');
}

/*********** Iframe stuff **************/

function submitForm (form_obj, action_page) {
	form_obj.action = action_page;
	form_obj.submit();
}

function setHiddenTop(s7_id, upd_fg) {
	document.getElementById('txt_s7_id').value = s7_id;
	document.getElementById('txtUpdate').value = upd_fg;
	document.getElementById('txtMainSrc').value = "";
	document.getElementById('txtMainLbl').value = "";
}

function setHiddenTopYear(s7_id, upd_fg, year_val, so_val, so_ord, so_val1, so_ord1, so_val2, so_ord2) {
	setHiddenTop(s7_id, upd_fg);
	document.getElementById('txtYear').value = year_val;
	document.getElementById('txtSortOrd').value = so_ord;
	document.getElementById('txtSortVal').value = so_val;
	setHiddenTopSO(so_val1, so_ord1, so_val2, so_ord2);
}

function setHiddenTopSO (so_val1, so_ord1, so_val2, so_ord2) {
	document.getElementById('txtSortOrd1').value = so_ord1;
	document.getElementById('txtSortVal1').value = so_val1;
	document.getElementById('txtSortOrd2').value = so_ord2;
	document.getElementById('txtSortVal2').value = so_val2;
}

function checkItem (item_nm) {
	if (item_nm == 'View Event') { top.document.getElementById('txtUpdate').value = 0; }

}

/************ Generic functions ****************/

function cursSet(css_nm) {
	try {
		document.styleSheets[0].rules[0].style.cursor = css_nm;
	} catch (e) {
		try {
			document.styleSheets[0].cssRules[0].style.cursor = css_nm;
		} catch (e) {}
	}

}

function trim (str) {
	var res = "";
	var c = 0;
	for (i=0; i < str.length; i++) {
		if (str.charAt(i) != " " || c > 0) {
			res += str.charAt(i);
			if (str.charAt(i) != " ") c = res.length;
		}
	}
	return res.substr(0,c);
}

function remTags (str) {
	return str.replace(/&amp;/g, "&").replace(/&lt;/g,"<").replace(/&gt;/g, ">");
}

function chkNoChars(obj, ml) {
	var count = obj.value.length;
 	if(count > ml)
		obj.value = obj.value.substring(0, ml);
}


function left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}

function right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}

function roundZeroFill(obj, dec) {
	var i;
	var l;
	var val = obj.value;
	if (isNaN(val))	return 0;
	if (isNaN(dec))	dec = 0;
	dec = Math.round(dec);
	if (dec < 0)	dec = 0;
	val = val * Math.pow(10, dec);
	val = Math.round(val);
	val = val / Math.pow(10, dec);
	if (dec == 0)	return val;
	// Pad with trailing zeroes
	// Convert val to string
	val = val + '';
	var pos = val.indexOf(".");
	if (pos == -1) {
		l = 0;
		val = val + '.';
	}
	else {
		l = val.substring(pos + 1).length;
	}
	for (i = l; i < dec; i++)
		val = val + '0';
	if (val != obj.value) { obj.value = val; }
}

function roundZeroFillForLabel(val, dec) {
	var i;
	var l;
	if (isNaN(val))	return 0;
	if (isNaN(dec))	dec = 0;
	dec = Math.round(dec);
	if (dec < 0)	dec = 0;
	val = val * Math.pow(10, dec);
	val = Math.round(val);
	val = val / Math.pow(10, dec);
	if (dec == 0)	return val;
	// Pad with trailing zeroes
	// Convert val to string
	val = val + '';
	var pos = val.indexOf(".");
	if (pos == -1) {
		l = 0;
		val = val + '.';
	}
	else {
		l = val.substring(pos + 1).length;
	}
	for (i = l; i < dec; i++)
		val = val + '0';
	return val;
}

function chkOnlyNos(obj) {
	var new_val = obj.value.replace(/[^0-9.]/g,'');
	if (new_val != obj.value) {
		obj.value = new_val;
	}
}

function chkOnlyNosNeg(obj) {
	var neg_flg = (left(obj.value, 1) == '-');
	var new_val = obj.value.replace(/[^0-9.]/g,'');
    if (neg_flg)	new_val = '-' + new_val;

	if (new_val != obj.value) {
		obj.value = new_val;
	}
}

function chkOnlyInts(obj) {
	var new_val = obj.value.replace(/[^0-9]/g,'');
	if (new_val != obj.value) {
		obj.value = new_val;
	}
}

function checkDodgyChars(str) {
	return (str.indexOf("\'") != -1 || str.indexOf('"') != -1 || str.indexOf("?") != -1);
}

function findPosX(obj) {
	var curLeft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
      			curLeft += obj.offsetLeft;
       			obj = obj.offsetParent;
       		}
       	}
	else if (obj.x)
		curLeft += obj.x;

	if (oPopup) {
		curLeft += 7;
	}
	return curLeft;
}

function findPosY(obj) {
	var curTop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curTop += obj.offsetTop;
			obj = obj.offsetParent; }
		}
	else if (obj.y)
		curTop += obj.y;


	if (oPopup) {
		curTop += 11;
	}
	return curTop;
}

function pauseComp(ms)
{
	var date = new Date();
	var curDate = null;

	do { curDate = new Date(); }
	while(curDate - date < ms);
}


/************ Automatic parsing of text fields **************/

function getRequestBody(obj) {
    var aParams = new Array();
    var els = obj.getElementsByTagName("textarea")

    for (var i=0 ; i < els.length; i++) {
        var sParam = encodeURIComponent(els[i].name);
        sParam += "=";
        sParam += encodeURIComponent(trim(els[i].value));
        aParams.push(sParam);
    }

    var els = obj.getElementsByTagName("input")

	for (var i=0 ; i < els.length; i++) {
			if (els[i].type != "text" && els[i].type != "hidden" && els[i].type != "password")	continue;

	        var sParam = encodeURIComponent(els[i].name);
	        sParam += "=";
	        sParam += encodeURIComponent(trim(els[i].value));
	        aParams.push(sParam);
    }

    return aParams.join("&");
}

function getLoginPword(suff) {
	var str = '';
	if (!suff || suff == null)
		suff = '';
	try {
		str = "txtPassword=" + document.getElementById('txtPassword' + suff).value;
		str += "&txtLogin=" + document.getElementById('txtLogin' + suff).value;

	} catch (e) {

	}
	return str;
}

function getSortOrder(sort_val, flg) {
	var str = "";
	if (!flg)	flg = "";
	var new_sort_val = "", new_order = "";
	try {
		var old_sort_val = document.getElementById('txtSortVal' + flg).value;
		var old_order = document.getElementById('txtSortOrd' + flg).value;

		if (sort_val == "") {
			new_sort_val = old_sort_val;
			new_order = old_order;
		} else {
			if (old_sort_val == sort_val) {
				new_sort_val = sort_val; new_order = ((old_order == "asc") ? "desc" : "asc");
			} else{
				new_sort_val = sort_val; new_order = "asc";
			}
		}
		str = "txtSortVal" + flg + "=" + new_sort_val + "&txtSortOrd" + flg + "=" + new_order;
	} catch (e) {}
	return str;
}

function getScrollPos() {
	// This will be called by each indivdual page, so sx, sy etc are already defined at this point
	str = "";
	try {
		str = "txtSX=" + sx.value + "&txtSY=" + sy.value + "&txtSXD=" + sxd.value + "&txtSYD=" + syd.value;
		str = str + "&txtSXD1=" + sxd1.value + "&txtSYD1=" + syd1.value;
		str = str + "&txtSXD2=" + sxd2.value + "&txtSYD2=" + syd2.value;
		str = str + "&txtSXD3=" + sxd3.value + "&txtSYD3=" + syd3.value;
		str = str + "&txtSXD4=" + sxd4.value + "&txtSYD4=" + syd4.value;
	} catch (e) {}
	return str;
}

function putValues(str) {
	// This anticipates a URL with a query string.
	// It will parse the query string; given a pair blah=x, it will put "x" into the textbox "blah", if "blah" exists!!
	var pos = str.indexOf('?');
	if (pos == -1 || pos == str.length - 1)
		return;
	// Query string exists - get it
	var qs = str.substring(pos + 1);
	var pairs = qs.split("&");
	for (var i = 0; i < pairs.length; i++) {
		pos = pairs[i].indexOf('=');
		if (pos == -1) 	continue;
		var arg = pairs[i].substring(0,pos);
		var val = pairs[i].substring(pos+1);
		try {
			document.getElementById(arg).value = val;
		}
		catch (e) {}
	}
}

/*************** AJAX stuff to populate the main div with the required page; JSON stuff is in ajax.js so include that first ************/

function setMainDiv() {
	var src = document.getElementById("txtMainSrc").value;
	var lbl = unescape(trim(document.getElementById("txtMainLbl").value));
	var pos = src.indexOf("?");
	var posIframe = src.indexOf("showFrame=true");
	var pg = src;
	var qs = '';
	if (pos != -1)  {
		pg = left(src, pos);
		qs = right(src, src.length - pos - 1);
	}

	var bool = (posIframe != -1) || (right(pg, 4).toLowerCase() != '.htm' && right(pg, 4).toLowerCase() != '.txt' && right(pg, 4).toLowerCase() != '.cgi' && right(pg, 5).toLowerCase() != '.html');
	document.getElementById("frmMain").style.display = (bool) ? '' : 'none';
	document.getElementById("divMain").style.display = (bool) ? 'none' : '';

	src = pg + '?' + 'noCacheIE=' + (new Date()).getTime() + '&' + qs;

	if (bool) {
		if (isOpera || isFirefox) { 			document.getElementById("frmMain").style.height = document.getElementById("txtSize").value + "px"; }
		if (isOpera)
		{
			document.getElementById("frmMain").document.location.href = src;
		} else {
			document.getElementById("frmMain").src = src;
		}

	}
	else {
		menuConn.setRespHandler('', handleMainDiv, 1);
		menuConn.request(src, "GET", "", true, 1);
	}
}

function handleMainDiv(html) {
	document.getElementById('divMain').innerHTML = html;

	// Read the query string and write values
	putValues(document.getElementById("txtMainSrc").value);

	/* Now, the main div has been populated.  So first, remove the script from the previous page, if there was one */
	jsObj.removeLastScriptTag();
	/* Then, from the HTML, try to work out what script to include.  Will be in the txtJSFile textbox, if it exists*/
	var src = "";
	if (document.getElementById("txtJSFile"))
		src = document.getElementById("txtJSFile").value;
	/* 	If a JS file is to be included, include it now in the header
		Note: If there is any stuff to be done to the HTML in the div, make sure it is automatically called by the included
		JS file.  Also make sure the HTML in the div does not have any IDs in common with menu.cgi
	*/
	if (src != "")
		jsObj.buildScriptTag(src);
}

/*************** Generic Ajax stuff - left as a reference ***************/

function ajaxObj(s_flg) {
	var xmlHttp;
	try  {   // Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
    } catch (e) {  // Internet Explorer
    	try  {
      		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      	} catch (e) {
      		try {
        		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        	} catch (e) {
        		alert("Your browser does not support AJAX!\nThis application has been tested in IE 6.0+, Opera 9.10+ and Firefox 1.5+...");
        		return null;
        	}
      	}
    }
    return xmlHttp;
}

/*
	State	Description
	0	The request is not initialized
	1	The request has been set up
	2	The request has been sent
	3	The request is in process
	4	The request is complete
*/


function stateHandler() {
 	if (xmlHttp.readyState == 4) {
		if (xmlHttp.status == 200) {
			div.innerHTML = xmlHttp.responseText;
		} else {
			alert('Unable to return state data');
		}
	}
}

var requester;
function testSrc() {
	try {
 		requester = new XMLHttpRequest();
	} catch (e) {
 		try {
   			requester = new ActiveXObject("Microsoft.XMLHTTP");
 		} catch (e) {
 			return false;
 		}
	}
	alert(requester);
	requester.onreadystatechange = stateHandler;
	requester.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	requester.open("POST", "../cgi-bin/home.cgi");
	var sparam = getRequestBody(document.Forms[0]);
	requester.send("name=Bob&email=bob@example.com");
}



/*

	<!--
	<link rel="stylesheet" type="text/css" href="../scripts/main_style.css" rel="stylesheet"/>
	<script src="../scripts/ajax.js" type="text/JavaScript"></script>
	<script src="../scripts/ardf_aj.js" type="text/JavaScript"></script>
	<script src="../scripts/home_aj.js" type="text/JavaScript"></script>
	-->

*/