//This loads main style sheet
//seperated by name attribute as to not interfere with other/print style sheets


function bookmark_us(url, title){

if (window.sidebar) // firefox
 window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
 var elem = document.createElement('a');
 elem.setAttribute('href',url);
 elem.setAttribute('title',title);
 elem.setAttribute('rel','sidebar');
 elem.click();
}
else if(document.all)// ie
 window.external.AddFavorite(url, title);
} 



function GoSearch()
{
document.location = "/en/Dealing_With_Us/The_Board/Board_Members_Area/Search/?Query="+$("#q").val();
}

function RemoveH1()
{

$("#formdata h1").css('display','none');
}


function SetCurrentStyle()
{
        if($.cookie("css")) {
         $("link[id=mainStyle]").attr("href","/includes/css/"+$.cookie("css"));
        }
 
}




 
 //sets style sheet, remember to add /includes/css/ etc
 $(document).ready(function() {

     $("#styleswitcher a").click(function() {
     $("link[id=mainStyle]").attr("href","/includes/css/"+$(this).attr('rel'));
     $.cookie("css",$(this).attr('rel'), {expires: 365, path: '/'});
     return false;
     });
     
     SetCurrentStyle();
     SetTableClasses();
     SetCouncilLink();
 }); 
 
 function SetCouncilLink()
 {
    
    if($("ul.tabs li[id=current] a").length)
    {
        //$("a#CouncilLink").attr('href',$("ul.tabs li[id=current] a").attr('href'));
        
        var currentTabArray = $("ul.tabs li[id=current] a").text().split(" ");
        var LinksArray = new Array();
        
        LinksArray[0] = "/en/Your-Council/Louth_County_Council/";
        LinksArray[1] = "/en/Your-Council/Dundalk_Town_Council/";
        LinksArray[2] = "/en/Your-Council/Drogheda_Borough_Council/";
        LinksArray[3] = "/en/Your-Council/Ardee_Town_Council/"; 
       $("a#CouncilLink").attr('href','/'); //default
       
       for(var i =0; i <4; i++)
       {
          if(LinksArray[i].match(currentTabArray[0]) != null)
          {
            $("a#CouncilLink").attr('href',LinksArray[i]);
          }
       }
    }
    else
    {
        $("a#CouncilLink").attr('href','/en/Your-Council/Louth_County_Council/');
    }

 }
 
 function SetTableClasses()
 {
    $("#subhome table").addClass('data');
 }
