//OCMS CASE 202701: THIS FUNCTION SOLVES THE PROBLEM WITH NAME.DLL
//DON'T DELETE!!!!
function ProcessImn() {

}
/* This part defines the sIFR stuff */
		
	var vagRounded = { src: '/asset/js/vagRounded.swf' };
	
	sIFR.activate(vagRounded);

	sIFR.replace(vagRounded, {
		selector: 'h1',
		css: ['.sIFR-root { font-size: 28; color: #756C63; leading: -4; }'],
		wmode: 'transparent',
		offsetTop: '-4'
	});

	sIFR.replace(vagRounded, {
		selector: 'h2.hasFlash',
		css: ['.sIFR-root { font-size: 24; color: #756C63; leading: -4; }'],
		wmode: 'transparent',
		offsetTop: '-3',
		tuneHeight: '-4'
	});
	
	sIFR.replace(vagRounded, {
		selector: 'h2.hasFlash-w',
		css: ['.sIFR-root { font-size: 24; color: #756C63; leading: -4; }'],
		wmode: 'transparent',
		offsetTop: '-3',
		tuneHeight: '-4'
	});
	
	sIFR.replace(vagRounded, {
		selector: 'h3.hasFlash',
		css: ['.sIFR-root { font-size: 18; color: #756C63; }'],
		wmode: 'transparent'
	});

	sIFR.replace(vagRounded, {
		selector: 'h4.hasFlash',
		css: ['.sIFR-root { font-size: 16; color: #756C63; }'],
		wmode: 'transparent'
	});

	sIFR.replace(vagRounded, {
		selector: 'h5.hasFlash',
		css: ['.sIFR-root { font-size: 14; color: #756C63; }'],
		wmode: 'transparent'
	});
	
/* End. This part defines the sIFR stuff */

///* This part defines the sIFR stuff */
//$().ready(function(){
//	if(typeof sIFR == "function"){
//											

//	
////		bodyh1=named({
////						sSelector:"body h1",
////						sFlashSrc:"/asset/js/vagRounded.swf",
////						sColor:"#756C63",
////						sLinkColor:"#000000",
////						sBgColor:"#FFFFFF",
////						sHoverColor:"#CCCCCC",
////						sFlashVars:"textalign=left",
////						sWmode: "transparent",
////						nPaddingTop:0, 
////						nPaddingBottom:0
////					});
////		sIFR.replaceElement(bodyh1);
//		
////		homePageH2=named({
////						sSelector:".homePage .hero h2",
////						sFlashSrc:"/asset/js/vagRounded.swf",
////						sColor:"#756C63",
////						sLinkColor:"#000000",
////						sBgColor:"#FFFFFF",
////						sHoverColor:"#CCCCCC",
////						sFlashVars:"textalign=left",
////						sWmode: "transparent",
////						nPaddingTop:0, 
////						nPaddingBottom:0
////					});
////		sIFR.replaceElement(homePageH2);									
//		
//		// Add DSC
////		homeH2=named({
////						sSelector:".homePage #contentArea h2",
////						sFlashSrc:"/asset/js/vagRounded.swf",
////						sColor:"#756C63",
////						sLinkColor:"#000000",
////						sBgColor:"#FFFFFF",
////						sHoverColor:"#CCCCCC",
////						sFlashVars:"textalign=left",
////						sWmode: "transparent",
////						nPaddingTop:0, 
////						nPaddingBottom:0
////					});
////		sIFR.replaceElement(homeH2);	

////		textContainerH2=named({
////						sSelector:".textContainer h2",
////						sFlashSrc:"/asset/js/vagRounded.swf",
////						sColor:"#756C63",
////						sLinkColor:"#000000",
////						sBgColor:"#FFFFFF",
////						sHoverColor:"#CCCCCC",
////						sFlashVars:"textalign=left",
////						sWmode: "transparent",
////						nPaddingTop:0, 
////						nPaddingBottom:0
////					});
////		sIFR.replaceElement(textContainerH2)
//											
////		landingSubHeading=named({
////						sSelector:".textContainer h3",
////						sFlashSrc:"/asset/js/vagRounded.swf",
////						sColor:"#756C63",
////						sLinkColor:"#000000",
////						sBgColor:"#FFFFFF",
////						sHoverColor:"#CCCCCC",
////						sFlashVars:"textalign=left",
////						sWmode: "transparent",
////						nPaddingTop:0, 
////						nPaddingLeft:0,
////						nPaddingBottom:0
////					});
////		sIFR.replaceElement(landingSubHeading);														
//	};	
//								
//});

