/* 
   Simple JQuery Collapsing nav_479949.
   HTML structure to use:

   <ul id="nav_479949">
     <li><a href="#">Sub nav_479949 heading</a>
     <ul>
       <li><a href="http://site.com/">Link</a></li>
       <li><a href="http://site.com/">Link</a></li>
       <li><a href="http://site.com/">Link</a></li>
       ...
       ...
     </ul>
     <li><a href="#">Sub nav_479949 heading</a>
     <ul>
       <li><a href="http://site.com/">Link</a></li>
       <li><a href="http://site.com/">Link</a></li>
       <li><a href="http://site.com/">Link</a></li>
       ...
       ...
     </ul>
     ...
     ...
   </ul>

Copyright 2007 by Marco van Hylckama Vlieg

web: http://www.i-marco.nl/weblog/
email: marco@i-marco.nl

Free for non-commercial use
*/

function toggle_margin(elem, switchvar){
	if(switchvar){
		if(switchvar == 'on'){
			elem.css('margin-bottom','10px');
		}
		else if(switchvar == 'off'){
			elem.css('margin-bottom', 0);
		}
	}
	else{
		if(elem.css('margin-bottom') == '0px')
			elem.css('margin-bottom','10px');
		else
			elem.css('margin-bottom', 0);
	}
}


function initnav_770410() {
 //health conditions accordion
  $('#nav_770410 ul').hide();
  $('#nav_770410 li.selected ul').show('fast',function(){  /*$('.col2').height($('.col1').height() -40); */} );
  $('#nav_770410 li a').click(
    function() {
	    //adjust col2 height depending on new col1 height so that footer will remain @ bottom
        $(this).next().slideToggle('normal', function(){  /*$('.col2').height($('.col1').height()- 40); */} );	
      }
    );
	
  //Secure zone accordion
  $('.col1 #nav_977507 ul').hide();
  $('.col1 #nav_977507 li.selected ul').show('fast',function(){  /*$('.col2').height($('.col1').height() -40); */} );
  $('.col1 #nav_977507 li a').click(
    function() {
		//adjust col2 height depending on new col1 height so that footer will remain @ bottom
        $(this).next().slideToggle('normal', function(){  /*$('.col2').height($('.col1').height() -40); */ } );	
    }
  );	

  //home & inner template accordion, the same menu as above
  $('.accordion #nav_977507 ul').hide('fast',
		function(){ 
			toggle_margin($('.accordion #nav_977507 li.parent'),'on'); 
		}
	);
	
  $('.accordion #nav_977507 li.selected ul').show('fast',
		function(){
			/*$('.col2').height($('.col1').height() -40); */
			toggle_margin($('.accordion #nav_977507 li.parent'),'off');
		}
	);
  $('.accordion #nav_977507 li a').click(
    function() {
		//adjust col2 height depending on new col1 height so that footer will remain @ bottom
        $(this).next().slideToggle('normal', 
				function(){
					/*$('.col2').height($('.col1').height() -40); */ 
					toggle_margin($('.accordion #nav_977507 li.parent'));
				}
		);	
    }
  );	 

	
}

$(document).ready(function() {initnav_770410();});
