	Cufon.replace('h1', {fontFamily: 'Foundry Monoline', hover:'true'});
Cufon.replace('.last_merchants h3', {fontFamily: 'Foundry Monoline', hover:'true'});
Cufon.replace('h2[@class!=trigger], h2.trigger strong', {fontFamily: 'Foundry Monoline', hover:'true'});
$(document).ready(function(){
			$(".fade").css('display', 'none').fadeIn(1500);
		//	$('h1, h2[@class!=trigger], .last_merchants h3').sifr({path:'js/', font:'adesso_m', embedOptions: { wmode:'transparent'} });
			$("#cat").selectbox();
			$('#keyword').helperCreate('keywords');		
			$('#search form').submit(function(){
				$('#search input.hint').val('');
			});
			
			setTimeout("$('.message').fadeOut(1500)",3000);
			
			$('#spec-offers .item').size()>1 && $('#spec-offers').innerfade({animationtype: 'slide', speed: 1200, timeout: 4000, type: 'sequence', containerheight: '140px' });
			//$('.btn-login-velocity,.btn-join-velocity,.btn-join,.btn-login').mouseover(function(e){tooltip(e,this,'Please ensure cookies are enabled on your web browser to earn Velocity Points when you shop. See FAQs for more details')},function(e){});
			//$('.btn-login-velocity,.btn-join-velocity,.btn-join,.btn-login').mouseover(function(e){tooltip(e,this,'Please ensure cookies are enabled on your web browser to earn Velocity Points when you shop. See FAQs for more details')},function(e){});


			//var cookieEnabled=(navigator.cookieEnabled)? true : false;
			document.cookie="testcookie";
			var cookieEnabled=(document.cookie.indexOf("testcookie")!=-1)? true : false;

			//if not IE4+ nor NS6+
/*
			if (typeof navigator.cookieEnabled=="undefined" && !cookieEnabled){ 
				document.cookie+="testcookie"
				cookieEnabled=(document.cookie.indexOf("testcookie")!=-1)? true : false;
			}
*/
			if (!cookieEnabled){
				$('.btn-login-velocity,.btn-join-velocity,.btn-join,.btn-login').click(function(){
					alertPopup('Important Notice','Just checking you\'ve got cookies enabled, you\'ll need this to ensure you earn Velocity Points! <br /><br /><a href="how-it-works.html">Check out more about cookies here</a>.',$(this).attr('href'));
					$('.btn-login-velocity,.btn-join-velocity,.btn-join,.btn-login').unbind('click');
					return false;
				});
			}



});
		
$.fn.toggleSection = function(option){ // toggleSection('#boxId')
		box = option;
		$(this).blur();
		if($(box).css('display')=='block')
			$(box).slideUp();
		else $(box).slideDown();
		$(this).toggleClass('on');
}

function switchNodeStyle(node){
	if(node.className=="expanded") node.className="";
	else node.className="expanded";
}

function showMerchantPopup(id){
	window.open('merchant.popup.php?merchantID='+id,'merhcantPopup','width=550,height=300');
}
function showTOCPopup(){
	window.open('terms-and-conditions.html','TOCPopup','width=550,height=600,scrollbars=yes');
}
function popupCalc(url, w ,h){
	window.open(url,"popup","width="+w+",height="+h+",resizable,scrollbars=no,status=1");
}

function popupWindow(url, w ,h){
	window.open(url,"popup","width="+w+",height="+h+",resizable,scrollbars=yes,status=1");
}


function ratingaction (num, action)
{
	var base_url=document.getElementsByTagName('base')[0].href;

	var input = document.getElementById ('rating');
	if (action == 'click')
	{
		input.value = num;
		for (i=1; i<=num; i++)
		{
			var star = document.getElementById ('your-rating-' + i);
			star.style.backgroundImage = 'url('+base_url+'images/star-yellow.gif)';
		}
	}

	if ((action == 'show') && (num > input.value))
	{
		for (i=1; i<=num; i++)
		{
			var star = document.getElementById ('your-rating-' + i);
			star.style.backgroundImage = 'url('+base_url+'images/star-yellow.gif)';
		}
	}

	if ((action == 'hide') && (num > input.value))
	{
		var star = document.getElementById ('your-rating-' + num);
		star.style.backgroundImage =
		'url('+base_url+'images/star-gray.gif)';
	}

	if (action == 'hideall')
	{
		for (i=5; i>input.value; i--)
		{
			var star = document.getElementById ('your-rating-' + i);
			star.style.backgroundImage =
			'url('+base_url+'images/star-gray.gif)';
		}
	}
}
function alertPopup(title,text,url){
			$('#alert').remove();
			$('body').append('<div id="alert"><div class="top">'+title+'<a href="javascript:;"></a></div><div class="bottom"><p>'+text+'</p><a class="btnOk" href="'+url+'"></a></div></div>');
			//$('body').append('<div id="alert"><div class="top">'+title+'<a href="javascript:;"></a></div><div class="bottom"><p>'+text+'</p><a class="btnOk" href="javascript:;"></a></div></div>');
			$('#alert').jqm().jqmShow().jqmAddClose('.top a');	
}
function tooltip(e,node,text){
	removeTooltip();
	var o=$(node).offset();
	var x=Math.round(o.left+$(node).width()/2-115);
	var y=o.top+5+$(node).height();
	
	$('body').append('<div class="tooltip"><div class="middle">'+text+'</div><div class="bottom"></div></div>');
	$('.tooltip').css('left',(x)+'px').css('top',(y)+'px').fadeIn('fast');		
	window.setTimeout(removeTooltip,5000);
}

