/**
 * --------------------------------------------------------------------
 * jQuery-Plugin "pngFix"
 * Version: 1.1, 11.09.2007
 * by Andreas Eberhard, andreas.eberhard@gmail.com
 *                      http://jquery.andreaseberhard.de/
 *
 * Copyright (c) 2007 Andreas Eberhard
 * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
 *
 * Changelog:
 *    11.09.2007 Version 1.1
 *    - removed noConflict
 *    - added png-support for input type=image
 *    - 01.08.2007 CSS background-image support extension added by Scott Jehl, scott@filamentgroup.com, http://www.filamentgroup.com
 *    31.05.2007 initial Version 1.0
 * --------------------------------------------------------------------
 * @example $(function(){$(document).pngFix();});
 * @desc Fixes all PNG's in the document on document.ready
 *
 * jQuery(function(){jQuery(document).pngFix();});
 * @desc Fixes all PNG's in the document on document.ready when using noConflict
 *
 * @example $(function(){$('div.examples').pngFix();});
 * @desc Fixes all PNG's within div with class examples
 *
 * @example $(function(){$('div.examples').pngFix( { blankgif:'ext.gif' } );});
 * @desc Fixes all PNG's within div with class examples, provides blank gif for input with png
 * --------------------------------------------------------------------
 */

(function($) {

jQuery.fn.pngFix = function(settings) {

	// Settings
	settings = jQuery.extend({
		blankgif: 'blank.gif'
	}, settings);

	var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1);
	var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);

	if (jQuery.browser.msie && (ie55 || ie6)) {

		//fix images with png-source
		jQuery(this).find("img[@src$=.png]").each(function() {

			jQuery(this).attr('width',jQuery(this).width());
			jQuery(this).attr('height',jQuery(this).height());

			var prevStyle = '';
			var strNewHTML = '';
			var imgId = (jQuery(this).attr('id')) ? 'id="' + jQuery(this).attr('id') + '" ' : '';
			var imgClass = (jQuery(this).attr('class')) ? 'class="' + jQuery(this).attr('class') + '" ' : '';
			var imgTitle = (jQuery(this).attr('title')) ? 'title="' + jQuery(this).attr('title') + '" ' : '';
			var imgAlt = (jQuery(this).attr('alt')) ? 'alt="' + jQuery(this).attr('alt') + '" ' : '';
			var imgAlign = (jQuery(this).attr('align')) ? 'float:' + jQuery(this).attr('align') + ';' : '';
			var imgHand = (jQuery(this).parent().attr('href')) ? 'cursor:hand;' : '';
			if (this.style.border) {
				prevStyle += 'border:'+this.style.border+';';
				this.style.border = '';
			}
			if (this.style.padding) {
				prevStyle += 'padding:'+this.style.padding+';';
				this.style.padding = '';
			}
			if (this.style.margin) {
				prevStyle += 'margin:'+this.style.margin+';';
				this.style.margin = '';
			}
			var imgStyle = (this.style.cssText);

			strNewHTML += '<span '+imgId+imgClass+imgTitle+imgAlt;
			strNewHTML += 'style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+imgAlign+imgHand;
			strNewHTML += 'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;';
			strNewHTML += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + jQuery(this).attr('src') + '\', sizingMethod=\'scale\');';
			strNewHTML += imgStyle+'"></span>';
			if (prevStyle != ''){
				strNewHTML = '<span style="position:relative;display:inline-block;'+prevStyle+imgHand+'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;'+'">' + strNewHTML + '</span>';
			}

			jQuery(this).hide();
			jQuery(this).after(strNewHTML);

		});

		// fix css background pngs
		jQuery(this).find("*").each(function(){
			var bgIMG = jQuery(this).css('background-image');
			if(bgIMG.indexOf(".png")!=-1){
				var iebg = bgIMG.split('url("')[1].split('")')[0];
				jQuery(this).css('background-image', 'none');
				jQuery(this).get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + iebg + "',sizingMethod='scale')";
			}
		});
		
		//fix input with png-source
		jQuery(this).find("input[@src$=.png]").each(function() {
			var bgIMG = jQuery(this).attr('src');
			jQuery(this).get(0).runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + bgIMG + '\', sizingMethod=\'scale\');';
   		jQuery(this).attr('src', settings.blankgif)
		});	
	}	
	return jQuery;

};

})(jQuery);



