

/*******************************************************/
/********** BEHAVIOUR CODE FOR ATTACHING JSCRIPT *******/
/**********  TO HTML WITH SPECIAL FUNCTIONALITY	********/
/*******************************************************/
//Examples:	<IMG src="images/coupon.gif" class="coupon"/>

var specialOffersRules = {
	'IMG.coupon': function(image){
		image.onmouseover = function(){image.className='couponHighlight';};
		image.onmouseout = function(){image.className='coupon';};	
		image.parentNode.target = '';
	}
};

try{
	Behaviour.register(specialOffersRules);
}catch(e){
	//Happened because the behaviour script is not loaded yet
	//Attempt to register after the page finishes loading
	if(document.attachEvent){
		document.attachEvent('onload', new Function('try{Behaviour.register(specialOffersRules);}catch(e){}'));
	}else{
		document.addEventListener('load', new Function('try{Behaviour.register(specialOffersRules);}catch(e){}'), true);
	}
}
	



	
	
	
	

/*******************************************************/
/**********   LEGACY JSCRIPT FOR COUPON EFFECTS  *******/
/*******************************************************/
var currentHighlightedCoupon;

function rollOverSpecialOfferImage(image)
{
	if(image.innerHTML == '' || image.innerHTML.charCodeAt(0) == 160 || image.innerHTML.indexOf('&nbsp;') > -1)
	{
		//Remove any previous highlights
		if(currentHighlightedCoupon != undefined)
		{
			rollOutSpecialOfferImage(currentHighlightedCoupon);
		}				
	
		var highlightLayer = document.getElementById('couponHighlightLayer').cloneNode(true);
					
		image.innerHTML = '';
		image.appendChild(highlightLayer);
		
		highlightLayer.style.display = 'block';
		
		currentHighlightedCoupon = image;					
	}
}

function rollOutSpecialOfferImage(image)
{
	if(image == undefined){return;}

	var nonHighlightLayer = document.getElementById('couponNonHighlightLayer').cloneNode(true);
	image.removeChild(image.firstChild);
	image.appendChild(nonHighlightLayer);
	nonHighlightLayer.style.display = 'block';	
	
	currentHighlightedCoupon = undefined;		
}