function removeTooltip(){
	$('.tooltip').fadeOut('fast',function(){$('.tooltip').remove()});		
}


/* 
* Example
*	$('input[@name=fname]').helperCreate('first name');
*/

(function($) {
$.fn.helperIn=function(text){if($(this).val()==text){$(this).removeClass('hint').val('')}}
$.fn.helperOut=function(text){if($(this).val()==''||$(this).val()==text)$(this).addClass('hint').val(text);}
$.fn.helperCreate=function(text){$(this).focus(function(){ $(this).helperIn(text);}).blur(function(){$(this).helperOut(text);}).helperDestroy(text);}
$.fn.helperDestroy=function(text){if($(this).val()==''||$(this).val()==text)$(this).addClass('hint').val(text);}
})(jQuery);


			/* =========================================================

			// jquery.innerfade.js

			// Datum: 2008-02-14
			// Firma: Medienfreunde Hofmann & Baldes GbR
			// Author: Torsten Baldes
			// Mail: t.baldes@medienfreunde.com
			// Web: http://medienfreunde.com

			// based on the work of Matt Oakes http://portfolio.gizone.co.uk/applications/slideshow/
			// and Ralf S. Engelschall http://trainofthoughts.org/

			 *
			 *  <ul id="news"> 
			 *      <li>content 1</li>
			 *      <li>content 2</li>
			 *      <li>content 3</li>
			 *  </ul>
			 *  
			 *  $('#news').innerfade({ 
			 *	  animationtype: Type of animation 'fade' or 'slide' (Default: 'fade'), 
			 *	  speed: Fading-/Sliding-Speed in milliseconds or keywords (slow, normal or fast) (Default: 'normal'), 
			 *	  timeout: Time between the fades in milliseconds (Default: '2000'), 
			 *	  type: Type of slideshow: 'sequence', 'random' or 'random_start' (Default: 'sequence'), 
			 * 		containerheight: Height of the containing element in any css-height-value (Default: 'auto'),
			 *	  runningclass: CSS-Class which the container get’s applied (Default: 'innerfade'),
			 *	  children: optional children selector (Default: null)
			 *  }); 
			 *

			// ========================================================= */


			(function($) {

			    $.fn.innerfade = function(options) {
			        return this.each(function() {   
			            $.innerfade(this, options);
			        });
			    };

			    $.innerfade = function(container, options) {
			        var settings = {
			       		'animationtype':    'slide',
			            'speed':            'normal',
			            'type':             'sequence',
			            'timeout':          2000,
			            'containerheight':  'auto',
			            'runningclass':     'innerfade',
			            'children':         null
			        };
			        if (options)
			            $.extend(settings, options);
			        if (settings.children === null)
			            var elements = $(container).children();
			        else
			            var elements = $(container).children(settings.children);
			        if (elements.length > 1) {
			            $(container).css('position', 'relative').css('height', settings.containerheight).addClass(settings.runningclass);
			            for (var i = 0; i < elements.length; i++) {
			                $(elements[i]).css('z-index', String(elements.length-i)).css('position', 'absolute').hide();
			            };
			            if (settings.type == "sequence") {
			                setTimeout(function() {
			                    $.innerfade.next(elements, settings, 1, 0);
			                }, settings.timeout);
			                $(elements[0]).show();
			            } else if (settings.type == "random") {
			            		var last = Math.floor ( Math.random () * ( elements.length ) );
			                setTimeout(function() {
			                    do { 
															current = Math.floor ( Math.random ( ) * ( elements.length ) );
													} while (last == current );             
													$.innerfade.next(elements, settings, current, last);
			                }, settings.timeout);
			                $(elements[last]).show();
									} else if ( settings.type == 'random_start' ) {
											settings.type = 'sequence';
											var current = Math.floor ( Math.random () * ( elements.length ) );
											setTimeout(function(){
												$.innerfade.next(elements, settings, (current + 1) %  elements.length, current);
											}, settings.timeout);
											$(elements[current]).show();
									}	else {
										alert('Innerfade-Type must either be \'sequence\', \'random\' or \'random_start\'');
									}
							}
			    };

			    $.innerfade.next = function(elements, settings, current, last) {
			        if (settings.animationtype == 'slide') {
			            $(elements[last]).slideUp(settings.speed);
			            $(elements[current]).slideDown(settings.speed);
			        } else if (settings.animationtype == 'fade') {
			            $(elements[last]).fadeOut(settings.speed);
			            $(elements[current]).fadeIn(settings.speed, function() {
										removeFilter($(this)[0]);
									});
			        } else
			            alert('Innerfade-animationtype must either be \'slide\' or \'fade\'');
			        if (settings.type == "sequence") {
			            if ((current + 1) < elements.length) {
			                current = current + 1;
			                last = current - 1;
			            } else {
			                current = 0;
			                last = elements.length - 1;
			            }
			        } else if (settings.type == "random") {
			            last = current;
			            while (current == last)
			                current = Math.floor(Math.random() * elements.length);
			        } else
			            alert('Innerfade-Type must either be \'sequence\', \'random\' or \'random_start\'');
			        setTimeout((function() {
			            $.innerfade.next(elements, settings, current, last);
			        }), settings.timeout);
			    };

			})(jQuery);
			// **** remove Opacity-Filter in ie ****
			function removeFilter(element) {
				if(element.style.removeAttribute){
					element.style.removeAttribute('filter');
				}
			}
