﻿(function(j$) {
    j$(document).ready(function() {  			  
		//Transaction lists
		var expanded = false;
		j$('.transaction-list:first').before('<a href="#" class="expand-all">Expand all</a>');
		j$('.expand-all').click(function() {
			if(!expanded) {
				j$('.transaction-list .sf_simpleList').show();
				j$(this).text('Collapse all');
			} else {
				j$('.transaction-list .sf_simpleList').hide();
				j$(this).text('Expand all');
			}

			expanded = !expanded;
		});
		j$('.transaction-list .sf_simpleList').hide();
		j$('.transaction-list .sf_listTitle').wrapInner('<a href="#"></a>');
		j$('.transaction-list .sf_listTitle').click(function() {
			j$(this).siblings('.sf_simpleList').toggle();
		});
		
		//Popup window code
        j$('a').each(function() {
            var popupWindowRegex = /\{[\w\d\s:,&;/\."\[\]\-]*\}/g;
            if (j$(this).attr('class').match('popUp')) {
                var paramsJson = j$(this).attr('class').match(popupWindowRegex); 
                j$(this).click(function() {
                    popUp(paramsJson);
                    return false;
                });
            }
        });	    
//		j$('.main-nav ul.L1').superfish({
//			delay: 500,                            // one second delay on mouseout 
//			animation: { opacity: 'show' },  // fade-in and slide-down animation 
//			speed: 'fast',                          // faster animation speed 
//			autoArrows: false,
//			dropShadows: false
//		});
        Cufon.replace('h1');
        Cufon.replace('.cta-header');	
    });
})(jQuery);