///* improving accessibility adding hover/focus capabilities to IE6 buttons */
//$().ready(function(){	
//	if($.browser.msie){	
//		$("button").focus(function(){
//								   	$(this).addClass("hover")}
//						).blur(function(){
//									$(this).removeClass("hover")
//						}).hover(	function(){
//								   	$(this).addClass("hover")},
//							function(){
//									$(this).removeClass("hover")}
//						 )							
//	}
//							
//});



/* initialize the Ajax handler */
$().ready(function(){
	//Adecco.sIFR();
	Adecco.init();							
//	Adecco.footerDropDownLinks();
//	Adecco.faqPanelsInit();
//	Adecco.miniPanelsInit();
	Adecco.initAvailability();
	JobTicker.init();
	Partner.init();
	RotatingNews.init();
});


Adecco=
{
	//used by the firstPage / lastPage buttons	
	currentPage:1,		
	pagesCount:0,
	sortBy:null,
	newsCollection:null,
	currentNews:-1,
	rotatorHandler:null,
	
	init:function()
	{			            
		$(document.body).addClass("hasJs");
		Adecco.dynamicInputText();
//			// defining the news rotator behaviours			
//			Adecco.newsCollection=$(".newsRotator .news");
//			$("#stopRotationBtn").click(function(){
//												 		clearInterval(Adecco.rotatorHandler);
//														$(this).hide(0)
//														$("#startRotationBtn").show(0);
//														return false;
//													});
//			
//			$("#startRotationBtn").click(function(){												 		
//														$(this).hide(0)
//														$("#stopRotationBtn").show(0);
//														newsAnimation();
//														startNews();
//														return false;
//													});
//													
//			$(".newsRotator").mouseover(function(){
//	                                                clearInterval(Adecco.rotatorHandler);
//	                                            });
//	                                            
//	        $(".newsRotator").mouseout(function(){
//	                                                startNews();
//	                                            });
//			
//			if ($(document.body).hasClass("homePage hasJs")){
//				newsAnimation();
//				startNews();
//			}
//			
//			
		// set up the calendar
		try{
			$(".datePicker").datepicker();
		}
		catch(e){};
					
//		//traping the pagination button click
//		Adecco.Ajax.buttonsInit();
			
//			/* traping the submit button click event (searchPage) 
//			$("#searchPage button[type='submit']").click(function(){	
//																$('<input type="hidden" name="reqType" id="reqType" value="json" />').appendTo($("form"))
//														});				
						
//		/* traping the submit button click event (results page)*/
//		$(".searchParameters button[type='submit']").click(function()
//		{	
//			//start a new search from the first page
//			Adecco.currentPage=1;
//		});				
			
//		/* trapping the submit event */
//		$("#searchForm").submit(function()
//		{
//		 	// clear the results container and append the LOADING icon//
//		 	$("<img>").attr("src","/asset/images/loading.gif").prependTo($('<p class="loading">').text("loading...").appendTo($(".recordsContainer").empty()))
//			
//			formObj=$(this);
//			
//			var queryString = formObj.serialize();
//			var url = formObj.attr("action");												
//			
//			queryString="sortBy=" + Adecco.sortBy + "&requestType=json&currentPage=" + Adecco.currentPage + "&" + queryString
//															
//			//this timer is used just to simulate the normal client/server communication delay
//			//please remove the following line!!!	* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *												
//			setTimeout(function(){$.getJSON(url,queryString,Adecco.Ajax.onAjaxResponse)},500);
//			//                              * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//			
//			//just leave this one
//			//$.getJSON(url,queryString,Adecco.Ajax.onAjaxResponse);	
//			
//			return false													
//		});		
//			
//		//send the first request;
//		if($("#searchForm").length>0) $(".searchParameters #searchForm").submit();
	},
	
//	Ajax:
//	{
//		buttonsInit:function()
//		{
//				
//			var myForm=$(".searchParameters #searchForm");
//			
//			/* traping the "sortBy" buttons click events */					
//			$(".sortBy a").click(function()
//			{										  
//				Adecco.sortBy=$(this).text();
//				Adecco.currentPage=1;
//				myForm.submit();			  
//			});

//			/* traping the "page number" buttons click events */
//			$(".pagination .pageNum").click(function()
//			{
//				pageBtn=$(this);
//				if(pageBtn.parent(1).hasClass("selected")) return false;		
//				
//				Adecco.currentPage=parseInt(pageBtn.text());
//				
//				myForm.submit();
//			});
//					
//			/* traping the first/previous/next/last pagination buttons */
//			$(".pagination li a").not(".pageNum").click(function()
//			{																
//				var btnClass=this.className;
//				switch (btnClass){
//					case "firstPage":
//						Adecco.currentPage=1;
//					break;
//					
//					case "previousPage":
//						Adecco.currentPage--;
//					break;
//					
//					case "nextPage":
//						Adecco.currentPage++;
//					break;
//					
//					case "lastPage":
//						Adecco.currentPage=Adecco.pagesCount;
//					break;																		
//				}
//				
//				myForm.submit();			
//			});
//		},	/* End. buttonsInit:function() */						
//				
//		onAjaxResponse:function (jsonObj)
//		{								
//			var recordsList=$("<ul>").appendTo($(".searchResultsPanel .recordsContainer").empty());
//			var paginationDivs=$(".searchResultsPanel .pagination");
//			var header=$(".searchResultsPanel .header");
//			
//			//updating some variables
//			Adecco.pagesCount=jsonObj.searchDetails.pagesCount;
//			Adecco.currentPage=jsonObj.searchDetails.currentPage
//			Adecco.sortBy=myUnescape(jsonObj.searchDetails.sortBy.current);

//			// rendering the header html
//			header.empty();
//			$("<h3>").text(myUnescape(jsonObj.searchDetails.title)).appendTo(header);
//			$('<span class="subTitle">').text(jsonObj.searchDetails.to + " Job Offers related to your search:").appendTo(header);
//			var sortBy=$('<div class="sortBy">').appendTo(header);
//			$("<h3>Sort your results by:</h3>").appendTo(sortBy);
//			
//			var ul=$("<ul>").appendTo(sortBy);
//			for (var x=0;x<jsonObj.searchDetails.sortBy.options.length;x++){					
//				var newLi=$('<li><a href="#' + myUnescape(jsonObj.searchDetails.sortBy.options[x]) + '">' + myUnescape(jsonObj.searchDetails.sortBy.options[x]) + '</a></li>').appendTo(ul);
//				if(myUnescape(jsonObj.searchDetails.sortBy.options[x])==Adecco.sortBy){
//					newLi.addClass("selected");
//				}
//			}

//			// rendering the pagination html
//			paginationDivs.empty();
//			$('<span class="results">').text("Results " + jsonObj.searchDetails.from + " - " + jsonObj.searchDetails.to + " sur" + jsonObj.searchDetails.recordsCount).appendTo(paginationDivs);
//			
//			paginationDivs.each(function()
//			{
//				var ul=$("<ul>").appendTo(this); 
//				
//				if(Adecco.currentPage>1){
//					$('<li><a class="firstPage" title="First page" href="#first"><span class="hidden">first page</span></a></li>').appendTo(ul);
//					$('<li><a class="previousPage" title="Previous page" href="#previous">Previous</a></li>').appendTo(ul);
//				}
//																  
//				var firstPage=(Adecco.currentPage-3)>0?Adecco.currentPage-3:1
//				var lastPage=(firstPage+4<Adecco.pagesCount)?firstPage+4:Adecco.pagesCount;
//				for (var x=firstPage;x<lastPage+1;x++){
//										
//					var newLi=$('<li>').appendTo(ul);
//					$("<a>").addClass("pageNum").attr("title","page " + x ).attr("href","#" + x).text(x).appendTo(newLi)
//					if(Adecco.currentPage==x){
//						newLi.addClass("selected");
//					}

//				}
//									
//				if(Adecco.currentPage<Adecco.pagesCount){
//					$('<li><a class="nextPage" title="suivant page" href="#next">Suivant</a></li>').appendTo(ul);
//					$('<li><a class="lastPage" title="dernier page" href="#last"><span class="hidden">dernier page</span></a></li>').appendTo(ul);				
//				}
//			});

//			//redifining the buttons events
//			Adecco.Ajax.buttonsInit();

//			//rendering the records html
//			$.each(jsonObj.records,function(i,item)
//			{
//				var newLi=$("<li>").appendTo(recordsList);
//				//creating the record header
//				$("<a>").attr("href",item.link).text(item.jobtitle).appendTo($('<p class="jobTitle">').appendTo(newLi));
//				
//				//creating the table with the job specs
//				var jobTable=$("<table>").attr("summary","job description").appendTo(newLi);
//				for (prop in item.specs){
//					var newTr=$("<tr>").appendTo(jobTable);
//					$("<span>").text(prop).appendTo($("<th>").appendTo(newTr));
//					$("<span>").text(item.specs[prop]).appendTo($("<td>").appendTo(newTr));														
//				}
//				
//				$('<p class="description">').text(myUnescape(item.description)).appendTo(newLi);
//				$('<a class="details">').attr("href",item.link).text(myUnescape(item.details)).appendTo(newLi);

//			});
//		}	/* End. onAjaxResponse:function (jsonObj) */			
//	},	/* End. Ajax: */
//	
//	
//	footerDropDownLinks:function(){
//		$(".footer fieldset").each(function(){
//												var btnGo=$(this).children(".btnGo");
//												var selectTag=$(this).find("select")[0];												
//												
//												btnGo.click(function(){												
//																	 var url=selectTag.options[selectTag.selectedIndex].value;
//																	 if (url.length>1){
//																		 //location.href=url;
//																		 window.open(url);
//																	 }
//																	 })
//										  
//										  
//										  
//										  
//										  })
//	},
//	
//	faqPanelsInit:function(){
//		var panelsHead=$(".faqContainer .faqHeader");
//		panelsHead.each(function()	{
//										var thisObj=$(this);	
//										var li=thisObj.parent("li");								 		
//								 		if (!li.hasClass("opened")){
//																		li.find(".faqBody").hide(0);
//																	}
//								 	});
//		
//		panelsHead.click(function()	{
//										var thisObj=$(this);
//										var li=thisObj.parent("li");
//										if (li.hasClass("opened")){
//											li.removeClass("opened");
//											li.find(".faqBody").slideUp(200);
//											//thisObj.next().slideUp(200);
//										}else{
//											li.addClass("opened");
//											li.find(".faqBody").slideDown(200);
//											//thisObj.next().slideDown(200);																
//										}
//										
//										return false;
//									})

//	},
//	
//	miniPanelsInit:function(){
//		var panelsHead=$(".miniPanels .panHeader");
//		panelsHead.each(function()	{
//										var thisObj=$(this);	
//										var li=thisObj.parent("li");								 		
//								 		if (!li.hasClass("opened")){
//																		li.find(".panBody").hide(0);
//																	}
//								 	});
//		
//		panelsHead.click(function()	{
//										var thisObj=$(this);
//										var li=thisObj.parent("li");
//										if (li.hasClass("opened")){
//											li.removeClass("opened");
//											li.find(".panBody").slideUp(200);
//											//thisObj.next().slideUp(200);
//										}else{
//											li.addClass("opened");
//											li.find(".panBody").slideDown(200);
//											//thisObj.next().slideDown(200);																
//										}
//										
//										return false;
//									})

//	},
	
	/* Input field text population
     * Takes current value of form INPUTS and handles clearing and repopulating on focus
    -------------------------------------------------------------------------------------*/
	dynamicInputText: function() 
	{
        $('input[type="text"]').not($(".hasDatepicker")).each(function()
        {
			target=this;
			target.savedText = target.title; // keep track of the original input value
			target.onfocus=function()
			{
                this.value = $.trim(this.value);
				if ((this.value == this.savedText)||(this.value =="Insert your keywords here")) 
				{
                    this.value = "";
                }
            }
            
            target.onblur=function()
            {
                this.value = $.trim(this.value);
                                                        
				if (this.value == "") 
				{
				    if((this.savedText!="")||(target.title==""))
                        this.value = this.savedText;
				    else
				        this.value = "Insert your keywords here";
                }
            }                                                                                          
      });
    },
	
	initAvailability:function(){ $(".availabilityDate .datePicker").datepicker();}
}