(function($){   
 $.fn.make_tabs = function(opts) {  
    var defaults = {  
		item_selector:'.info_item',
		link_selector:'.info_heading',
		content_selector:'.info_content'
    };   
    var o = $.extend(defaults, opts); 
	
    return this.each(function() { 
		var selfref=$(this);
		var tabend=$('<span class="tab_end"><img alt="" src="/images/spacer.gif"/></span>')
		var links=	$(o.link_selector +' h3',selfref).each(function(){
			var t=$(this);
			if(!(t.children('span:last-child').hasClass('tab_end'))){
				t.append(tabend);
			}
		});
		if(links.length>1){
			links.css('cursor','pointer');
		}
		selfref.displayHolder = $('<div class="tab_display"></div>')
		$(o.item_selector+':last',selfref).addClass("last").after(selfref.displayHolder);
		selfref.showItem = function(toShow){		
			$(o.item_selector,this).removeClass("tab_open").addClass("tab_closed");
			$(o.content_selector,this).css('display','none');
			$(toShow).addClass("tab_open").removeClass("tab_closed");			
			this.displayHolder.html($(o.content_selector,toShow).html());
		} 
		$(o.item_selector,selfref).each(function(i){
			var me	= this;
			$(o.link_selector, this).click(function(){selfref.showItem(me);});
		;});
		
		selfref.showItem($(o.item_selector,selfref)[0]);
    }); 	
 };   
})(jQuery);





/* tabulate */
(function($){   
 $.fn.tabulate = function(opts) {  
    var defaults = {  
		cell_selector:'.Item'
    };   
    var o = $.extend(defaults, opts);  
    return this.each(function() { 
		var selfref=$(this);
        var cells = $(o.cell_selector,selfref).css({'float':'left','display':'block'});
		var cols = Math.floor(selfref.innerWidth()/cells.outerWidth());
		if(cells.length > 0){
			cells.each(function(i){
				if(i%cols == cols-1 || i == cells.length-1){
					$(this).after($('<div class="divider" style="clear:left"></div>'));
				}
			});				
			var heights=[];
			function setHeights(e){
				cells.each(function(i){
					var myRow=Math.floor(i/cols);
					$(this).css("height","auto");
					var myH = $(this).height();
					if(heights[myRow]==undefined || heights[myRow]==null || heights[myRow] < myH){
						heights[myRow]=myH;
					}
				});	
				cells.each(function(i){
					var myRow=Math.floor(i/cols);
					 $(this).css("height",heights[myRow]+"px");				
				});				
			}
			$('img',cells).bind('load',function(e){setHeights(e);});
			setHeights();			
		}
    });   
 };   
})(jQuery);







// popup function appears on the product page and can be used to display different types of page.
// the dimensions etc of the pop-ups can be modified here to suit the site and page type
// Current page types:
//	1 = info page (size chart, delivery details etc)
//  2 = image zoom either a large image, or the zoomify component

function popup(popupType, popUpURL){
	if(popupType == 1){
		window.open(popUpURL, "info_window", "width=550,height=580,toolbar=no,header=no,location=no,resizable=1,scrollbars=0");	
	}else if(popupType == 2){
		window.open(popUpURL, "zoom_window", "width=550,height=580,toolbar=no,header=no,location=no,resizable=1,scrollbars=0");
	}else if(popupType == 4){
		$("p.Matrix").hide();
		var closeButton = $('<a href="#" class="close">close X</a>').bind('click', function(){$("#pricing_matrix").hide();}).bind('click', function(){$("p.Matrix").show()});
		var PM =  $("#pricing_matrix");
		 if(PM.hasClass('display')){
			 PM.show()
			 }
			 else{PM.show().append(closeButton).addClass('display');}
	}else{
		window.open(popUpURL, "info_window", "width=400,height=420,toolbar=no,header=no,location=no,resizable=1,scrollbars=0");
	}
}


