var gFlyout;
/*  
var tenon_faq = {
	init : function() {
		$('div.faq .faqanswer').slideToggle('fast');
		$('div.faq .faqquestion').click(function() { tenon_faq.toggle(this) });
	},
	
	toggle : function(elt) {
		$(elt).toggleClass('active');
		$(elt).siblings('.faqanswer').slideToggle('fast');
	}
}
*/

$.fn.splitUp=function(splitBy,wrapper){    
	 $all= $(this).find('>*');
	 var fragment=Math.ceil($all.length/splitBy);
	 for (i=0;i<fragment;i++)
	 $all.slice(splitBy*i,splitBy*(i+1)).wrapAll(wrapper);
	 return $(this);
} 


function exit() { return; }

( function($) {
    // we can now rely on $ within the safety of our “bodyguard” function
    $(document).ready(
				  function()
				  {
				     
				  /*    
				  if($('#carousel').length > 0)
				  {
                        $('#carousel').jcarousel({
                            vertical: true,
		                    auto: 8,
		                    //easing: "linear",
		                    //animation: pCarousel.animationSpeed,
                            wrap: 'circular',
                            scroll: 1
                        });
                  }*/
                   
                   
			         $('div.svw').slideView();
		            
	                // $('#carousel').splitUp(2,'<li>') .cycle({
                     $('#carouselstart').cycle({
	                    fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	                    speed:  8000,
						speedIn: 1700
                    });
                    
                    $('#carousel').cycle({
	                    fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	                    speed:  8000,
						speedIn: 1700,
                        delay: 6000
                    });
               
                     $('#carouseltalkingpoint').cycle({
	                    fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	                    speed:  5000,
						speedIn: 1000
                    });
                     $('#carouselrelatedservices').cycle({
	                    fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	                    speed:  5000,
						speedIn: 1000
                    });
                     $('#carouselrelatedmarkets').cycle({
	                    fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	                    speed:  5000,
						speedIn: 1000
                    });
              
				      // hide toggle divs on faqs page
		            $('.AccordionPanelContent').hide();

		            // capture clicks on the faqs toggle links
		            $('h2.AccordionPanelTab').click(function() {

		            // change the link depending on whether the element is shown or hidden
		            if($(this).attr("id") == "selectedQuestion")
		            {
		                $(this).removeAttr("id");
		            }
		            else
		            {
		                //hide other selectedLink
		                $('#selectedQuestion').next('.AccordionPanelContent').toggle('slow');
		                $('#selectedQuestion').removeAttr("id");
		                
		                $(this).attr("id", "selectedQuestion");
		                
		                
		            }

		            // toggle the display
		            $(this).next('.AccordionPanelContent').toggle('slow');

		            // return false so any link destination is not followed
		            return false;
		            }); 
		         
				      
              //  alert( document.cookie );
                //SC_ANALYTICS_GLOBAL_COOKIE=79DAE57F8A8848F4A9FAECAC55CF5164
              //   alert($.cookie("SC_ANALYTICS_GLOBAL_COOKIE"));
                // if 
               //  $("#module_poll").addClass('pollpopup');
                // alert($("#
                 //if 
				  //SitecorePoolCookie_{1C95FFD2-92B3-47A2-97A0-721CF86C921D}
				    $("#opaque").bgiframe();
				        $("#opaque").css("opacity", 0);
				    
				    $("#rightnav a").supersleight();
				      
				    $("ul#topnav > li").hover 
				    (
				        function() 
		                {		                   
		                    if(jQuery.browser.msie)
                            {
                                $(this).addClass('hover');	
                            }     			            		
		                },
		                function()
		                {
		                    if(jQuery.browser.msie)
                            {
			                    $(this).removeClass('hover');
			                }
		                }	
				    )
				   /* 
				    $("ul#triplenav").hover
	                (
		                function() 
		                {
		                    showOpaque();                  
    			            		
		                },
		                function()
		                {
		                    hideOpaque();
		                  
		                }	
	                )
				   
				  
	                $("ul#triplenav > li").hover
	                (
		                function() 
		                {		                   
		                    if(jQuery.browser.version == 6.0 &&  jQuery.browser.msie)
                            {
                                $(this).addClass('hover');	
                            }     			            		
		                },
		                function()
		                {
		                    if(jQuery.browser.version == 6.0 &&  jQuery.browser.msie)
                            {
			                    $(this).removeClass('hover');
			                }
		                }	
	                )
	                 */
	               
	                $("span#showAreas").click
                    (
                    
                         function()
                        {		
				            
                            $("#divPublications").css("display", "block");	
                            showOpaque();            
                        },            
                        function()
                        {
                            hideOpaque();
                        }
          
				      )
				      
				      $("input#btnCloseAreas").click
				     (
				         function()
                        {		
				           
                            hideOpaque();
                            $("#divPublications").css("display", "none");	
                           
                                    
                        },            
                        function()
                        {
                            showOpaque();    
                        }
				      )
	    
                     $("span#showServices").click
                    (
                    
                         function()
                        {		
				            
                            $("#divServices").css("display", "block");	
                            showOpaque();            
                        },            
                        function()
                        {
                            hideOpaque();
                        }
          
				      )
				      
				      $("input#btnCloseServices").click
				     (
				         function()
                        {		
				           
                            hideOpaque();
                            $("#divServices").css("display", "none");	
                           
                                    
                        },            
                        function()
                        {
                            showOpaque();    
                        }
				      )
  
                      
                     $("span#showMarkets").click
                    (
                    
                         function()
                        {		
				            
                            $("#divMarkets").css("display", "block");	
                            showOpaque();            
                        },            
                        function()
                        {
                            hideOpaque();
                        }
          
				      )
				      
				      $("input#btnCloseMarkets").click
				     (
				         function()
                        {		
				           
                            hideOpaque();
                            $("#divMarkets").css("display", "none");	
                           
                                    
                        },            
                        function()
                        {
                            showOpaque();    
                        }
				      )
  
                    $("#optinLink").click
                    (
                         function()
                        {		
				            
                            $("#optinPopup").css("display", "block");	
                
                        },            
                        function()
                        {
    
                        }
          
				      )
				      
				    $("#optinPopupClose").click
                    (
                         function()
                        {		
				            
                            $("#optinPopup").css("display", "none");	
                
                        },            
                        function()
                        {
    
                        }
          
				      )
  
				  }
				  );
				  

function showOpaque()
{
    $("#opaque").css("visibility", "visible");  
    $("#opaque").fadeTo(200, 0.4);
}

function hideOpaque()
{
    //$("#opaque").fadeTo(100, 1);
    $("#opaque").css("visibility", "hidden");    
    $("#opaque").fadeTo(100, 0);
}

function showPopup()
{
    $("#optinPopup").css("display", "block");  
    $("#optinPopup").fadeTo(200, 0.4);
}

function hidePopup()
{
    $("#optinPopup").css("display", "block");    
    $("#optinPopup").fadeTo(100, 0);
}

function KeyDownHandler(e, sBtnID)
{ 
    if(e.which || e.keyCode)
    {
        if ((e.which == 13) || (e.keyCode == 13)) 
        {
            if(e.keyCode)
                document.getElementById(sBtnID).focus();
            document.getElementById(sBtnID).click();
            return false;
        }
    } 
    else 
    {
        return true
    }
    /*
	var characterCode
	if(e && e.which)
	{ 
		e = e;
		characterCode = e.which;
	}
	else
	{
		e = event;
		characterCode = e.keyCode;
	}

	if(characterCode == 13)
	{ 
		var btn = document.getElementById(sBtnID);
		if(btn != 'undefined')
		    btn.click();
		return false;
	}
	else
		return true;
		
		*/

}

;
} ) ( jQuery );

