function isIE()
{
  return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent);
}
function openBooklet(url)
{
window.open (url,"booklet","status=0,toolbar=0,location=0,resizable=0,scrollbars=0,fullscreen=yes");
}
if( isIE() )
{
	window.onresize = reposition;
	window.onload = reposition;
}

function reposition()
{
    var x = get_width();
		
var obj2 = document.getElementById('main');

if( obj2 != undefined)
{
		if( x > 962 ){obj2.style.width = x +'px';}
		else{obj2.style.width = '960px';}
}

var obj = document.getElementById('main2');

if( obj != undefined)
{
		if( x > 962 ){obj.style.width = x +'px';}
		else{obj.style.width = '960px';}
}
}
function get_width()
{
    var x = 0;
    if (self.innerHeight){x = self.innerWidth;}
    else if (document.documentElement && document.documentElement.clientHeight){x = document.documentElement.clientWidth;}
    else if (document.body){x = document.body.clientWidth;}return x;
}

$(document).ready(function(){

	// to locate car model
	var path = window.location.pathname;
	var pathSplit = path.split("/");
	var model ="";
	
	if (pathSplit.length >= 2){	
		model=pathSplit[1];
	}
						   
	/** Navigation instructions ----------------------- **/
	
	// Show #navi_popup when mouseenters the Models link

	$("#nav-home").mouseenter(function(){
	   $("#navi_popup").fadeOut("fast");
		 $("#navi_popup_technology").fadeOut("fast");
		 $("#navi_popup_services").fadeOut("fast");
		 $("#navi_popup_community").fadeOut("fast");
	})
	$("#nav-allprices").mouseenter(function(){
	   $("#navi_popup").fadeOut("fast");
		 $("#navi_popup_technology").fadeOut("fast");
		 $("#navi_popup_services").fadeOut("fast");
		 $("#navi_popup_community").fadeOut("fast");
	})
	$("#nav-dealer").mouseenter(function(){
	   $("#navi_popup").fadeOut("fast");
		 $("#navi_popup_technology").fadeOut("fast");
		 $("#navi_popup_services").fadeOut("fast");
		 $("#navi_popup_community").fadeOut("fast");
	})

	$("#nav-models").mouseenter(function(){
	   $("#navi_popup").fadeIn("fast");
	   $(".navi_popup_detail").hide();
	   $("#navi_popup_city").show();
	});

	// When mouseenter a link, hide any open detail panels
	// and show the correct detail panels

	$('#popup_index>li>a[id]').mouseenter(function(){
	   var id = $(this).attr('id');
	   var nav = id.split('-')[1];
	   if (!nav) return;
	   var popup_nav = $('#navi_popup_' + nav);
	   var all_popups = $('.navi_popup_detail');
	   all_popups.not(popup_nav).hide();
	   popup_nav.fadeIn('fast');
	});
	
	// Hide #navi_popup when mouse leaves the div
	
	$("#navi_popup").mouseleave( function() {
		$(this).fadeOut("fast");
	});

// Techonology
	$("#nav-technology").mouseenter(function(){
	   $("#navi_popup").fadeOut("fast");
		 $("#navi_popup_services").fadeOut("fast");
		 $("#navi_popup_community").fadeOut("fast");

	   $("#navi_popup_technology").fadeIn("fast");
	   $(".navi_popup_technology_detail").hide();
		 $("#navi_popup_technology_hondaadvancedtechnology").show();
	});
	
	$('#popup_technology_index>li>a[id]').mouseenter(function(){
	   var id = $(this).attr('id');
	   var nav = id.split('-')[1];
	   if (!nav) return;

	   var popup_nav = $('#navi_popup_technology_' + nav);
	   var all_popups = $('.navi_popup_technology_detail');
	   all_popups.not(popup_nav).hide();
	   popup_nav.fadeIn('fast');
	});
	$("#navi_popup_technology").mouseleave( function() {
		$(this).fadeOut("fast");
	});
	
// Community
	$("#nav-community").mouseenter(function(){
	   $("#navi_popup").fadeOut("fast");
		 $("#navi_popup_technology").fadeOut("fast");
		 $("#navi_popup_services").fadeOut("fast");
		 
	   $("#navi_popup_community").fadeIn("fast");
	   $(".navi_popup_community_detail").hide();
		 $("#navi_popup_community_fund").show();
	});
	
	$('#popup_community_index>li>a[id]').mouseenter(function(){
	   var id = $(this).attr('id');
	   var nav = id.split('-')[1];
	   if (!nav) return;

	   var popup_nav = $('#navi_popup_community_' + nav);
	   var all_popups = $('.navi_popup_community_detail');
	   all_popups.not(popup_nav).hide();
	   popup_nav.fadeIn('fast');
	});
	$("#navi_popup_community").mouseleave( function() {
		$(this).fadeOut("fast");
	});
	
	
	
	// Hide #navi_popup when mouse leaves the div	
	
	
	//Services
	$("#nav-services").mouseenter(function(){
	   $("#navi_popup").fadeOut("fast");
		 $("#navi_popup_technology").fadeOut("fast");
		 $("#navi_popup_community").fadeOut("fast");
		 
	   $("#navi_popup_services").fadeIn("fast");
	   $(".navi_popup_services_detail").hide();
		 $("#navi_popup_services_hondaowners").show();
	});
	
	$('#popup_services_index>li>a[id]').mouseenter(function(){
	   var id = $(this).attr('id');
	   var nav = id.split('-')[1];
	   if (!nav) return;

	   var popup_nav = $('#navi_popup_services_' + nav);
	   var all_popups = $('.navi_popup_services_detail');
	   all_popups.not(popup_nav).hide();
	   popup_nav.fadeIn('fast');
	});
	$("#navi_popup_services").mouseleave( function() {
		$(this).fadeOut("fast");
	});
	
	//show sub navi for services
/*
	$("#nav-services").mouseenter(function(){
	   $("#navi_popup_services").fadeIn("fast");
	});
	
	$("#navi_popup_services").mouseleave( function() {
		$(this).fadeOut("fast");
	});
	*/
	/** Bottom Panel Slider ----------------------- **/


	$("#main").addClass("slide");
$("#main2").addClass("slide");
	
	
	$(".slide #bottom_slider").hoverIntent(
		function(){
			$("#bottom_slider_wrapper").css({'z-index':'20'});
			$("#bottom_slider").stop().animate({top: "25"}, "normal");
		},
		function() {
			$("#bottom_slider").stop().animate({top: "192"}, "normal", 
				function() {
					$("#bottom_slider_wrapper").css({'z-index':'-1'});
				}
			);
		}
	);
	

	/** Bottom Ads Pop-ups ----------------------- **/
	
	$("#trigger_popup_1").click(function () { 
		if ($("#bottom_popup_1").is(":hidden")) {  
			$(".bottom_popup").fadeOut();
			$("#bottom_popup_1").fadeIn();  
			return false;  
			} else {  
			$("#bottom_popup_1").fadeOut();  
			return false;  
		}  
    });
	   
//calculator
   $("#trigger_popup_3").click(function () { 
	pageTracker._trackPageview("/" + model +"/Calculator");
		if ($("#bottom_popup_3").is(":hidden")) {
			var calcelem = document.getElementById('calculator');
			if (calcelem.src == null || calcelem.src == '' || calcelem.src == "null") {
			    $('span#calculatorloading').show();
			    $('iframe#calculator').hide();
			    $('iframe#calculator').attr('src', document.getElementById('calculatorsrc').value);

			    $('iframe#calculator').load(function() 
			    {
			        $('span#calculatorloading').hide();
			        $('iframe#calculator').fadeIn();
			    });				
			}
			$(".bottom_popup").fadeOut();
			$("#bottom_popup_3").fadeIn();  
			return false;  
			} else {  
			$("#bottom_popup_3").fadeOut();  
			return false;  
		}  
    });
   
   // google map
   $("#trigger_popup_4").click(function () { 
	pageTracker._trackPageview("/" + model +"/LocateDealer");
	
		if ($("#bottom_popup_4").is(":hidden")) {  
			var googelem = document.getElementById('googlemap');
			if (googelem.src == null || googelem.src == '' || googelem.src == "null") {
			    $('span#googlemaploading').show();
			    $('iframe#googlemap').hide();
			    $('iframe#googlemap').attr('src', document.getElementById('googlemapsrc').value);

			    $('iframe#googlemap').load(function() 
			    {
			        $('span#googlemaploading').hide();
			        $('iframe#googlemap').fadeIn();
				document.getElementById('googlemap').contentWindow.paintState();
			    });				
			}
			$(".bottom_popup").fadeOut();
			$("#bottom_popup_4").fadeIn();  
			return false;  
			} else {  
			$("#bottom_popup_4").fadeOut();  
			return false;  
		}  
    });
   
   //tell a friend
   $("#trigger_popup_5").click(function () { 
		
		if ($("#bottom_popup_5").is(":hidden")) {  
			$(".bottom_popup").fadeOut();
			$("#bottom_popup_5").fadeIn();  
			return false;  
			} else {  
			$("#bottom_popup_5").fadeOut();  
			return false;  
		}  
    });	
   

   //tell a friend
   $("#trigger_popup_6").click(function () { 
	
		if ($("#bottom_popup_6").is(":hidden")) {  
			$(".bottom_popup").fadeOut();
			$("#bottom_popup_6").fadeIn();  
			return false;  
			} else {  
			$("#bottom_popup_6").fadeOut();  
			return false;  
		}  
    });


//coolextra
   $("#city_popup").mouseenter(function () { 
	//pageTracker._trackPageview("/" + model +"/coolextras");	
         isCityPopup = true;
		if ($("#bottom_popup_2").is(":hidden")) {		
			$(".bottom_popup").fadeOut();
			$("#bottom_popup_2").fadeIn();  
			return false;  
			} else {  
			//$("#bottom_popup_2").fadeOut();  
			return false;  
		}  
    });  
	// closes city popup windows
	$("#city_popup").mouseleave(function () { 
                isCityPopup = false;
	        window.setTimeout(city_delay_hide_popup, 200);
		//$(".bottom_popup").fadeOut();
		//return false; 		
	});

$("#bottom_popup_2").mouseenter(function () { 
isCityPopup = true;
});	
	
$("#bottom_popup_2").mouseleave(function () { 
isCityPopup = false;
window.setTimeout(city_delay_hide_popup, 200);
});	



// Jazz Pop
   $("#jazz_popup").mouseenter(function () { 
	//pageTracker._trackPageview("/" + model +"/coolextras");	
         isJazzPopup = true;
		if ($("#bottom_popup_9").is(":hidden")) {		
			$(".bottom_popup").fadeOut();
			$("#bottom_popup_9").fadeIn();  
			return false;  
			} else {  
			//$("#bottom_popup_9").fadeOut();  
			return false;  
		}  
    });  


	// closes city popup windows
	$("#jazz_popup").mouseleave(function () { 
                isJazzPopup = false;
	        window.setTimeout(jazz_delay_hide_popup, 200);
		//$(".bottom_popup").fadeOut();
		//return false; 		
	});


$("#bottom_popup_9").mouseenter(function () { 
isJazzPopup = true;
});		


$("#bottom_popup_9").mouseleave(function () { 
isJazzPopup = false;
window.setTimeout(jazz_delay_hide_popup, 200);
});	

// Committed To You Pop
   $("#committedtoyou_popup").mouseenter(function () { 
	//pageTracker._trackPageview("/" + model +"/coolextras");	
         isCommittedPopup = true;
		if ($("#bottom_popup_11").is(":hidden")) {		
			$(".bottom_popup").fadeOut();
			$("#bottom_popup_11").fadeIn();  
			return false;  
			} else {  
			//$("#bottom_popup_11").fadeOut();  
			return false;  
		}  
    });  


	// closes committed popup windows
	$("#committedtoyou_popup").mouseleave(function () { 
                isCommittedPopup = false;
	        window.setTimeout(committed_delay_hide_popup, 200);
		//$(".bottom_popup").fadeOut();
		//return false; 		
	});


$("#bottom_popup_11").mouseenter(function () { 
isCommittedPopup = true;
});		


$("#bottom_popup_11").mouseleave(function () { 
isCommittedPopup = false;
window.setTimeout(committed_delay_hide_popup, 200);
});	


// festive1 popup
   $("#festive1_popup").mouseenter(function () { 
	//pageTracker._trackPageview("/" + model +"/coolextras");	
         isFestivePopup1 = true;
		if ($("#bottom_popup_12").is(":hidden")) {		
			$(".bottom_popup").fadeOut();
			$("#bottom_popup_12").fadeIn();  
			return false;  
			} else {  
			//$("#bottom_popup_12").fadeOut();  
			return false;  
		}  
    });  


	// closes committed popup windows
	$("#festive1_popup").mouseleave(function () { 
                isFestivePopup1 = true;
	        window.setTimeout(festive1_delay_hide_popup, 200);
		//$(".bottom_popup").fadeOut();
		//return false; 		
	});


$("#bottom_popup_12").mouseenter(function () { 
isFestivePopup1 = true;
});		


$("#bottom_popup_12").mouseleave(function () { 
isFestivePopup1 = false;
window.setTimeout(festive1_delay_hide_popup, 200);
});	


// festive2 popup
   $("#festive2_popup").mouseenter(function () { 
	//pageTracker._trackPageview("/" + model +"/coolextras");	
         isFestivePopup2 = true;
		if ($("#bottom_popup_13").is(":hidden")) {		
			$(".bottom_popup").fadeOut();
			$("#bottom_popup_13").fadeIn();  


			return false;  
			} else {  
			//$("#bottom_popup_13").fadeOut();  
			return false;  
		}  
    });  


	// closes committed popup windows
	$("#festive2_popup").mouseleave(function () { 
                isFestivePopup2 = true;
	        window.setTimeout(festive2_delay_hide_popup, 200);
		//$(".bottom_popup").fadeOut();
		//return false; 		
	});


$("#bottom_popup_13").mouseenter(function () { 
isFestivePopup2 = true;
});		


$("#bottom_popup_13").mouseleave(function () { 
isFestivePopup2 = false;
window.setTimeout(festive2_delay_hide_popup, 200);
});	

// festive3 popup
   $("#festive3_popup").mouseenter(function () { 
	//pageTracker._trackPageview("/" + model +"/coolextras");	
         isFestivePopup3 = true;
		if ($("#bottom_popup_14").is(":hidden")) {		
			$(".bottom_popup").fadeOut();
			$("#bottom_popup_14").fadeIn();  

			return false;  
			} else {  
			//$("#bottom_popup_14").fadeOut();  
			return false;  
		}  
    });  


	// closes benefit popup windows
	$("#festive3_popup").mouseleave(function () { 
                isFestivePopup3 = true;
	        window.setTimeout(festive3_delay_hide_popup, 200);
		//$(".bottom_popup").fadeOut();
		//return false; 		
	});


$("#bottom_popup_14").mouseenter(function () { 
isFestivePopup3 = true;
});		


$("#bottom_popup_14").mouseleave(function () { 
isFestivePopup3 = false;
window.setTimeout(festive3_delay_hide_popup, 200);
});	
// end festive3 popup

// socialresponsibility4 popup
   $("#socialresponsibility4_popup").mouseenter(function () { 
	//pageTracker._trackPageview("/" + model +"/coolextras");	
         isSocialresponsibility4 = true;
		if ($("#bottom_popup_15").is(":hidden")) {		
			$(".bottom_popup").fadeOut();
			$("#bottom_popup_15").fadeIn();  

			return false;  
			} else {  
			//$("#bottom_popup_15").fadeOut();  
			return false;  
		}  
    });  


	// closes benefit popup windows
	$("#socialresponsibility4_popup").mouseleave(function () { 
                isSocialresponsibility4 = true;
	        window.setTimeout(socialresponsibility4_delay_hide_popup, 200);
		//$(".bottom_popup").fadeOut();
		//return false; 		
	});


$("#bottom_popup_15").mouseenter(function () { 
isSocialresponsibility4 = true;
});		


$("#bottom_popup_15").mouseleave(function () { 
isSocialresponsibility4 = false;
window.setTimeout(socialresponsibility4_delay_hide_popup, 200);
});	
// end socialresponsibility4 popup

   $("#accord_popup").mouseenter(function () { 
	//pageTracker._trackPageview("/" + model +"/coolextras");	
         isAccordPopup  = true;
		if ($("#bottom_popup_10").is(":hidden")) {		
			$(".bottom_popup").fadeOut();
			$("#bottom_popup_10").fadeIn();  
			return false;  
			} else {  
			//$("#bottom_popup_10").fadeOut();  
			return false;  
		}  
    });  


	// closes accord popup windows
	$("#accord_popup").mouseleave(function () { 
                isAccordPopup  = false;
	        window.setTimeout(accord_delay_hide_popup, 200);
		//$(".bottom_popup").fadeOut();
		//return false; 		
	});


$("#bottom_popup_10").mouseenter(function () { 
isAccordPopup = true;
});		


$("#bottom_popup_10").mouseleave(function () { 
isAccordPopup  = false;
window.setTimeout(accord_delay_hide_popup, 200);
});


   $("#civichybrid_popup").mouseenter(function () { 
	//pageTracker._trackPageview("/" + model +"/DiscoverMore");
         isCivicHybridPopup  = true;	
		if ($("#bottom_popup_7").is(":hidden")) {  
			// alert("ima");
			$(".bottom_popup").fadeOut();
			$("#bottom_popup_7").fadeIn();  
			return false;  
			} else {  
			//$("#bottom_popup_7").fadeOut();  
			return false;  
		}  
    });	

    

	// closes civic hybrid popup windows
	$("#civichybrid_popup").mouseleave(function () { 
                isCivicHybridPopup = false;
	        window.setTimeout(civichybrid_delay_hide_popup, 200);
		//$(".bottom_popup").fadeOut();
		//return false; 		
	});

$("#bottom_popup_7").mouseenter(function () { 
isCivicHybridPopup = true;
});	

	
$("#bottom_popup_7").mouseleave(function () { 
isCivicHybridPopup = false;
window.setTimeout(civichybrid_delay_hide_popup, 200);
});	

   $("#insight_popup").mouseenter(function () { 
	//pageTracker._trackPageview("/" + model +"/DiscoverMore");
         isInsightPopup  = true;	
		if ($("#bottom_popup_16").is(":hidden")) {  
			// alert("ima");
			$(".bottom_popup").fadeOut();
			$("#bottom_popup_16").fadeIn();  
			return false;  
			} else {  
			//$("#bottom_popup_16").fadeOut();  
			return false;  
		}  
    });	


	// closes Insight popup windows
	$("#insight_popup").mouseleave(function () { 
                isInsightPopup = false;
	        window.setTimeout(insight_delay_hide_popup, 200);
		//$(".bottom_popup").fadeOut();
		//return false; 		
	});

$("#bottom_popup_16").mouseenter(function () { 
isInsightPopup = true;
});	

	
$("#bottom_popup_16").mouseleave(function () { 
isInsightPopup = false;
window.setTimeout(insight_delay_hide_popup, 200);
});	

    // civic roadshow
   //$("#civic_popup").click(function () { 
/*   $("#civic_popup").mouseenter(function () { 
	//pageTracker._trackPageview("/" + model +"/ExperienceTheCivic");
         isCivicPopup = true;
		if ($("#bottom_popup_8").is(":hidden")) {  
			
			$(".bottom_popup").fadeOut();
			$("#bottom_popup_8").fadeIn();  
			return false;  
			} else {  
			//$("#bottom_popup_8").fadeOut();  
			return false;  
		}  
    });    

$("#bottom_popup_8").mouseenter(function () { 
isCivicPopup = true;
});		

$("#bottom_popup_8").mouseleave(function () { 
isCivicPopup = false;
window.setTimeout(civic_delay_hide_popup, 200);
});	

	// closes civic popup windows
	$("#civic_popup").mouseleave(function () { 
                isCivicPopup = false;
	        window.setTimeout(civic_delay_hide_popup, 200);
		//$(".bottom_popup").fadeOut();
		//return false; 		
	});
*/
	// closes all popup windows
	$("a.popup_close").click(function () {
		$(this).parents(".bottom_popup").fadeOut();
		return false; 		
	});
	

	$("a.tellfriend_popup_close").click(function () {
		document.getElementById('tellfriend').src = document.getElementById('tellfriend').src;
		$(this).parents(".bottom_popup").fadeOut();
		return false; 		
	});
	
	
	/** Interface effects / enhancements ----------------------- **/
	
	// faux drop down select
	$("a.dd_selected").click(function () {
isClickOnDropDown = false;
		if ( $(this).parent(".dropdown").hasClass("open") ) {
			$(this).parent(".dropdown").removeClass("open");
			$(this).siblings(".dd_options").slideUp("fast");
			return false;
		} else {
			$(this).parent(".dropdown").addClass("open");
			$(this).siblings(".dd_options").slideDown("fast");
			return false;
		}
	});

$("a.dd_selected").siblings(".dd_options").click(function() {
isClickOnDropDown = true;
});


	$(document).click(function() {

if( isClickOnDropDown ){isClickOnDropDown = false;return;}

		if ( $("a.dd_selected").parent(".dropdown").hasClass("open") ) {
			$("a.dd_selected").parent(".dropdown").removeClass("open");
			$("a.dd_selected").siblings(".dd_options").slideUp("fast");
			return false;
		}
	});
	// faux drop down select
	$("a.dd_selected2").click(
		function () {
			if ( $(this).parent(".dropdown2").hasClass("open2") ) {
				$(this).parent(".dropdown2").removeClass("open2");
				$(this).siblings(".dd_options2").slideUp("fast");
				return false;
			} else {
				$(this).parent(".dropdown2").addClass("open2");
				$(this).siblings(".dd_options2").slideDown("fast");
				return false;
			}
	});
	
	

	/** Helper functions / effects ----------------------- **/
	
	// wraps cell contents of comparison table 
	// with <div class="spacer"> 
	$(".which td").not(".spacer").wrapInner("<div class='padding'></div>");
	$(".pricing td").not(".spacer").wrapInner("<div class='padding'></div>");
					
});
	

