/* Look for Leadin classes and add offers classes to those elements 30/09/2008 */
function togLeadins(){ 
$$('h1').each(function(element){
	lookForLeadinClass(element);
});
$$('h2').each(function(element){
	lookForLeadinClass(element);
});
$$('span').each(function(element){
	lookForLeadinClass(element);
});
$$('a').each(function(element){
	lookForLeadinClass(element);
});
	tuiTog();
}

function lookForLeadinClass(element){	
/* Array of leadin price offers. The first 2 values in each multi Dim Array is the class to be looked for either the auto generated epic code or the leadin class as added by the page editor. The last 2 values are the offer classes to be set to the element with the first the euro price and 2nd the pound price */
/* togLeadinAirport multi-dimensinal Array */
var togLeadinAirport = new Array();
togLeadinAirport[0] = new Array("leadinAirportBelfast","leadinAirportBelfast","lates6446 earlies6462","");
togLeadinAirport[1] = new Array("leadinAirportDerry","leadinAirportDerry","","");
togLeadinAirport[2] = new Array("leadinAirportCork","leadinAirportCork","lates6457 earlies6456","");
togLeadinAirport[3] = new Array("leadinAirportDublin","leadinAirportDublin","lates6451 earlies6450","");
togLeadinAirport[4] = new Array("leadinAirportKnock","leadinAirportKnock","","");
togLeadinAirport[5] = new Array("leadinAirportCardiff","leadinAirportCardiff","","");
togLeadinAirport[6] = new Array("leadinAirportKerry","leadinAirportKerry","","");
togLeadinAirport[7] = new Array("leadinAirportShannon","leadinAirportShannon","lates6461 earlies6459","");
togLeadinAirport[8] = new Array("leadinAirportROI","leadinAirportROI","lates6451 lates6461 earlies6450 earlies6459","");
togLeadinAirport[9] = new Array("leadinAirportNI","leadinAirportNI","lates6446 lates6457 earlies6462 earlies6456","");
/* End of togLeadinAirport multi-dimensinal Array */

/* togLeadinDeals multi-dimensinal Array */
var togLeadinDeals = new Array();
togLeadinDeals[0] = new Array("leadinDealsSale","leadinSale","earlies6208","earlies6208");
togLeadinDeals[1] = new Array("leadinDealsLastMinute","leadinLastMinute","earlies6287 lates6252","earlies6226 lates6019");
/*  End of togLeadinDeals multi-dimensinal Array */

/* togLeadinDest multi-dimensinal Array */
var togLeadinDest = new Array();
/*repeat first leadin identifier if no auto generated leadin epic number exists*/
togLeadinDest[0] = new Array("leadinDestinationAlgarve","crd000154","","");
togLeadinDest[1] = new Array("leadinDestinationArctic","leadinDestinationArctic","earlies6239","earlies6222");
togLeadinDest[2] = new Array("leadinDestinationBalearics","leadinDestinationBalearics","","");		
togLeadinDest[3] = new Array("leadinDestinationBlackSea","leadinDestinationBlackSea","","");	
togLeadinDest[4] = new Array("leadinDestinationBulgaria","crd002682","","");	
togLeadinDest[5] = new Array("leadinDestinationCanaries","leadinDestinationCanaries","earlies6287 lates6252","earlies6226 lates6019");
togLeadinDest[6] = new Array("leadinDestinationCostaDeLaLuz","crd002150","","");
togLeadinDest[7] = new Array("leadinDestinationCostaDelSol","crd000365","","");
togLeadinDest[8] = new Array("leadinDestinationCostaDorada","crd000372","","");
togLeadinDest[9] = new Array("leadinDestinationCostaDeAlmeria","crd000361","","");
togLeadinDest[10] = new Array("leadinDestinationCrete","crd000800","","");
togLeadinDest[11] = new Array("leadinDestinationCyprusEast","crd000791","","");
togLeadinDest[12] = new Array("leadinDestinationEgypt","crd000312","earlies6240 lates6203","");
togLeadinDest[13] = new Array("leadinDestinationFuerteventura","crd000312","earlies6243 lates6208","");
togLeadinDest[14] = new Array("leadinDestinationGranCanaria","crd000318","earlies6245 lates6251","earlies6228 lates6032");
togLeadinDest[15] = new Array("leadinDestinationGreece","leadinDestinationGreece","","");
togLeadinDest[16] = new Array("leadinDestinationIbiza","crd000242","","");
togLeadinDest[17] = new Array("leadinDestinationItaly","leadinDestinationItaly","","");
togLeadinDest[18] = new Array("leadinDestinationLaGomera","crd000327","earlies6247 lates6213","earlies6232 lates6041");
togLeadinDest[19] = new Array("leadinDestinationLakeGarda","leadinDestinationLakeGarda","","");
togLeadinDest[20] = new Array("leadinDestinationLanzarote","crd000329","earlies6247 lates6218","earlies6234 lates6049");
togLeadinDest[21] = new Array("leadinDestinationLapland","leadinDestinationLapland","earlies6251","earlies6236");
togLeadinDest[22] = new Array("leadinDestinationMajorca","crd000122","","");
togLeadinDest[23] = new Array("leadinDestinationMenorca","crd000127","","");
togLeadinDest[24] = new Array("leadinDestinationNeapolitanRiviera","crd000672","","");
togLeadinDest[25] = new Array("leadinDestinationPortugal","leadinDestinationPortugal","","");
togLeadinDest[26] = new Array("leadinDestinationRedSea","crd001689","earlies6241 lates6204","");
togLeadinDest[27] = new Array("leadinDestinationSpain","leadinDestinationSpain","","");
togLeadinDest[28] = new Array("leadinDestinationTenerife","crd000335","earlies6253 lates6222","earlies6237 lates6067");
togLeadinDest[29] = new Array("leadinDestinationTurkeyAegean","leadinDestinationTurkeyAegean","","");
togLeadinDest[30] = new Array("leadinDestinationTurkeyTurquoise","leadinDestinationTurkeyTurquoise","","");
togLeadinDest[31] = new Array("leadinDestinationTurkeyVenetian","leadinDestinationTurkeyVenetian","","");
togLeadinDest[32] = new Array("leadinDestinationTurkeyZante","leadinDestinationTurkeyZante","","");
/* End of togLeadinDest multi-dimensinal Array */

/* togLeadinMonth multi-dimensinal Array */
var togLeadinMonth = new Array();
togLeadinMonth[0] = new Array("leadinMonthJan","leadinMonthJan","earlies6356","earlies6355");
togLeadinMonth[1] = new Array("leadinMonthFeb","leadinMonthFeb","earlies6378","earlies6377");
togLeadinMonth[2] = new Array("leadinMonthMar","leadinMonthMar","earlies6400","earlies6399");
togLeadinMonth[3] = new Array("leadinMonthApr","leadinMonthApr","earlies6423","earlies6422");
togLeadinMonth[4] = new Array("leadinMonthOct","leadinMonthOct","lates6436","lates6435");
togLeadinMonth[5] = new Array("leadinMonthNov","leadinMonthNov","lates6398","lates6397");
togLeadinMonth[6] = new Array("leadinMonthDec","leadinMonthDec","lates6420","lates6419");
/* End of togLeadinMonth multi-dimensinal Array */
	if(element.className.indexOf("leadinAirport") != -1){
		for (i=0; i<togLeadinAirport.length; i++){
			if(element.hasClassName(togLeadinAirport[i][0]) || element.hasClassName(togLeadinAirport[i][1])){
				if(togLeadinAirport[i][3] == ""){
				new Insertion.After(element, "<ul><li class='leadinPriceTog " + togLeadinAirport[i][2] + "'>&nbsp;</li></ul>");
				}
				else{
					if(togLeadinAirport[i][2] == ""){
					new Insertion.After(element, "<ul><li class='leadinPriceTog " + togLeadinAirport[i][3] + "'>&nbsp;</li></ul>");
					}
					else{
					new Insertion.After(element, "<ul><li>ROI<span class='leadinPriceTog " + togLeadinAirport[i][2] + "'>&nbsp;</span></li><li class='leadinPriceTog " + togLeadinAirport[i][3] + "'>&nbsp;</li></ul>");
					}
				}
			} 						
		}		
	}
	if(element.className.indexOf("leadinDeals") != -1){
		for (i=0; i<togLeadinDeals.length; i++){
			if(element.hasClassName(togLeadinDeals[i][0]) || element.hasClassName(togLeadinDeals[i][1])){
				if(togLeadinDeals[i][3] == ""){
				new Insertion.After(element, "<ul><li class='leadinPriceTog " + togLeadinDeals[i][2] + "'>&nbsp;</li></ul>");
				}
				else{
					if(togLeadinDeals[i][2] == ""){
					new Insertion.After(element, "<ul><li class='leadinPriceTog " + togLeadinDeals[i][3] + "'>&nbsp;</li></ul>");
					}
					else{
					new Insertion.After(element, "<ul><li class='leadinPriceTog " + togLeadinDeals[i][2] + "'>&nbsp;</li><li class='leadinPriceTog " + togLeadinDeals[i][3] + "'>&nbsp;</li></ul>");
					}
				}
			}
		}		
	}
	if(element.className.indexOf("leadinDestination") != -1 || element.className.indexOf("crd") != -1){
		for (i=0; i<togLeadinDest.length; i++){
			if(element.hasClassName(togLeadinDest[i][0]) || element.hasClassName(togLeadinDest[i][1])){	
				if(togLeadinDest[i][3] == ""){
				new Insertion.After(element, "<ul><li class='leadinPriceTog " + togLeadinDest[i][2] + "'>&nbsp;</li></ul>");
				}
				else{
					if(togLeadinDest[i][2] == ""){
					new Insertion.After(element, "<ul><li class='leadinPriceTog " + togLeadinDest[i][3] + "'>&nbsp;</li></ul>");
					}
					else{
					new Insertion.After(element, "<ul><li class='leadinPriceTog " + togLeadinDest[i][2] + "'>&nbsp;</li><li class='leadinPriceTog " + togLeadinDest[i][3] + "'>&nbsp;</li></ul>");
					}
				}
			}
		}		
	}
	if(element.className.indexOf("leadinMonth") != -1){
		for (i=0; i<togLeadinMonth.length; i++){
			if(element.hasClassName(togLeadinMonth[i][0]) || element.hasClassName(togLeadinMonth[i][1])){	
				if(togLeadinMonth[i][3] == ""){
				new Insertion.After(element, "<ul><li class='leadinPriceTog " + togLeadinMonth[i][2] + "'>&nbsp;</li></ul>");
				}
				else{
					if(togLeadinMonth[i][2] == ""){
					new Insertion.After(element, "<ul><li class='leadinPriceTog " + togLeadinMonth[i][3] + "'>&nbsp;</li></ul>");
					}
					else{
					new Insertion.After(element, "<ul><li class='leadinPriceTog " + togLeadinMonth[i][2] + "'>&nbsp;</li><li class='leadinPriceTog " + togLeadinMonth[i][3] + "'>&nbsp;</li></ul>");
					}
				}
			}
		}	
	}
}

addLoadEvent(togLeadins);