Extras = {

/* function - remove content from an input on focus */
clearInputContent : function(inputElem){
	if (!document.getElementById) return false;	
	if (typeof($$) === "undefined") return false;
	var elements = $$(inputElem);
	if (!elements.length) return false;	
		for (var i=0; i<elements.length; i++){
		var originalValue = elements[i].readAttribute('value');	
		elements[i].onfocus = function(){
			if (this.value === originalValue){
			this.clear();
				this.onblur = function(){
					if (this.value === ""){
					this.value = originalValue;	 
					}
				}
			}
		}
	}
},

/* Configure a lightbox Dark Site warning to activate on onload */
darksite : function(activeClass, contentToDispId, alertId, closeLink, closeButton, insertLinkElem, alertId2){
	if(typeof(lightbox) === "function"){	
		for(j=0,jlen=Extras.darksiteURLArray.length; j<jlen; j++){
			if (document.location.href === Extras.darksiteURLArray[j]){	
				if ($$(activeClass)[0]){
					var count = 0;
					for(i=0,ilen=Extras.darksiteURLArray.length; i<ilen; i++){
						if(!document.referrer.match(Extras.darksiteURLArray[i])){
						count++;					
						}
	    			}
					if (count === ilen){						
		    			if ($$(insertLinkElem)[0]){
		    			new Insertion.Top($$(insertLinkElem)[0], closeLink);	
						new Insertion.Bottom($$(insertLinkElem)[0], closeButton);
		    			}
	    			lightbox.prototype.addLightboxMarkup();
					if($(alertId)){
					lightbox.prototype.dsAlertIdElem = $(alertId);
					} 
					else
					{
						if($(alertId2)){
						lightbox.prototype.dsAlertIdElem = $(alertId2);	
						}
					}
	    			lightbox.prototype.onLoadPageContent = $(contentToDispId); // id of the content you want to load
	    			lightbox.prototype.activate();
					}
					else{
						if($$(activeClass)[0]){
						$$(activeClass)[0].removeClassName('leightbox');
						}
					}
				}
			}
		}
	}
	else{
		return false;
	}
}

}

var initExtras = function(){
/* Configure clearInputContents input value */
Extras.clearInputContent('input.resetText');
/* Extras.darksiteURLArray[0] - [3] used to define only page that allows Darksite Lightbox overlay. Also the arrays URLs define the document referrers that will NOT trigger the overlay */
Extras.darksiteURLArray = new Array('http://www.firstchoice.co.uk/', 'http://www.tuihugoprjuat.co.uk/', 'http://10.40.16.56:8090/', 'http://10.33.118.11/', 'http://www.firstchoice-ski.co.uk/', 'http://flights.firstchoice.co.uk/', 'http://bookings.firstchoice.co.uk/');
/* Configure darksite (class required to activate it, id of content to put in modal overlay, url to match so that returning to home page will not repeatedly trigger darksite)*/
Extras.darksite('.darksite', 'lightbox1', 'SevereAlertHome', '<a rel="deactivate" class="lbAction insertedLbA" href="#" title="Close this overlay"><img src="/images/buttons/close.gif" alt=""/></a>', '<a rel="deactivate" class="lbAction insertedLbA button" href="#" title="Close this overlay"><span class="buttonLeft">&nbsp;</span><span class="buttonRight">Continue to website</span></a>', '.newWarningBlockContent', 'SevereAlertAll');
}


addLoadEvent(initExtras);