function AllCards() {
	
	this.init = function() {
		this.initJumpList();
		showcase.initFisheye();
		showcase.initCardOverflowButtons();
		showcase.finderFilterInit();
		showcase.initCardHover();
		this.initClickSubFilters();
		this.doSIFR();
	}
	
	this.unInit = function() {
		showcase.unInitFisheye();
	}
	
	this.initJumpList = function() {
		$('#btn-apply-card').click(function() {
			var sel = document.getElementById('select-apply-card');
			var href = sel.options[sel.selectedIndex].value;
			if (href.length > 0) {
				window.location = href;
			}
		});
	}
	
	/**
	* Initialises the extra functionality when the sub filters are clicked
	*
	*/
	this.initClickSubFilters = function () {
		$('.allcardsFilter').click(function() {
			allcards.subFilterClick($(this));
		});
	}
	
	/**
	* This function is called when the subfilters are clicked
	*
	*/
	this.subFilterClick = function(object) {
		$('.allcardsFilter').css('background-position','100% 0px');
		$('.allcardsFilter').children().css('background-position','0px 0px');
		object.css('background-position','100% -28px');
		object.children().css('background-position','0px -28px');
	}
	
	
	this.doSIFR = function()  {
		if (GlobalHeaders.isJapanese() == true) return;
		if (GlobalHeaders.isCantanese() == true) return;
		if (typeof sIFR == "function") {
			
			// check for noSIFR flag
			if ($('#content').hasClass('noSIFR') == 1) return;
			
			// sIFR wMode causes strange layout issues, so read current color styles to apply to sIFR
			// define templates
			var strapline1 = named({
				
				sColor:		rgb2hex($('#strapline1 h2').css('color')),
				sBgColor:	rgb2hex($('#strapline1 h2').css('background-color')),
				sCase:		"upper",
				sFlashVars:	"textalign=center"
			});
			var strapline2 = named({
				
				sColor:		rgb2hex($('#strapline2 h2').css('color')),
				sBgColor:	rgb2hex($('#strapline2 h2').css('background-color')),
				sCase:		"upper",
				sFlashVars:	"textalign=center"
			});
			
			var applyHeading = named({
				
				sColor:		rgb2hex($('.leftColumn h3').css('color')),
				sWmode: "transparent",
				sFlashVars:	"textalign=left"
			});

			var helpHeading = named({
				
				sColor:		rgb2hex($('.rightColumn h3').css('color')),
				sWmode: "transparent",
				sFlashVars:	"textalign=left"
			});

			var filterBy = named({
				
				sColor:		rgb2hex($('#filterBy h3').css('color')),
				sBgColor:	rgb2hex($('#filterBy h3').css('background-color')),
				sFlashVars:	"textalign=left"
			});
			//textalign=center in FlashVars is causing problems with 'low graphic' stylesheet (css/light/light.css)
	
			// replace elements
			sIFR.replaceElement('#strapline1 h2', strapline1);
			sIFR.replaceElement('#strapline2 h2', strapline2);
			sIFR.replaceElement('.leftColumn h3', applyHeading);
			sIFR.replaceElement('.rightColumn h3', helpHeading);
			sIFR.replaceElement('#filterBy h3', filterBy);
		};
	}
}

//Function to fix the characters truncating issue in Cantanese pages
var changeLineHeightforCn = 
{
	init: function () { 
		if (GlobalHeaders.isCantanese() == false) return;
		$('.contactRightColumn h3 ').css('line-height','1.4');
		$('.showcaseFisheyeItem .cardName').css('line-height','1.4');
		$('#h-page-tools a').css('line-height','1.4');
		$('.appBoxHeader h3').css('line-height','1.4');		
	}

}

$(document).ready(function(){
	showcase = new Showcase();
	allcards = new AllCards(showcase);
	allcards.init();
	changeLineHeightforCn.init();
});