function Q1() {
Question2.style.display='inline'
answer1.style.display='none'
answer2.style.display='none'
answer3.style.display='none'
answer4.style.display='none'
answer5.style.display='none'
answer6.style.display='none'
answer7.style.display='none'
answer8.style.display='none'
answer9.style.display='none'
answer10.style.display='none'
answer11.style.display='none'
answer12.style.display='none'
answer13.style.display='none'
if (mainform.home[1].checked) Q2()
if (mainform.home[0].checked) Q2()
 
}
function Q2() {
Question3.style.display='inline'
answer1.style.display='none'
answer2.style.display='none'
answer3.style.display='none'
answer4.style.display='none'
answer5.style.display='none'
answer6.style.display='none'
answer7.style.display='none'
answer8.style.display='none'
answer9.style.display='none'
answer10.style.display='none'
answer11.style.display='none'
answer12.style.display='none'
answer13.style.display='none'
if (mainform.equity[1].checked) Question4.style.display='none'
if (mainform.equity[0].checked) Question4.style.display='none'
if (mainform.surplus[1].checked) Q3()
if (mainform.surplus[0].checked) Q3()
}
 
function Q3() {
answer1.style.display='none'
answer2.style.display='none'
answer3.style.display='none'
answer4.style.display='none'
answer5.style.display='none'
answer6.style.display='none'
answer7.style.display='none'
answer8.style.display='none'
answer9.style.display='none'
answer10.style.display='none'
answer11.style.display='none'
answer12.style.display='none'
answer13.style.display='none'
if (mainform.equity[1].checked) Question4.style.display='none'
if (mainform.equity[0].checked) Question4.style.display='none'
if (mainform.equity[2].checked) Question4.style.display='none'
if (mainform.debtlevel[1].checked && mainform.home[1].checked && mainform.surplus[1].checked) answer1.style.display='inline'
if (mainform.debtlevel[1].checked && mainform.home[1].checked && mainform.surplus[0].checked) answer2.style.display='inline'
if (mainform.debtlevel[1].checked && mainform.home[0].checked && mainform.surplus[1].checked) Question4.style.display='inline'
if (mainform.debtlevel[1].checked && mainform.home[0].checked && mainform.surplus[0].checked) answer4.style.display='inline'
if (mainform.debtlevel[0].checked && mainform.home[1].checked && mainform.surplus[0].checked) answer5.style.display='inline'
if (mainform.debtlevel[0].checked && mainform.home[1].checked && mainform.surplus[1].checked) answer6.style.display='inline'
if (mainform.debtlevel[0].checked && mainform.home[0].checked ) Question4.style.display='inline'
if (mainform.home[0].checked && mainform.equity[1].checked) Q4()
if (mainform.home[0].checked && mainform.equity[0].checked) Q4()
if (mainform.home[0].checked && mainform.equity[2].checked) Q4()
 
}
 