;(function(){var $$;$$=jQuery.fn.flash=function(htmlOptions,pluginOptions,replace,update){var block=replace||$$.replace;pluginOptions=$$.copy($$.pluginOptions,pluginOptions);if(!$$.hasFlash(pluginOptions.version)){if(pluginOptions.expressInstall&&$$.hasFlash(6,0,65)){var expressInstallOptions={flashvars:{MMredirectURL:location,MMplayerType:'PlugIn',MMdoctitle:jQuery('title').text()}};}else if(pluginOptions.update){block=update||$$.update;}else{return this;}}htmlOptions=$$.copy($$.htmlOptions,expressInstallOptions,htmlOptions);return this.each(function(){block.call(this,$$.copy(htmlOptions));});};$$.copy=function(){var options={},flashvars={};for(var i=0;i<arguments.length;i++){var arg=arguments[i];if(arg==undefined)continue;jQuery.extend(options,arg);if(arg.flashvars==undefined)continue;jQuery.extend(flashvars,arg.flashvars);}options.flashvars=flashvars;return options;};$$.hasFlash=function(){if(/hasFlash\=true/.test(location))return true;if(/hasFlash\=false/.test(location))return false;var pv=$$.hasFlash.playerVersion().match(/\d+/g);var rv=String([arguments[0],arguments[1],arguments[2]]).match(/\d+/g)||String($$.pluginOptions.version).match(/\d+/g);for(var i=0;i<3;i++){pv[i]=parseInt(pv[i]||0);rv[i]=parseInt(rv[i]||0);if(pv[i]<rv[i])return false;if(pv[i]>rv[i])return true;}return true;};$$.hasFlash.playerVersion=function(){try{try{var axo=new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');try{axo.AllowScriptAccess='always';}catch(e){return'6,0,0';}}catch(e){}return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g,',').match(/^,?(.+),?$/)[1];}catch(e){try{if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){return(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1];}}catch(e){}}return'0,0,0';};$$.htmlOptions={flashvars:{},pluginspage:'http://www.adobe.com/go/getflashplayer',src:'#',type:'application/x-shockwave-flash'};$$.pluginOptions={expressInstall:false,update:true,version:'6.0.65'};$$.replace=function(htmlOptions){this.innerHTML='<div class="alt">'+this.innerHTML+'</div>';jQuery(this).addClass('flash-replaced').prepend($$.transform(htmlOptions));};$$.update=function(htmlOptions){var url=String(location).split('?');url.splice(1,0,'?hasFlash=true&');url=url.join('');var msg='<p>This content requires the Flash Player. <a href="http://www.adobe.com/go/getflashplayer">Download Flash Player</a>. Already have Flash Player? <a href="'+url+'">Click here.</a></p>';this.innerHTML='<span class="alt">'+this.innerHTML+'</span>';jQuery(this).addClass('flash-update').prepend(msg);};function toAttributeString(){var s='';for(var key in this)if(typeof this[key]!='function')s+=key+'="'+this[key]+'" ';return s;};function toFlashvarsString(){var s='';for(var key in this)if(typeof this[key]!='function')s+=key+'='+encodeURIComponent(this[key])+'&';return s.replace(/&$/,'');};$$.transform=function(htmlOptions){htmlOptions.toString=toAttributeString;if(htmlOptions.flashvars)htmlOptions.flashvars.toString=toFlashvarsString;return'<embed '+String(htmlOptions)+'/>';};if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};});}})();

jQuery.fn.sifr=function(prefs){var p=jQuery.extend((prefs===false)?{unsifr:true}:{},arguments.callee.prefs,prefs);if(p.save){arguments.callee.prefs=jQuery.extend(p,{save:false});}if(this[0]===document){return;}if(!p.unsifr&&typeof p.before==='function'){p.before.apply(this,[p]);}this.each(function(){var t=jQuery(this);var a=t.children('.sIFR-alternate');if(a){t.html(a.html());if(p.unsifr){return;}}if(typeof p.beforeEach==='function'){p.beforeEach.apply(this,[t,p]);}var s=t.html('<span class="flash-replaced sIFR-replaced">'+(p.content||t.html()).replace(/^\s+|\s+$/g,'')+'</span>').children();a=t.append('<span class="alt sIFR-alternate">'+s.html()+'</span>').children('.sIFR-alternate');if(a.css('display')!=='none'){a.css('display','none');}var toHex=function(c){var h=function(n){if(n===0||isNaN(n)){return'00';}n=Math.round(Math.min(Math.max(0,n),255));return'0123456789ABCDEF'.charAt((n-n%16)/16)+'0123456789ABCDEF'.charAt(n%16);};c=(c)?c.replace(/rgb|\(|\)|#$/g,''):false;if(!c){return false;}if(c.indexOf(',')>-1){c=c.split(', ');return'#'+h(c[0])+h(c[1])+h(c[2]);}if(c.search('#')>-1&&c.length<=4){c=c.split('');return'#'+c[1]+c[1]+c[2]+c[2]+c[3]+c[3];}return c;};if(p.textTransform){if(p.textTransform.toLowerCase()==='uppercase'){s.html(s.html().toUpperCase());}if(p.textTransform.toLowerCase()==='lowercase'){s.html(s.html().toLowerCase());}if(p.textTransform.toLowerCase()==='capitalize'){var c=s.html().replace(/\>/g,'> ').split(' ');for(var i=0;i<c.length;i=i+1){c[i]=c[i].charAt(0).toUpperCase()+c[i].substring(1);}s.html(c.join(' ').replace(/\> /g,'>'));}}var f={flashvars:jQuery.extend({h:s.height()*(p.zoom||1),offsetLeft:p.offsetLeft||undefined,offsetTop:p.offsetTop||undefined,textAlign:p.textAlign||(/(left|center|right)/.exec(t.css('textAlign'))||['center'])[0],textColor:toHex(p.color||t.css('color'))||undefined,txt:p.content||s.html(),underline:(p.underline||(p.underline!==false&&t.css('textDecoration')==='underline'))?true:undefined,w:(p.width||s.width())*(p.zoom||1)},p.flashvars),height:p.height||s.height(),src:(p.path||'')+((p.path&&p.path.substr(p.path.length-1)!=='/')?'/':'')+(p.font||'')+((p.font&&p.font.indexOf('.swf')===-1)?'.swf':''),width:p.width||s.width(),wmode:'transparent'};f.flashvars.linkColor=toHex(p.link||t.find('a').css('color'))||f.flashvars.textColor;f.flashvars.hoverColor=toHex(p.hover)||f.flashvars.linkColor;if(p.zoom){f.flashvars.offsetTop=((p.offsetTop||0)+((s.height()-(s.height()*p.zoom))/2))*(p.zoomTop||1);f.flashvars.offsetLeft=((p.offsetLeft||0)+((s.width()-(s.width()*p.zoom))/2))*(p.zoomLeft||1);}t.flash(jQuery.extend(f,p.embedOptions),jQuery.extend({expressInstall:p.expressInstall||false,version:p.version||7,update:p.update||false},p.pluginOptions),function(f){var preHeight=t.height();var preWidth=t.width();s.html(jQuery.fn.flash.transform(f));var e=s.find(':first');e.css({verticalAlign:'text-bottom',display:'inline',width:p.width,height:p.height});var marginBottom=preHeight-t.height();var width=parseInt(e.css('width'),10)+parseInt(preWidth-t.width(),10);if(!p.height){e.css({marginBottom:marginBottom});}if(!p.width){e.css({width:width});}if(p.height&&p.verticalAlign==='middle'){e.css({marginTop:Math.floor((p.height-s.height())/2),marginBottom:Math.round((p.height-s.height())/2),height:s.height()});e.attr('height',s.height());}if(p.height&&p.verticalAlign==='bottom'){var a=t.find('.sIFR-alternate');e.css({marginTop:(p.height-s.height()),height:s.height()});e.attr('height',s.height());}if(p.css){e.css(p.css);}});if(typeof p.afterEach==='function'){p.afterEach.apply(this,[t,p]);}});if(!p.unsifr&&typeof p.after==='function'){p.after.apply(this,[p]);}};jQuery.sifr=function(prefs){jQuery().sifr(jQuery.extend({save:true},prefs));};jQuery.fn.unsifr=function(){return this.each(function(){jQuery(this).sifr(false);});};









/*
Stylish Select 0.4.1 - $ plugin to replace a select drop down box with a stylable unordered list
http://scottdarby.com/

Requires: jQuery 1.3 or newer

Contributions from Justin Beasley: http://www.harvest.org/ & Anatoly Ressin: http://www.artazor.lv/

Dual licensed under the MIT and GPL licenses.

*/
(function($){

    //add class of js to html tag
    $('html').addClass('stylish-select');

    //create cross-browser indexOf
    Array.prototype.indexOf = function (obj, start) {
        for (var i = (start || 0); i < this.length; i++) {
            if (this[i] == obj) {
                return i;
            }
        }
    }
	
    //utility methods
    $.fn.extend({
        getSetSSValue: function(value){
            if (value){
                //set value and trigger change event
                $(this).val(value).change();
                return this;
            } else {
                return $(this).find(':selected').val();
            }
        },
        //added by Justin Beasley
        resetSS: function(){
            var oldOpts = $(this).data('ssOpts');
            $this = $(this);
            $this.next().remove();
            //unbind all events and redraw
            $this.unbind().sSelect(oldOpts);
        }
    });

    $.fn.sSelect = function(options) {
	
        return this.each(function(){
			
            var defaults = {
                defaultText: 'Please select',
                animationSpeed: 0, //set speed of dropdown
                ddMaxHeight: '' //set css max-height value of dropdown
            };

            //initial variables
            var opts = $.extend(defaults, options),
            $input = $(this),
            $containerDivText = $('<div class="selectedTxt"></div>'),
            $containerDiv = $('<div class="newListSelected" tabindex="0"></div>'),
            $newUl = $('<ul class="newList"></ul>'),
            itemIndex = -1,
            currentIndex = -1,
            keys = [],
            prevKey = false,
            prevented = false,
            $newLi;

            //added by Justin Beasley
            $(this).data('ssOpts',options);
			
            //build new list
            $containerDiv.insertAfter($input);
            $containerDivText.prependTo($containerDiv);
            $newUl.appendTo($containerDiv);
            $input.hide();

            //test for optgroup
            if ($input.children('optgroup').length == 0){
                $input.children().each(function(i){
                    var option = $(this).text();
                    var key = $(this).val();

                    //add first letter of each word to array
                    keys.push(option.charAt(0).toLowerCase());
                    if ($(this).attr('selected') == true){
                        opts.defaultText = option;
                        currentIndex = i;
                    }
                    $newUl.append($('<li><a href="JavaScript:void(0);">'+option+'</a></li>').data('key', key));

                });
                //cache list items object
                $newLi = $newUl.children().children();
				
            } else { //optgroup
                $input.children('optgroup').each(function(){
				
                    var optionTitle = $(this).attr('label'),
                    $optGroup = $('<li class="newListOptionTitle">'+optionTitle+'</li>');
						
                    $optGroup.appendTo($newUl);

                    var $optGroupList = $('<ul></ul>');

                    $optGroupList.appendTo($optGroup);

                    $(this).children().each(function(){
                        ++itemIndex;
                        var option = $(this).text();
                        var key = $(this).val();
                        //add first letter of each word to array
                        keys.push(option.charAt(0).toLowerCase());
                        if ($(this).attr('selected') == true){
                            opts.defaultText = option;
                            currentIndex = itemIndex;
                        }
                        $optGroupList.append($('<li><a href="JavaScript:void(0);">'+option+'</a></li>').data('key',key));
                    })
                });
                //cache list items object
                $newLi = $newUl.find('ul li a');
            }
			
            //get heights of new elements for use later
            var newUlHeight = $newUl.height(),
            containerHeight = $containerDiv.height(),
            newLiLength = $newLi.length;
		
            //check if a value is selected
            if (currentIndex != -1){
                navigateList(currentIndex, true);
            } else {
                //set placeholder text
                $containerDivText.text(opts.defaultText);
            }

            //decide if to place the new list above or below the drop-down
            function newUlPos(){
                var containerPosY = $containerDiv.offset().top,
                docHeight = jQuery(window).height(),
                scrollTop = jQuery(window).scrollTop();

                //if height of list is greater then max height, set list height to max height value
                if (newUlHeight > parseInt(opts.ddMaxHeight)) {
                    newUlHeight = parseInt(opts.ddMaxHeight);
                }

                containerPosY = containerPosY-scrollTop;
                if (containerPosY+newUlHeight >= docHeight){
                    $newUl.css({
                        top: '-'+newUlHeight+'px',
                        height: newUlHeight
                    });
                    $input.onTop = true;
                } else {
                    $newUl.css({
                        top: containerHeight+'px',
                        height: newUlHeight
                    });
                    $input.onTop = false;
                }
            }

            //run function on page load
            newUlPos();
			
            //run function on browser window resize
            $(window).resize(function(){
                newUlPos();
            });
			
            $(window).scroll(function(){
                newUlPos();
            });

            //positioning
            function positionFix(){
                $containerDiv.css('position','relative');
            }

            function positionHideFix(){
                $containerDiv.css('position','static');
            }
			
            $containerDivText.click(function(event){

                event.stopPropagation();

                //hide all menus apart from this one
                $('.newList').not($(this).next()).hide().parent().removeClass('newListSelFocus');

                //show/hide this menu
                $newUl.toggle();
                positionFix();
                //scroll list to selected item
                $newLi.eq(currentIndex).focus();


            });

            $newLi.click(function(e){
                
                var $clickedLi = $(e.target);

                //update counter
                currentIndex = $newLi.index($clickedLi);
				
                //remove all hilites, then add hilite to selected item
                prevented = true;
                navigateList(currentIndex);
                $newUl.hide();
                $containerDiv.css('position','static');//ie

            });
			
            $newLi.hover(
                function(e) {
                    var $hoveredLi = $(e.target);
                    $hoveredLi.addClass('newListHover');
                },
                function(e) {
                    var $hoveredLi = $(e.target);
                    $hoveredLi.removeClass('newListHover');
                }
                );

            function navigateList(currentIndex, init){
                $newLi.removeClass('hiLite')
                .eq(currentIndex)
                .addClass('hiLite');

                if ($newUl.is(':visible')){
                    $newLi.eq(currentIndex).focus();
                }

                var text = $newLi.eq(currentIndex).text();
                var val = $newLi.eq(currentIndex).parent().data('key');
                
                //page load
                if (init == true){
                    $input.val(val);
                    $containerDivText.text(text);
                    return false;
                }
                
                $input.val(val)
                $input.change();
                $containerDivText.text(text);
            };

            $input.change(function(event){
                $targetInput = $(event.target);
                //stop change function from firing
                if (prevented == true){
                    prevented = false;
                    return false;
                }
                $currentOpt = $targetInput.find(':selected');
                
                //currentIndex = $targetInput.find('option').index($currentOpt);
                currentIndex = $targetInput.find('option').index($currentOpt);


                navigateList(currentIndex, true);
            }
            );
			
            //handle up and down keys
            function keyPress(element) {
                //when keys are pressed
                element.onkeydown = function(e){
                    var keycode;
                    if (e == null) { //ie
                        keycode = event.keyCode;
                    } else { //everything else
                        keycode = e.which;
                    }

                    //prevent change function from firing
                    prevented = true;

                    switch(keycode)
                    {
                        case 40: //down
                        case 39: //right
                            incrementList();
                            return false;
                            break;
                        case 38: //up
                        case 37: //left
                            decrementList();
                            return false;
                            break;
                        case 33: //page up
                        case 36: //home
                            gotoFirst();
                            return false;
                            break;
                        case 34: //page down
                        case 35: //end
                            gotoLast();
                            return false;
                            break;
                        case 13:
                        case 27:
                            $newUl.hide();
                            positionHideFix();
                            return false;
                            break;
                    }

                    //check for keyboard shortcuts
                    keyPressed = String.fromCharCode(keycode).toLowerCase();
                    
                    var currentKeyIndex = keys.indexOf(keyPressed);

                    if (typeof currentKeyIndex != 'undefined') { //if key code found in array
                        ++currentIndex;
                        currentIndex = keys.indexOf(keyPressed, currentIndex); //search array from current index
                        if (currentIndex == -1 || currentIndex == null || prevKey != keyPressed) currentIndex = keys.indexOf(keyPressed); //if no entry was found or new key pressed search from start of array

                        
                        navigateList(currentIndex);
                        //store last key pressed
                        prevKey = keyPressed;
                        return false;
                    }
                }
            }

            function incrementList(){
                if (currentIndex < (newLiLength-1)) {
                    ++currentIndex;
                    navigateList(currentIndex);
                }
            }

            function decrementList(){
                if (currentIndex > 0) {
                    --currentIndex;
                    navigateList(currentIndex);
                }
            }

            function gotoFirst(){
                currentIndex = 0;
                navigateList(currentIndex);
            }
			
            function gotoLast(){
                currentIndex = newLiLength-1;
                navigateList(currentIndex);
            }

            $containerDiv.click(function(){
                keyPress(this);
            });

            $containerDiv.focus(function(){
                $(this).addClass('newListSelFocus');
                keyPress(this);
            });

            $containerDiv.blur(function(){
                $(this).removeClass('newListSelFocus');
            });
			
            //hide list on blur
            $('body').click(function(){
                $containerDiv.removeClass('newListSelFocus');
                $newUl.hide();
                positionHideFix();
            });
			
            //add classes on hover
            $containerDivText.hover(function(e) {
                var $hoveredTxt = $(e.target);
                $hoveredTxt.parent().addClass('newListSelHover');
            },
            function(e) {
                var $hoveredTxt = $(e.target);
                $hoveredTxt.parent().removeClass('newListSelHover');
            	}
            );

            //reset left property and hide
            $newUl.css('left','0').hide();
			
        });
	  
    };

})(jQuery);



var popupGallery = null;
var nextImage='';

function popupImage(Imagesrc){
	nextImage=Imagesrc;
	popupGallery = window.open('/assets/popup.htm', 'popupwindow', 'status=no, toolbar=no, location=no, titlebar=no, menubar=no, width=200, height=200');
	} 

$(function(){
  	$('.CatalogueDetails table.gallery a, .CatalogueDetails map#gallery area').click(function(){
	popupImage(this.href);
	return false;
  });
});



$(document).ready(function(){
	// Make the catalogue and search listings behave like a table by
	// matching the heights of the cells in each row and adding a clear:left
	// div at the end of each row
	$('.Listing').tabulate();
	$('.CrossSell, .Related_Products').tabulate();

	// Do the same for the catalogues in the sitemap	
	$('.SiteMap').tabulate({cell_selector:'.sitemap_catalogue'});
	
	$('.search_options').prepend($('.header_nav'));
	
	$('.AddToCart').after($('.AdditionalInfoTextHtml').make_tabs());

	// Add some padding to the heading on the Contact Us page	
	$('.content_column_2 h1:contains("How to contact us")').css('padding','15px 0px 18px 0px');
	$('.content_column_2 label:contains("Security Code (case sensitive):")').css('display','block');
	
	$('h1, .InfoPage h1, .ProductDescription h2.ItemName, h2.CrossSell_heading, .CartHeading .mainheading, .SiteMap h1, .promo_code h1' ).sifr({path:'/assets/',font:'Triplex',textAlign: 'left',hover:"#a9a39b", textTransform:"capitalize"});
	
	$('#SelectCurrency').sSelect();
;})