/*************************
		JobTicker Init
**************************/

	JobTicker=
	{	
		//used by the firstPage / lastPage buttons	
		currentPage:1,		
		pagesCount:0,
		sortBy:null,
		newsCollection:null,
		currentNews:-1,
		rotatorHandler:null,
		
		init:function()
		{		
			// defining the news rotator behaviours			
			JobTicker.newsCollection=$(".jobTicker .jobTickerItem");
																
			$(".jobTicker").mouseover(function()
			{
				clearInterval(JobTicker.rotatorHandler);
			});
	                                            
			$(".jobTicker").mouseout(function()
			{
				startNews();
			});
			
			if ($(document.body).hasClass("homePage hasJs"))
			{
				newsAnimation();
				startNews();
			}
		}
	}

	// Rotating jobs news.	
	function startNews()
	{
		newsDuration=7000;
		
		if (JobTicker.newsCollection.length>0)
		{
			JobTicker.rotatorHandler=setInterval(newsAnimation,newsDuration)
		}		
	}

	function newsAnimation()
	{		
		if(JobTicker.currentNews>-1)
		{
			$(JobTicker.newsCollection[JobTicker.currentNews]).animate(
			{																						 
				opacity:0,
				fontSize:"0em",
				height:"0px",
				paddingBottom:"0px"
			},1000,"swing",function(){this.style.display="none"})
		}
		
		JobTicker.currentNews++;
		if (JobTicker.currentNews>JobTicker.newsCollection.length-1) JobTicker.currentNews=0;
		
		if (JobTicker.newsCollection[JobTicker.currentNews])
		{ // Add DSC
			$(JobTicker.newsCollection[JobTicker.currentNews]).css({opacity:0,fontSize:"0em",height:"0px",paddingBottom:"0px"})									
			
			JobTicker.newsCollection[JobTicker.currentNews].style.display="block";
			
			$(JobTicker.newsCollection[JobTicker.currentNews]).animate(
			{
				opacity:1,
				fontSize:"1em",
				height:"160px",
				paddingBottom:"10px"
			},1000,"swing",function(){this.style.filter=""})			
		} // End. Add DSC
	}