// jQzoom needs to have it's own document ready function
$(document).ready(function(){
	$('.jqzoom').jqzoom();
});

// Menu to tracker
var isClickOnDropDown = false;
var isCivicPopup = false;
var isCivicHybridPopup = false;
var isInsightPopup = false;
var isCityPopup = false;
var isJazzPopup = false;
var isCommittedPopup = false;
var isAccordPopup = false;
var isFestivePopup1 = false;
var isFestivePopup2 = false;
var isFestivePopup3 = false;
var isSocialresponsibility4 = false;

	function accord_delay_hide_popup()
        {
             if( isAccordPopup )return;
             $(".bottom_popup").fadeOut();
        }

	function jazz_delay_hide_popup()
	{
             if( isJazzPopup )return;
             $(".bottom_popup").fadeOut();
        }

	function committed_delay_hide_popup()
	{
             if( isCommittedPopup )return;
             $(".bottom_popup").fadeOut();
        }

	function festive1_delay_hide_popup()
	{
             if( isFestivePopup1 )return;
             $(".bottom_popup").fadeOut();
        }

	function festive2_delay_hide_popup()
	{
             if( isFestivePopup2 )return;
             $(".bottom_popup").fadeOut();
        }
	function festive3_delay_hide_popup()
	{
             if( isFestivePopup3 )return;
             $(".bottom_popup").fadeOut();
        }
    function socialresponsibility4_delay_hide_popup()
	{
             if( isSocialresponsibility4 )return;
             $(".bottom_popup").fadeOut();
        }    
    
	function civic_delay_hide_popup()
	{
             if( isCivicPopup )return;
             $(".bottom_popup").fadeOut();
        }

	function civichybrid_delay_hide_popup()
        {
             if( isCivicHybridPopup )return;
             $(".bottom_popup").fadeOut();
        }

    function insight_delay_hide_popup()
        {
             if( isInsightPopup )return;
             $(".bottom_popup").fadeOut();
        }

	function city_delay_hide_popup()
        {
             if( isCityPopup )return;
             $(".bottom_popup").fadeOut();
        }

	function doTracker(tag, url, popup)
	{
		if( tag != "" )
                {
			pageTracker._trackPageview('/homepage/click-internal/highlight-' + tag);
		}

		if( popup == "true")
			window.open(url, "1");
		else
			location.href = url;
	}

	function doGATracker(tag)
	{
		alert(tag);
		if( tag != "" )
                {
			pageTracker._trackPageview(tag);
		}
	}


function popupwindow(url)
{
window.open(url, "popup");
}

//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2007 Adobe Systems Incorporated.  All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '';
  if (isIE && isWin && !isOpera)
  {
    str += '<object ';
    for (var i in objAttrs)
    {
      str += i + '="' + objAttrs[i] + '" ';
    }
    str += '>';
    for (var i in params)
    {
      str += '<param name="' + i + '" value="' + params[i] + '" /> ';
    }
    str += '</object>';
  }
  else
  {
    str += '<embed ';
    for (var i in embedAttrs)
    {
      str += i + '="' + embedAttrs[i] + '" ';
    }
    str += '> </embed>';
  }

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
      case "id":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}


/** Accordion for News/Events Page ----------------------- **/
$(document).ready(function()
{
  //hide the all of the element with class msg_body
  $(".accordion_content1").show();
  $(".accordion_content").hide();
  
  
  //this funtion is to show the first accordion content will always be visible
  $(".toggler1").click(function()
  {
    $(this).next(".accordion_content1").slideToggle();
  });
  //toggle the content out
  $(".toggler").click(function()
  {
    $(this).next(".accordion_content").slideToggle();
  });
});





