/*************************************************
**************************************************/
function submitForm(action)
{

    document.pageForm.pageAct.value = action;
    document.pageForm.submit();

}
/*************************************************
**************************************************/
function changePage(reqPage,showName)
{	
	
	if(reqPage)
	{
		document.pageForm.pageId.value = reqPage;
        document.pageForm.pageName.value = showName
		document.pageForm.submit();
	}
	else
	{
		document.pageForm.pageId.value = "about";
        document.pageForm.pageName.value = "About";
		document.pageForm.submit();
	}



}
/*************************************************
**************************************************/
function centerParms(width,height,complete) {

    xPos = (screen.width - width) / 2;
    yPos = (screen.height - height) / 2;

    string = "left=" + xPos + ",top=" + yPos;

    //return the width & height portions too
    if (complete) string += ",width=" + width +",height=" + height;

    return string;
}
/*************************************************
**************************************************/
function ViewMap()
{
  parms = centerParms("800","520") + ",width=800,height=520,scrollbars=no,menubars=no"
             +"resizable=yes,titlebar=no,location=no";
    
  var theURL = 'patriotsnet_commercial_map.html';

  patriotsMapWin = window.open(theURL,"patriotsMap",parms);
  patriotsMapWin.location.href = theURL;

  if( patriotsMapWin.opener == null )
    patriotsMapWin.opener = self;

}
/*************************************************
**************************************************/
function SetMap(mapName,mapExt)
{
    var theURL = 'swapmap.php?mapName='+mapName+'&mapExt='+mapExt;
    loadNewMap(theURL);    
}
/*************************************************
**************************************************/
function loadNewMap(url)
{

    var mapreq;

    mapCallBack = function xmlMapFormChange()
        {
        if (mapreq.readyState == 4)
                {
            if(mapreq.status == 200)
                        {
                writeMapForm(mapreq.responseText);
            }
            else return "Error loading page";

        }
    };

    if (window.XMLHttpRequest)
        {
        mapreq = new XMLHttpRequest();
        mapreq.onreadystatechange = mapCallBack;
        mapreq.open('GET', url, true);
        mapreq.send(null);
    }
    else if (window.ActiveXObject)
        {
        mapreq=new ActiveXObject("Microsoft.XMLHTTP");
        if (mapreq)
                {
            mapreq.onreadystatechange = mapCallBack;
            mapreq.open("GET",url,true);
            mapreq.send();
        }
    }

}
/*************************************************
**************************************************/
function writeMapForm(txt)
{
    var tgDiv = window.document.getElementById("pMapdiv");
    tgDiv.innerHTML = txt; 

}
/*************************************************
**************************************************/