/*************************
	End. JobTicker Init
**************************/

/*************************
		Partner Init
**************************/
	Partner =
	{
		currentPage:1,		
		pagesCount:0,
		sortBy:null,
		newsCollection:null,
		currentNews:-1,
		rotatorHandler:null,
		
		init:function()
		{		            
			Partner.newsCollection=$(".partnerLogos .partnerLogosItem");																		
																	
			$(".partnerLogosNext").mouseover(function()
			{
					PartnerAnimation();
					StartPartners();
			});
			
			$(".partnerLogosNext").mouseout(function()
			{
				clearInterval(Partner.rotatorHandler);
			});
		}
	}

	function PartnerAnimation()
	{
		
		if(Partner.currentNews>-1)
		{
			$(Partner.newsCollection[Partner.currentNews]).animate(
			{																						 
				opacity:0,
				fontSize:"0em",
				height:"0px",
				paddingBottom:"0px"
			},1000,"swing",function(){this.style.display="none"})
		}
		
		Partner.currentNews++;
		if (Partner.currentNews>Partner.newsCollection.length-1) Partner.currentNews=0;
		
		if (Partner.newsCollection[Partner.currentNews])
		{ // Add DSC
			$(Partner.newsCollection[Partner.currentNews]).css({opacity:0,fontSize:"0em",height:"0px",paddingBottom:"0px"})									
			
			Partner.newsCollection[Partner.currentNews].style.display="block";
			
			$(Partner.newsCollection[Partner.currentNews]).animate
			(
				{opacity:1, fontSize:"1em", height:"160px", paddingBottom:"10px"},
				1000,
				"swing",
				function()
				{
					this.style.filter=""
				}
			)			
			
		} // End. Add DSC
	}

	function StartPartners()
	{
		newsDuration=3000;
		
		if (Partner.newsCollection.length>0)
		{
			Partner.rotatorHandler=setInterval(PartnerAnimation,newsDuration)
		}		
	}

