Template = new Object();

Template.is_safari = (document.childNodes)&&(!document.all)&&(!navigator.taintEnabled)&&(!navigator.accentColorName)?true:false;
Template.is_ie55 = (document.all && document.fireEvent && !document.createComment);
Template.win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);




$(document).ready(function() {

$('a[rel="external"]').click( function() {
        window.open( $(this).attr('href') );
        return false;
    });

	
$("a[href*=.pdf]").click(function(){
	window.open(this.href);
	return false;
});



$(".address1").css("display", "none");
$(".address2").css("display", "none");
$(".address3").css("display", "none");
$(".address4").css("display", "none");
$(".address5").css("display", "none");
$(".address6").css("display", "none");

$("h4.address1title").mousedown(function(){
	if ($(".address1title").hasClass('displayed')){
		$(".address1title").removeClass("displayed");
		$(".address1").css("display", "none");
	}
	else
	{
	
	$(".address1title").addClass("displayed");
	$(".address1").css("display", "block");
	$(".address2").css("display", "none");
	$(".address3").css("display", "none");
	$(".address4").css("display", "none");
	$(".address5").css("display", "none");
	$(".address6").css("display", "none");
	$(".address2title").removeClass("displayed");
	$(".address3title").removeClass("displayed");
	$(".address4title").removeClass("displayed");
	$(".address5title").removeClass("displayed");
	$(".address6title").removeClass("displayed");
	document.getElementById("address1").innerHTML = window.Map1;
	}
	});

$("h4.address2title").mousedown(function(){
	if ($(".address2title").hasClass('displayed')){
			$(".address2title").removeClass("displayed");
			$(".address2").css("display", "none");
		}
		else
	{
	$(".address2title").addClass("displayed");
	$(".address2").css("display", "block");
	$(".address1").css("display", "none");
	$(".address3").css("display", "none");
	$(".address4").css("display", "none");
	$(".address5").css("display", "none");
	$(".address6").css("display", "none");
	$(".address1title").removeClass("displayed");
	$(".address3title").removeClass("displayed");
	$(".address4title").removeClass("displayed");
	$(".address5title").removeClass("displayed");
	$(".address6title").removeClass("displayed");
	document.getElementById("address2").innerHTML = window.Map2;
	}
	});

$("h4.address3title").mousedown(function(){
if ($(".address3title").hasClass('displayed')){
		$(".address3title").removeClass("displayed");
		$(".address3").css("display", "none");
	}
	else
	{
	$(".address3title").addClass("displayed");
	$(".address3").css("display", "block");
	$(".address2").css("display", "none");
	$(".address1").css("display", "none");
	$(".address4").css("display", "none");
	$(".address5").css("display", "none");
	$(".address6").css("display", "none");
	$(".address2title").removeClass("displayed");
	$(".address1title").removeClass("displayed");
	$(".address4title").removeClass("displayed");
	$(".address5title").removeClass("displayed");
	$(".address6title").removeClass("displayed");
	document.getElementById("address3").innerHTML = window.Map3;
	}
	});

$("h4.address4title").mousedown(function(){
	if ($(".address4title").hasClass('displayed')){
			$(".address4title").removeClass("displayed");
			$(".address4").css("display", "none");
		}
		else
	{
	$(".address4title").addClass("displayed");
	$(".address4").css("display", "block");
	$(".address2").css("display", "none");
	$(".address3").css("display", "none");
	$(".address1").css("display", "none");
	$(".address5").css("display", "none");
	$(".address6").css("display", "none");
	$(".address2title").removeClass("displayed");
	$(".address3title").removeClass("displayed");
	$(".address1title").removeClass("displayed");
	$(".address5title").removeClass("displayed");
	$(".address5title").removeClass("displayed");
	document.getElementById("address4").innerHTML = window.Map4;
	}
	});

$("h4.address5title").mousedown(function(){
	if ($(".address5title").hasClass('displayed')){
		$(".address5title").removeClass("displayed");
		$(".address5").css("display", "none");
	}
	else
	{
	$(".address5title").addClass("displayed");
	$(".address5").css("display", "block");
	$(".address2").css("display", "none");
	$(".address3").css("display", "none");
	$(".address4").css("display", "none");
	$(".address1").css("display", "none");
	$(".address6").css("display", "none");
	$(".address2title").removeClass("displayed");
	$(".address3title").removeClass("displayed");
	$(".address4title").removeClass("displayed");
	$(".address1title").removeClass("displayed");
	$(".address6title").removeClass("displayed");
	document.getElementById("address5").innerHTML = window.Map5;
	}
	});

$("h4.address6title").mousedown(function(){
	if ($(".address6title").hasClass('displayed')){
		$(".address6title").removeClass("displayed");
		$(".address6").css("display", "none");
	}
	else
	{
	$(".address6title").addClass("displayed");
	$(".address6").css("display", "block");
	$(".address2").css("display", "none");
	$(".address3").css("display", "none");
	$(".address4").css("display", "none");
	$(".address5").css("display", "none");
	$(".address1").css("display", "none");
	$(".address2title").removeClass("displayed");
	$(".address3title").removeClass("displayed");
	$(".address4title").removeClass("displayed");
	$(".address5title").removeClass("displayed");
	$(".address1title").removeClass("displayed");
	document.getElementById("address6").innerHTML = window.Map6;
	}
	});




    $("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)  
    $("ul.subnav2").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)  
   
     $("ul.topnav li a").mouseenter(function() { //When trigger is hovered 
         //Following events are applied to the subnav itself (moving subnav up and down)  
         $(this).parent().find("ul.subnav").stop(true, true).slideDown('fast').show(); //Drop down the subnav on click  
   	
         $(this).parent().hover(function() {  
         }, function(){  
             $(this).parent().find("ul.subnav").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up 
	});  
   	
         //Following events are applied to the trigger (Hover events for the trigger)  
         }).hover(function() {  
             $(this).addClass("subhover"); //On hover over, add class "subhover"  
         }, function(){  //On Hover Out  
             $(this).removeClass("subhover"); //On hover out, remove class "subhover"  
     });  
     $("ul.topnav li ul.subnav a").mouseenter(function() { //When trigger is hovered 
              //Following events are applied to the subnav itself (moving subnav up and down)  
              $(this).parent().find("ul.subnav2").stop(true, true).slideDown('fast').show(); //Drop down the subnav on click  
        	
              $(this).parent().hover(function() {  
              }, function(){  
                  $(this).parent().find("ul.subnav2").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up 
     	});  
        	
              //Following events are applied to the trigger (Hover events for the trigger)  
              }).hover(function() {  
                  $(this).addClass("subhover"); //On hover over, add class "subhover"  
              }, function(){  //On Hover Out  
                  $(this).removeClass("subhover"); //On hover out, remove class "subhover"  
     });  
     
});