function Q4() {
 
answer1.style.display='none'
answer2.style.display='none'
answer3.style.display='none'
answer4.style.display='none'
answer5.style.display='none'
answer6.style.display='none'
answer7.style.display='none'
answer8.style.display='none'
answer9.style.display='none'
answer10.style.display='none'
answer11.style.display='none'
answer12.style.display='none'
answer13.style.display='none'
if (mainform.debtlevel[0].checked && mainform.equity[1].checked && mainform.surplus[1].checked) answer7.style.display='inline'
if (mainform.debtlevel[0].checked && mainform.equity[1].checked && mainform.surplus[0].checked) answer13.style.display='inline'
if (mainform.debtlevel[0].checked && mainform.equity[0].checked ) answer8.style.display='inline'
if (mainform.debtlevel[1].checked && mainform.equity[0].checked) answer3.style.display='inline'
if (mainform.debtlevel[1].checked && mainform.equity[1].checked) answer9.style.display='inline'
if (mainform.debtlevel[1].checked && mainform.equity[2].checked) answer10.style.display='inline'
if (mainform.debtlevel[0].checked && mainform.equity[2].checked && mainform.surplus[0].checked) answer11.style.display='inline'
if (mainform.debtlevel[0].checked && mainform.equity[2].checked && mainform.surplus[1].checked) answer12.style.display='inline'
}