/*************************
	End. Partner Init
**************************/

/*************************
   Rotating News WebPart
**************************/
	RotatingNews = 
	{
		currentPage:1,		
		pagesCount:0,
		sortBy:null,
		newsCollection:null,
		currentNews:-1,
		rotatorHandler:null,
		
		init:function()
		{	            				
			// defining the news rotator behaviours			
			RotatingNews.newsCollection=$(".wpRotatingNews .RNItem");
																
			$(".RNItem").mouseover(function()
			{
				clearInterval(RotatingNews.rotatorHandler);
			});
	                                            
			$(".RNItem").mouseout(function()
			{
				StartRotatingNews();
			});
			
			if ($(document.body).hasClass("homePage hasJs"))
			{
				RotatingAnimation();
				StartRotatingNews();
			}
		}
	}
	
	function StartRotatingNews()
	{
		newsDuration=5000;
		
		if (RotatingNews.newsCollection.length>0)
		{
			RotatingNews.rotatorHandler=setInterval(RotatingAnimation,newsDuration)
		}		
	}

	function RotatingAnimation()
	{
		
		if(RotatingNews.currentNews>-1)
		{
			$(RotatingNews.newsCollection[RotatingNews.currentNews]).animate(
			{																						 
				opacity:0,
				fontSize:"0em",
				height:"0px",
				paddingBottom:"0px"
			},1000,"swing",function(){this.style.display="none"})
		}
		
		RotatingNews.currentNews++;
		if (RotatingNews.currentNews>RotatingNews.newsCollection.length-1) RotatingNews.currentNews=0;
		
		if (RotatingNews.newsCollection[RotatingNews.currentNews])
		{ // Add DSC
			$(RotatingNews.newsCollection[RotatingNews.currentNews]).css({opacity:0,fontSize:"0em",height:"0px",paddingBottom:"0px"})									
			
			RotatingNews.newsCollection[RotatingNews.currentNews].style.display="block";
			
			$(RotatingNews.newsCollection[RotatingNews.currentNews]).animate(
			{
				opacity:1,
				fontSize:"1em",
				height:"160px",
				paddingBottom:"10px"
			},1000,"swing",function(){this.style.filter=""})			
		} // End. Add DSC
	}
	
