﻿// JScript File
window.load=requestPage("About");
//var pn_about
//var pn_activities
//var pn_membership
//var pn_officers
//var pn_photos

var xmlHttp;
function requestPage(str)
{
   
    xmlHttp = GetXmlHttpObject();
    
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
    
   
//    var loadPage = true
//    switch str
//    {
//        case "About": if(pn_about != null) loadPage = false
//        case "Activities": if(pn_activities != null) loadPage = false
//        case "Officers": if(pn_membership != null) loadPage = false
//        case "Membership": if(pn_officers != null) loadPage = false
//        case "Photos": if(pn_photos != null) loadPage = false
//    
//    }
    
//    if loadPage
//    {    
        xmlHttp.onreadystatechange=renderPage;
        xmlHttp.open("GET","PageServer.aspx?Page="+str,true);
        xmlHttp.send(null);
//    }
//    else
//    {
//    
//    
//    }
}

function renderPage()
{

    if (xmlHttp.readyState==4)
    {         
        //if IE
        var browser=navigator.appName
        if(browser == "Microsoft Internet Explorer")
        {
            var doc = document.createElement("document")
            doc.innerHTML = xmlHttp.responseText;
            var pan = document.createElement("panel")
            pan.innerHTML = doc.innerHTML  
            //alert(pan.innerHTML)    
            document.getElementById("contentDivision").innerHTML = ""           
            document.getElementById("contentDivision").appendChild(pan)
            
            xmlHttp = null;
        }
        else
            document.getElementById("contentDivision").innerHTML = xmlHttp.responseText
    }
    else
    {
       
        //put loading
        
    }
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
        xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}



//function editParagraph(id, numParagraphs)
//{
//    for(var i=0; i<numParagraphs; i++)
//    {       
//        MakeInvisible(document.getElementById(id + "_text_" + i))
//        MakeVisible(document.getElementById(id + "_textbox_" + i))        
//    }
//    MakeInvisible( document.getElementById(id + "_text"))   
//    MakeVisible( document.getElementById(id + "_textbox"))
//    MakeInvisible( document.getElementById(id + "_pencil"))
//    MakeVisible( document.getElementById(id + "_disk"))
//}

//function deleteParagraph(id)
//{
//    alert("Are you sure you want to delete this sub page?")
//}

//function saveParagraph(id, numParagraphs)
//{
//    for(var i=0; i<numParagraphs; i++)
//    {       
//        MakeVisible(document.getElementById(id + "_text_" + i))      
//        MakeInvisible(document.getElementById(id + "_textbox_" + i))
//        
//    }
//    MakeVisible( document.getElementById(id + "_text"))
//    MakeInvisible( document.getElementById(id + "_textbox"))
//    MakeVisible( document.getElementById(id + "_pencil"))
//    MakeInvisible( document.getElementById(id + "_disk"))
//}

//function MakeVisible(obj)
//{
//    obj.style.visibility = "visible"
//    obj.style.position = ""
//}

//function MakeInvisible(obj)
//{
//    obj.style.visibility = "hidden"
//    obj.style.position = "absolute"  
//}