﻿function switchPage(cond)
{        
   var pagesArray = ["#home", "#pricing", "#residential", "#commercial", "#otherServices", "#faq", "#specials",
   "#maintenancePrograms", "#links", "#contractors"];
   
   for(var p in pagesArray)
   {
        if(pagesArray[p] != cond)
        {  $(pagesArray[p]).fadeOut(300); }
        //the above loop keeps the page from reloading the same page thats already diplayed,
        //provided the button is clicked again.
   }
    
    if(cond != null)
    { pageSwitch(cond);    }
}

function toggle(cond)
{ cond = !cond;
    return cond; }

function pageSwitch(cond)
{
$(cond).fadeIn(500);
}

function home()
{ switchPage("#home"); }

function pricing()
{ switchPage("#pricing"); }

function residential()
{ switchPage("#residential"); }

function commercial()
{ switchPage("#commercial"); }

function otherServices()
{ switchPage("#otherServices"); }

function contactUs()
{ switchPage("#contactUs");}

function faq()
{ switchPage("#faq");}

function maintenancePrograms()
{ switchPage("#maintenancePrograms"); }

function specials()
{ switchPage("#specials"); }

function link()
{ switchPage("#links"); }

function contractors()
{ switchPage("#contractors"); }