/*************************
End. Rotating News WebPart
**************************/

function myUnescape(str)
{
	return unescape(str).replace(/\+/g," ");
}

$().ready(function()
{
	try
	{
		$.datepicker.regional['uk'] = {clearText: 'Effacer', clearStatus: '',
			closeText: 'Close', closeStatus: 'Close without saving',
			prevText: 'Previous', prevStatus: 'See previous month',
			nextText: 'Next;', nextStatus: 'Se next month',
			currentText: 'Current', currentStatus: 'See current month',
			monthNames: ['January','February','March','April','May','June',
			'July','August','September','October','November','December'],
			monthNamesShort: ['Jan','Feb','Mar','Apr','May','Jun',
			'Jul','Aug;','Sep','Oct','Nov','Dec'],
			monthStatus: 'See another month', yearStatus: 'See other year',
			weekHeader: 'ws', weekStatus: '',
			dayNames: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
			dayNamesShort: ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],
			dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'],
			dayStatus: 'Use Sunday as first day of week', dateStatus: 'Chose the DD, MM d',
			dateFormat: 'dd/mm/yy', firstDay: 0, 
			initStatus: 'Chose the date', isRTL: false};
		$.datepicker.setDefaults($.datepicker.regional['uk']);
	}
	catch(e){};
});
