var colsInArray;

colsInArray = 5;


function sortArray( ranarray )
{
 var x, y, holder;
 // The Bubble Sort method.
 for(x = 0; x < ranarray.length; x++)
 {
   for(y = 0; y < (ranarray.length-1); y++)
   {
     if(ranarray[y].mainHREF > ranarray[y+1].mainHREF)
     {
       holder = ranarray[y+1].mainHREF;
       ranarray[y+1].mainHREF = ranarray[y].mainHREF;
       ranarray[y].mainHREF = holder;
     }
   }
 }
 }


function subSite(txtType, txtHeading, mainHREF, mainInfo , mainAdd )
{
this.txtType = txtType
this.txtHeading = txtHeading
this.mainHREF = mainHREF
this.mainInfo = mainInfo
this.mainAdd = mainAdd
}

var Site = new Array()
Site.push ( new subSite("SiteMap", "Home Page","index.html","The site's home page","") )
Site.push ( new subSite("SiteMap", "Housing","housing.html","Details of housing in the area.","") )


Site.push ( new subSite("SiteMap", "Comm Council Page","council.html","Basic introduction","") )
Site.push ( new subSite("SiteMap", "Brief History","info.html","A potted history of the area","") )

Site.push ( new subSite("SiteMap", "Reports","reports.html","Our annual reports","") )
Site.push ( new subSite("SiteMap", "Contact Us","contact.html","How to contact us","") )


Site.push ( new subSite("SiteMap", "Minutes","minutes.html","The minutes from our meetings","") )
Site.push ( new subSite("SiteMap", "Forgewood Co-op","forgewoodco_op.html","All about Forgewood Co-op","") )


Site.push ( new subSite("SiteMap", "Health & Well-Being","wellbeing.html","The health issues in our area","") )
Site.push ( new subSite("SiteMap", "Community Safety","police.html","Basic details of policing and crime","") )

Site.push ( new subSite("SiteMap", "Recent Events","events.html","Any recent or past events held","") )

Site.push ( new subSite("SiteMap", "Recent News","news.html","Any recent or past news","") )


Site.push ( new subSite("SiteMap", "Local Groups","groups.html","Groups operating in this area","") )

Site.push ( new subSite("SiteMap", "Business","business.html","A business directory","") )
Site.push ( new subSite("SiteMap", "Guest Book","guestbook.shtml","Guests can leave comments here","") )
Site.push ( new subSite("SiteMap", "Events Calendar","calendar.html","Calendar of various events","") )
Site.push ( new subSite("SiteMap", "Link Exchange","links.html","Find other interesting sites","") )
Site.push ( new subSite("SiteMap", "Photo Gallery","gallery.html","Some pictures from our area","") )

Site.push ( new subSite("SiteMap", "Services","religion.html","Religious services in our area","") )

Site.push ( new subSite("SiteMap", "NLC","nlc.html","North Lanarkshire Council","") )
Site.push ( new subSite("SiteMap", "LHA","lha.html","Lanarkshire Housing Assoc","") )
Site.push ( new subSite("SiteMap", "Hanover Trust","hanover.html","The Hanover Trust","") )

//Site.push ( new subSite("Archive", "Guest Book Article","","This appeared on 21st Jan 2007","Here is the story about a wee shop in the country been") )
//Site.push ( new subSite("Archive", "Home Page Article","","This appeared on 28th Jan 2007","Repairs have been carried out to the houses in this road<br />") )


function createSiteMap( )
{

//sortArray(Site);

for(var e = 0; e < Site.length; e++)
 {
  if ( Site[e].txtType == "SiteMap")
   {
   document.write("<a id='bluelink' href='" + Site[e].mainHREF + "' title='" + Site[e].mainInfo +"' >" + Site[e].mainHREF + "</a>" + " :: " + Site[e].mainInfo);
   document.write("<br /><br />");
    } // end if for type
  }  	// end for rows

}


function createTable( strTableId )
{

    var oTable = document.getElementById(strTableId)

    var oBody = oTable.tBodies[0];
    var oRow,oCellText;


    if (oBody)
     {
       oBody.removeNode(true);
      }

    oBody = document.createElement("tbody");
    oTable.appendChild(oBody);



  // TABLE HEADER
  oRow = oTable.insertRow();
  oRow.id = "header";
  oCellText = oRow.insertCell();
  oCellText.align="center";
  oCellText.innerText = "The pages of our website";
  oCellText.colSpan = 3;


   oRow = oTable.insertRow();
   oRow.id = "sitemapRow";

 var intRow;

 intRow = 0;

for(var e = 0; e < Site.length; e++)
 {
  if ( Site[e].txtType == "SiteMap")
   {

    intRow++;

    if (intRow == 4)
    {
    oRow = oTable.insertRow();
    oRow.id = "sitemapRow";
    intRow = 1;
    }

     
     	oCellText = oRow.insertCell();
	oCellText.width="100"
	oCellText.height="25"
	oCellText.align="center"
	oCellText.id = e;
	oCellText.innerHTML = "<a id='bluelink' href='" + Site[e].mainHREF + "' title='" + Site[e].mainInfo +"' >" + Site[e].mainHREF + "</a>";

    } // end if for type
  }  	// end for rows

}





