$(document).ready(function(){
init();
});


function init() {
	showhide();
	toggleFaq(); /* Use collapsible list instead */
	collapsibleList();
	collapsibleList2();
	collapsibleList3();
	setSubMenu();
        /* Uncomment this before publishing, then recomment it */
        /* breakOut(); */
        $('.collapse-content-div').hide();
        
}

function breakOut() {
	if(self != top) {
		window.open(document.location.href, "_top", "");
	}
}

function showhide() {

    $( '#landing_page_nav ul li ul' ).hide();
    $( '#landing_page_nav ul li ul.selected' ).show();
    $( '#landing_page_nav ul li  h3' ).wrapInner('<a href="#" class="navtrigger"></a>');
    $('.navtrigger').toggle( 
      function () {
        $(this).parent().next().slideDown('slow').removeClass('hide').preventDefault;
      },
      function () {
        $(this).parent().next().slideUp('fast').addClass('hide').preventDefault;
      }
	)
  }

function toggleFaq() {
	$('#faq ul li ul').hide();
	
	
    $('#faq ul li b').wrapInner('<a href="#" class="answertrigger"></a>');
    $('#faq ul li strong').wrapInner('<a href="#" class="answertrigger"></a>');

    $('.answertrigger').toggle( 
      function () {
        $(this).parent().next().slideDown('slow').removeClass('hide').preventDefault;
      },
      function () {
        $(this).parent().next().slideUp('fast').addClass('hide').preventDefault;
      }
	)
  }
  
function collapsibleList() {
	$('ul.collapse li ul').hide();
	$('ul.collapse li strong.question-wrap').wrapInner('<a href="#" class="answertrigger"></a>');
	$('ul.collapse li b').wrapInner('<a href="#" class="answertrigger"></a>');
	

    	$('.answertrigger').toggle( 
      		function () {
        		$(this).parent().next().slideDown('slow').removeClass('hide').preventDefault;
      		},
      		function () {
        		$(this).parent().next().slideUp('fast').addClass('hide').preventDefault;
      		}
	)
}

function collapsibleList2() {
	$('ul.collapse2 li ul.subcontent').hide();
	$('ul.collapse2 li strong').wrapInner('<a href="#" class="contenttrigger"></a>');
	

    	$('.contenttrigger').toggle( 
      		function () {
        		$(this).parent().next().slideDown('slow').removeClass('hide').preventDefault;
      		},
      		function () {
        		$(this).parent().next().slideUp('fast').addClass('hide').preventDefault;
      		}
	)
}

function collapsibleList3() {
	$('ul.collapse3 li ul.subcontent').hide();
	$('ul.collapse3 li strong.question-wrap').wrapInner('<a href="#" class="contenttrigger"></a>');
	

    	$('.contenttrigger').toggle( 
      		function () {
        		$(this).parent().next().slideDown('slow').removeClass('hide').preventDefault;
      		},
      		function () {
        		$(this).parent().next().slideUp('fast').addClass('hide').preventDefault;
      		}
	)
}

function collapseDiv(theLink) {
theDiv = "#"+theLink.id+"-div";

$(theDiv).slideToggle('slow');
}

function setSubMenu() {

      if($.cookie("Open") == "yes"){
         $('#fullmenu_wrapper').show();
         $('#navbar_toggle').hide();
         $('#navbar_toggle_up').show();
      } else {
         $('#navbar_toggle').show();
         $('#navbar_toggle_up').hide();
      }
}
