﻿
	
	
	var w4NewsRead={
	
		contentheight:0,
		frameheight:270,
		sliderStartVal:100,
		
		setHeights:function() {
			if (w4NewsRead.contentheight<=0) {
				w4NewsRead.frameheight = $(".w4news-scroll").height();
				w4NewsRead.contentheight = $(".gfc-results").height()-w4NewsRead.frameheight;
			}
		},
		
		moveNews:function(strSliderVal) {
			var sSlideVal = w4NewsRead.reverseDirection(strSliderVal);
			var percentage = sSlideVal / 100 ;
			var newNewsPos = Math.round(w4NewsRead.contentheight * percentage);
			var strPos = '-'+newNewsPos+'px';
			$(".gfc-results").stop(true,true).animate({top:strPos},800);
		},
		
		reverseDirection:function(nVal) {
			nRet = 0;
			nRet = 100 - nVal;
			return nRet;
		},
		
		
		init:function(params){
		
			$(document).ready(function(){
				
				$('#w4rss').gFeed({
					url: 'http://www.w4global.com/w4-rss2-bpm-news.xml',
					hl: 'fr',
					max: 16
				});
				
				
				
				var myLink = $('a.gf-title:eq(0)').attr('target');
				var myChildren = $(".gfc-results").children();
				var myTest = "stop";
				
				$(".gfc-results").css('position','relative');
				w4NewsRead.setHeights();

				$("#slider").slider({
					orientation: "vertical",
					value:100,
					min: 0,
					max: 100,
					slide: function(event, ui) {
						w4NewsRead.setHeights();
						w4NewsRead.moveNews(ui.value);
					}
				});
			
			});
			
		}
		
	}
	
	w4NewsRead.init();
	
	var w4Events={
		
		currentPage:1,
		totalEvents:0,
		
		CreateEvent:function(msg) {
			 var countEvents = $("w4Event", msg).length;
			 var i = 0;
			 
			 $("w4Event", msg).each(function() {
								
				
				$("#w4events").append('<div id="w4Event'+i+'" class="w4EventEN"></div>');
				
				w4Events.addItem($("title", this),"eventTitle",i);
				w4Events.addItem($("petitephoto", this),"eventPhoto",i);
				w4Events.addItem($("description", this),"eventDescription",i);
				w4Events.addItem($("date", this),"eventDate",i);
				w4Events.addItem($("heure", this),"eventHeure",i);
				w4Events.addItem($("lieu", this),"eventLieu",i);
				w4Events.addItem($("adresse", this),"eventAdresse",i);
				w4Events.addItem($("link", this),"eventLink",i);
				
				i++;
				
			 });
			 
			 $('#w4events').find("div:first").css('visibility','visible');
			 
			 w4Events.DisplayButtons('1', countEvents);
			 w4Events.totalEvents = countEvents;
			 	
		},
		
		changePage:function(strDir) {
			
			var i = 0;
		
			$('#w4events').children().each(function() {
				
				var cssVisbility = $(this).css('visibility');
				
				if (cssVisbility=='visible') {
					var myVisibleElement = $(this).attr('id');
					var sIndex = myVisibleElement.substring(7);
					var sIndextoShow = w4Events.getItemtoShow(sIndex,strDir);
					var obEventCurrent = $(this);
					var obEventNext = $('#w4Event'+sIndextoShow);
					
					$(obEventCurrent).stop(true,true).slideUp(800).css('visibility','hidden');
					$(obEventNext).stop(true,true).slideDown(400).css('visibility','visible');
					$('#wrapbuttonevent').find('.pagenumber').html(parseInt(sIndextoShow)+1);
					
					return false;
										
				}
				
				i++;
				
			});
			
		},
		
		
		getItemtoShow:function(sIndex, strDir) {		
			var retI = 0;
	
			switch (strDir) {
				case 'forward': {
					if (sIndex<(parseInt(w4Events.totalEvents)-1)) {retI = parseInt(sIndex) + 1;}
					break;
				}
				case 'back': {
					if (sIndex==0) 
					{
						retI = parseInt(w4Events.totalEvents)-1;	
					} else {
						retI = parseInt(sIndex) - 1;
					}
					break;
				}
				default:
				break;
			}
			
			return retI;
		},
		
		addItem:function(obEvent, strClassName, iEvent) {
			if ($(obEvent).text().length>1) {
				$("<div/>", {
				 "class": strClassName,
				  html: $(obEvent).text()
				}).appendTo("#w4Event"+iEvent);
			}
		},
		
		DisplayButtons:function(iPage, numPages) {
			$('#wrapbuttonevent').find('.pagenumber').html(iPage);
			$('#wrapbuttonevent').find('.totalpages').html('of ' + numPages);
					
			$('#eventRight').click( function(ev) {
				ev.stopPropagation();
				w4Events.changePage('forward');
			});
			
			$('#eventLeft').click( function(ev) {
				ev.stopPropagation();
				w4Events.changePage('back');
			});
			
		},
		
		init:function(parems) {
		
			$(document).ready(function() {
				
				$.ajax({
				   url: "/evenements-en.xml",
				   dataType: "xml",
				   success: function(msg){	 
						w4Events.CreateEvent(msg);
				   }
				 });
				
			});
		}
	}
	
	w4Events.init();
	

	
	var w4Video={
		
		init:function(parmes) {
			
			$(document).ready(function() {
				$('a[rel*=facebox]').facebox();
				//$("#video-art-block").css('display','none');
			});
			
			
		}
	}
	
	w4Video.init();
	
	var w4Tabs={
	
		init:function(params){
			
			if ($.browser.msie==true) {
				/*$('.ui-tabs-panel').css('padding','20px 0 0 -1px');*/
			}
			
			
			
			$(document).ready(function(){
				$('#container-1 > ul').tabs({ selected: 0 }).parent().css('visibility','visible');
				$('#container-4 > ul').tabs({ selected: 0 }).parent().css('visibility','visible');
				if ($.browser.msie!=true) {
					$('#container-3>div>p').width(650);
				}
			});
			
		}
	
	}
	
	w4Tabs.init();
	
	var W4SetProfileMenu = {

		currentProfile:"",

		setProfileBonhomme:function(myProfile) {
			
		    switch (myProfile) {
			

			default:
			break;
		     }
		    

		},

		changeProfileState:function(myProfile) {
			    W4SetProfileMenu.incrementforChange();
			    W4SetProfileMenu.incrementMenuCountCookies(myProfile);
			
				switch(myProfile) {
					
					default:
						break;
				}
			
		},

		incrementforChange:function() {
			var ProfCookies = {};
                        ProfCookies.Names = ["clickChef","clickDSI","clickExpert"];
			for (var d = 0; d < ProfCookies.Names.length; d++) { 
                                var sName = ProfCookies.Names[d]; 
				var iNumClicks = W4SetProfileMenu.getCookie(sName);
                                if (iNumClicks==1) {
				   var iCount = parseInt(iNumClicks) + 1;
			           W4SetProfileMenu.setCookie(sName,iCount,1);
				}
			}

		},
		
		hideMenu:function(myProfile) {

			switch(myProfile) {
				case "chef":
					
						$(".chef").find('ul').css('display','none');
						$(".chef").css('background-color','transparent');
						$(".chef").css('color','#ffffff');			
					
				break;
				case "dsi":
					
						$(".dsi").find('ul').css('display','none');
						$(".dsi").css('background-color','transparent');
						$(".dsi").css('color','#ffffff');		
				
				break;
				case "expert":
						$(".expert").find('ul').css('display','none');
						$(".expert").css('background-color','transparent');
						$(".expert").css('color','#ffffff');	
				break;
				default:
				break;
			}
		},
		
		showMenuFirstClick:function(myProfile) {
			var iClicks = 0; 
			switch(myProfile) {
				case "chef":
					iClicks = W4SetProfileMenu.getCookie('clickChef');
					if (iClicks==1) {
						$(".chef").find('ul').css('display','block');
						$(".chef").css('background-color','#eb7e06');
						$(".chef").css('color','#000000');			
					}
				break;
				case "dsi":
					iClicks = W4SetProfileMenu.getCookie('clickDSI');
					if (iClicks==1) {
						$(".dsi").find('ul').css('display','block');
						$(".dsi").css('background-color','#eb7e06');
						$(".dsi").css('color','#000000');				
					}
				break;
				case "expert":
					iClicks = W4SetProfileMenu.getCookie('clickExpert');
					if (iClicks==1) {
						$(".expert").find('ul').css('display','block');	
						$(".expert").find('ul').css('left','-200px');
						$(".expert").css('background-color','#eb7e06');
						$(".expert").css('color','#000000');			
					}
				break;
				default:
				break;
			}
			
		},
		
		setMenuCountCookies:function() {
			W4SetProfileMenu.setCookie('clickChef',0,1);
			W4SetProfileMenu.setCookie('clickDSI',0,1);
			W4SetProfileMenu.setCookie('clickExpert',0,1);
		},
		
		incrementMenuCountCookies:function(sProfile) {
			
			switch(sProfile) {
				case "chef":
					var currentCount = W4SetProfileMenu.getCookie('clickChef');
					if (currentCount.length==0) {currentCount = 0};
					var iCount = parseInt(currentCount) + 1;
					W4SetProfileMenu.setCookie('clickChef',iCount,1);
				break;
				case "dsi":
					var currentCount = W4SetProfileMenu.getCookie('clickDSI');
					if (currentCount.length==0) {currentCount = 0};
					var iCount = parseInt(currentCount) + 1;
					W4SetProfileMenu.setCookie('clickDSI',iCount,1);
				break;
				case "expert":
					var currentCount = W4SetProfileMenu.getCookie('clickExpert');
					if (currentCount.length==0) {currentCount = 0};
					var iCount = parseInt(currentCount) + 1;
					W4SetProfileMenu.setCookie('clickExpert',iCount,1);
				break;
				default:
				break;
			}
		},
		
		killProfil:function() {
			W4SetProfileMenu.setCookie('W4Profile','',1);
			W4SetProfileMenu.setMenuCountCookies();
		},

		setCookie:function(c_name,value,expiredays)
		{
			var exdate=new Date();
			exdate.setDate(exdate.getDate()+expiredays);
			document.cookie=c_name+ "=" +escape(value)+
			((expiredays==null) ? "" : ";expires="+exdate.toUTCString());
		},

		getCookie:function(c_name)
		{
			if (document.cookie.length>0)
  			{
 				 c_start=document.cookie.indexOf(c_name + "=");
  				if (c_start!=-1)
    				{
    					c_start=c_start + c_name.length+1;
    					c_end=document.cookie.indexOf(";",c_start);
    					if (c_end==-1) c_end=document.cookie.length;
    					return unescape(document.cookie.substring(c_start,c_end));
   				 }
  			}
			return "";
		},
		
		isProfilepage:function(loc) {
			blnRet = false;
			switch(loc) {
				case "/business-process-ceo.html":
				   blnRet = true;
				break;
				case "/business-process-it.html":
				   blnRet = true;
				break;
				case "/business-process-expert.html":
				   blnRet = true;
				break;
				case "/business-process-human-resources-management.htm":
				    blnRet = true;
				break;
				case "/business-process-human-resources-management.htm":
				    blnRet = true;
				break;
				case "/business-process-management-banking.htm":
				    blnRet = true;
				break;
				case "/business-process-turnkey-applications.htm":
				    blnRet = true;
				break;
				case "/business-process-products.htm":
				    blnRet = true;
				break;
				case "/business-process-management-bpm.htm":
				    blnRet = true;
				break;
				case "/business-process-model-driven.htm":
				    blnRet = true;
				break;
				case "/business-process-agile-method.htm":
					blnRet = true;
				break;
				case "/business-process-agile-values.htm":
					blnRet = true;
				break;
				case "/business-process-agile-principles.htm":
					blnRet = true;
				break;
				case "/business-process-agile-development.htm":
					blnRet = true;
				break;
				default:
				break;
			}
			return blnRet;
		},
		
		init:function(params) {

			$(document).ready(function() {

				var loc = window.location.pathname;		
						
				if (!(W4SetProfileMenu.isProfilepage(loc))) {
					W4SetProfileMenu.killProfil();
				}

                W4SetProfileMenu.currentProfile = W4SetProfileMenu.getCookie('W4Profile');
			    W4SetProfileMenu.setProfileBonhomme(W4SetProfileMenu.currentProfile);

			    $(".chef>span").addClass('normalProfile');
				$(".dsi>span").addClass('normalProfile');
				$(".expert>span").addClass('normalProfile');

				$(".chef>span").hover(function(ev) {
				     $(this).addClass('hoverProfile');
 				     $(this).removeClass('normalProfile');
 			 	},function (ev) {
                     $(this).addClass('normalProfile');
				     $(this).removeClass('hoverProfile');
				});

				$(".dsi>span").hover(function(ev) {
				     $(this).addClass('hoverProfile');
 				     $(this).removeClass('normalProfile');
 			 	},function (ev) {
                     $(this).addClass('normalProfile');
				     $(this).removeClass('hoverProfile');
				});


				$(".expert>span").hover(function(ev) {
				     $(this).addClass('hoverProfile');
 				     $(this).removeClass('normalProfile');
 			 	},function (ev) {
                     		     $(this).addClass('normalProfile');
				     $(this).removeClass('hoverProfile');
				});
				
				$("#profile-chef").hover(function(ev) {
				     	$("#imgchef").animate({ marginTop: "0px"}, 700);
					$(this).find('p').css('text-decoration','underline');
                                        $(".chef").find('span').css('color','#000000');
 			 	},function (ev) {
                    			$("#imgchef").animate({ marginTop: "38px"}, 100);
					$(this).find('p').css('text-decoration','none');
                                        $(".chef").find('span').css('color','#ffffff');
				});
				
				$("#mapChef").hover(function(ev) {
				    $("#imgchef").animate({ marginTop: "0px"}, 700);
					//$("#profile-chef").find('p').css('text-decoration','underline');
					$(".chef").find('span').css('color','#000000');
					$("#mapprofiles").attr('src','/myImages/Menu-profiles-chefon-en.jpg');
 			 	},function (ev) {
                    $("#imgchef").animate({ marginTop: "38px"}, 100);
					//$("#profile-chef").find('p').css('text-decoration','none');
					$(".chef").find('span').css('color','#ffffff');
					$("#mapprofiles").attr('src','/myImages/menu-profiles-en.jpg');
				});
				
				$("#profile-dsi").hover(function(ev) {
				     $("#imgdsi").animate({ marginTop: "0px"}, 700);
				     $(this).find('p').css('text-decoration','underline');
                                     $(".dsi").find('span').css('color','#000000');
 			 	},function (ev) {
                     		     $("#imgdsi").animate({ marginTop: "38px"}, 100);
				     $(this).find('p').css('text-decoration','none');
                                     $(".dsi").find('span').css('color','#ffffff');
				});
				
				$("#mapDSI").hover(function(ev) {
				     $("#imgdsi").animate({ marginTop: "0px"}, 700);
				     //$("#profile-dsi").find('p').css('text-decoration','underline');
                     $(".dsi").find('span').css('color','#000000');
					 $("#mapprofiles").attr('src','/myImages/Menu-profiles-dsion-en.jpg');
 			 	},function (ev) {
           		     $("#imgdsi").animate({ marginTop: "38px"}, 100);
				     //$("#profile-dsi").find('p').css('text-decoration','none');
                     $(".dsi").find('span').css('color','#ffffff');
					 $("#mapprofiles").attr('src','/myImages/menu-profiles-en.jpg');
				});
				
				$("#profile-partenaire").hover(function(ev) {
				     $("#imgexpert").animate({ marginTop: "0px"}, 700);
				     $(this).find('p').css('text-decoration','underline');
                                     $(".expert").find('span').css('color','#000000');
 			 	},function (ev) {
                     		     $("#imgexpert").animate({ marginTop: "38px"}, 100);
				     $(this).find('p').css('text-decoration','none');
                                     $(".expert").find('span').css('color','#ffffff');
				});
				
				$("#mapExpert").hover(function(ev) {
				    $("#imgexpert").animate({ marginTop: "0px"}, 700);
					//$("#profile-partenaire").find('p').css('text-decoration','underline');
                    $(".expert").find('span').css('color','#000000');
					$("#mapprofiles").attr('src','/myImages/Menu-profiles-experton-en.jpg');
 			 	},function (ev) {
                    $("#imgexpert").animate({ marginTop: "38px"}, 100);
					//$("#profile-partenaire").find('p').css('text-decoration','none');
                    $(".expert").find('span').css('color','#ffffff');
					$("#mapprofiles").attr('src','/myImages/menu-profiles-en.jpg');
				});
				
				$("#imgchef").hover(function(ev) {
				      if (W4SetProfileMenu.currentProfile!='chef') {
    				      	$(this).animate({ marginTop: "0px"}, 700);
					$("#profile-chef").find('p').css('text-decoration','underline');
                                        $(".chef").find('span').css('color','#000000');
				      }	
 			 	},function (ev) {
				      if (W4SetProfileMenu.currentProfile!='chef') {
    				      	$(this).animate({ marginTop: "38px"}, 100);
					$("#profile-chef").find('p').css('text-decoration','none');
                                        $(".chef").find('span').css('color','#ffffff');
				      }	
				});

                 		$(".chef").hover(function(ev) {
				      if (W4SetProfileMenu.currentProfile!='chef') {
    				      	$("#imgchef").animate({ marginTop: "0px"}, 700);
					$("#profile-chef").find('p').css('text-decoration','underline');
                                        $(".chef").find('span').css('color','#000000');
				      }	
 			 	},function (ev) {
				      if (W4SetProfileMenu.currentProfile!='chef') {
    				      	$("#imgchef").animate({ marginTop: "38px"}, 100);
					$("#profile-chef").find('p').css('text-decoration','none');
                                        $(".chef").find('span').css('color','#ffffff');
				      }	
				});

				$("#imgdsi").hover(function(ev) {
				      if (W4SetProfileMenu.currentProfile!='dsi') {
    				      	$(this).animate({ marginTop: "0px"}, 700);
					$("#profile-dsi").find('p').css('text-decoration','underline');
                                        $(".dsi").find('span').css('color','#000000');
				      }	
 			 	},function (ev) {
				      if (W4SetProfileMenu.currentProfile!='dsi') {
    				      	$(this).animate({ marginTop: "38px"}, 100);
					$("#profile-dsi").find('p').css('text-decoration','none');
                                        $(".dsi").find('span').css('color','#ffffff');
				      }	
				});

                		$(".dsi").hover(function(ev) {
				      if (W4SetProfileMenu.currentProfile!='dsi') {
    				      	$("#imgdsi").animate({ marginTop: "0px"}, 700);
					$("#profile-dsi").find('p').css('text-decoration','underline');
                                        $(".dsi").find('span').css('color','#000000');
				      }	
 			 	},function (ev) {
				      if (W4SetProfileMenu.currentProfile!='dsi') {
    				      	$("#imgdsi").animate({ marginTop: "38px"}, 100);
					$("#profile-dsi").find('p').css('text-decoration','none');
                                        $(".dsi").find('span').css('color','#ffffff');
				      }	
				});

				$("#imgexpert").hover(function(ev) {
				      if (W4SetProfileMenu.currentProfile!='expert') {
    				      	$(this).animate({ marginTop: "0px"}, 700);
					$("#profile-partenaire").find('p').css('text-decoration','underline');
                                        $(".expert").find('span').css('color','#000000');
				      }	
 			 	},function (ev) {
				      if (W4SetProfileMenu.currentProfile!='expert') {
    				      	$(this).animate({ marginTop: "38px"}, 100);
					$("#profile-partenaire").find('p').css('text-decoration','none');
                                        $(".expert").find('span').css('color','#FFFFFF');
				      }	
				});

				$(".expert").hover(function(ev) {
				      if (W4SetProfileMenu.currentProfile!='expert') {
    				      	$("#imgexpert").animate({ marginTop: "0px"}, 700);
					$("#profile-partenaire").find('p').css('text-decoration','underline');
                                        $(".expert").find('span').css('color','#000000');
				      }	
 			 	},function (ev) {
				      if (W4SetProfileMenu.currentProfile!='expert') {
    				      	$("#imgexpert").animate({ marginTop: "38px"}, 100);
					$("#profile-partenaire").find('p').css('text-decoration','none');
                                        $(".expert").find('span').css('color','#FFFFFF');
				      }	
				});

					$("#profile-chef").click(function(ev) {
					    W4SetProfileMenu.changeProfileState('chef');
					});

					$("#profile-dsi").click(function(ev) {
					    W4SetProfileMenu.changeProfileState('dsi');
					});

					$("#profile-partenaire").click(function(ev) {
					    W4SetProfileMenu.changeProfileState('expert');
					});		
					
					$("#mapChef").click(function(ev) {
					    W4SetProfileMenu.changeProfileState('chef');
					});

					$("#mapDSI").click(function(ev) {
					    W4SetProfileMenu.changeProfileState('dsi');
					});

					$("#mapExpert").click(function(ev) {
					    W4SetProfileMenu.changeProfileState('expert');
					});	
					
					$("#chef").click(function(ev) {
				    	    W4SetProfileMenu.changeProfileState('chef');
					});

                 	$(".chef").click(function(ev) {
				    	W4SetProfileMenu.changeProfileState('chef');
					});
	
					$("#dsi").click(function(ev) {
				    	W4SetProfileMenu.changeProfileState('dsi');
					});

                	$(".dsi").click(function(ev) {
				    	W4SetProfileMenu.changeProfileState('dsi');
					});

					$("#expert").click(function(ev) {
				    	W4SetProfileMenu.changeProfileState('expert');
					});

                	$(".expert").click(function(ev) {
				    	W4SetProfileMenu.changeProfileState('expert');
					});					
		
			});
		}
	}

	//W4SetProfileMenu.init();
	
	var w4CaseStudies={
		
		currentPage:1,
		totalStudies:0,
		
		appendCaseStudies:function(strMessage) {
			var i = 0;
			$('#w4casestudies').append(strMessage);
			$('#w4casestudies').children().each( function() {
				if (i==0) {
					$(this).css('visibility','visible');
				}
				if ($(this).attr('class')=='W4casestudy') {
					
					$(this).attr('id','w4CS'+i);
				}
				i++;
			});
			w4CaseStudies.totalStudies=i;
			w4CaseStudies.DisplayButtons('1',i);
			
		},
		
		changePage:function(strDir) {
			
			var i = 0;

		
			$('#w4casestudies').children().each(function() {
				
				var cssVisbility = $(this).css('visibility');
				
				if (cssVisbility=='visible') {
					var myVisibleElement = $(this).attr('id');
					var sIndex = myVisibleElement.substring(4);
					var sIndextoShow = w4CaseStudies.getItemtoShow(sIndex,strDir);
					var obCaseCurrent = $(this);
					var obCaseNext = $('#w4CS'+sIndextoShow);
					
					$(obCaseCurrent).stop(true,true).slideUp(800).css('visibility','hidden');
					$(obCaseNext).stop(true,true).slideDown(400).css('visibility','visible');
					$('#wrapbuttoncasestudies').find('.pagenumber').html(parseInt(sIndextoShow)+1);
					
					return false;
										
				}
				
				i++;
				
			});
			
		},
		
		DisplayButtons:function(iPage, numPages) {
			$('#wrapbuttoncasestudies').find('.pagenumber').html(iPage);
			$('#wrapbuttoncasestudies').find('.totalpages').html('of ' + numPages);
					
			$('#caseRight').click( function(ev) {
				ev.stopPropagation();
				w4CaseStudies.changePage('forward');
			});
			
			$('#caseLeft').click( function(ev) {
				ev.stopPropagation();
				w4CaseStudies.changePage('back');
			});
			
		},
		
		getItemtoShow:function(sIndex, strDir) {		
			var retI = 0;
	
			switch (strDir) {
				case 'forward': {
					if (sIndex<(parseInt(w4CaseStudies.totalStudies)-1)) {retI = parseInt(sIndex) + 1;}
					break;
				}
				case 'back': {
					if (sIndex==0) 
					{
						retI = parseInt(w4CaseStudies.totalStudies)-1;	
					} else {
						retI = parseInt(sIndex) - 1;
					}
					break;
				}
				default:
				break;
			}
			
			return retI;
		},
		
		init:function(parems) {
			
			$(document).ready(function() {		
				$.ajax({
				   url: "/bpm-etudes-de-cas.html",
				   dataType: "html",
				   success: function(msg){	 
				   		
						w4CaseStudies.appendCaseStudies(msg);	
				   }
				   
				 });
			});
		}
	}
	
	w4CaseStudies.init();

	

//Search

var myGoogleMapsClick={
	
	
	clickContactTab:function(iD) {
			
		var i = 0;
		$("#container-3>ul").children().each(function() {
			if (i==iD) {
		   		$(this).find('a').click(function() {
					window.location = "/business-process-contact.htm";
					//$("#myGoogleMaps>iframe").attr('src','/googlemaps.htm');
				});
		} else {
			$(this).find('a').click(function() {
				    //$("#myGoogleMaps>iframe").attr('src','');
			});
		}
	   i++;
	  });
	},
	
	clickDirigeants:function(iD) {
		var i = 0;
		$("#container-3>ul").children().each(function() {
			if (i==iD) {
		   		$(this).find('a').click(function() {
					$("#w4dirigeants").slideDown('fast');
				});
		} else {
			$(this).find('a').click(function() {
				   $("#w4dirigeants").css('display','none');
			});
		}
	   i++;
		});
	},
	
	init:function() {
		
		$(document).ready(function() {
			
				var strP = 	window.location.pathname;	
				
				 switch (strP) {
					 case "/societe":
					 	myGoogleMapsClick.clickContactTab(5);
						myGoogleMapsClick.clickDirigeants(1);					 
					 break;
					 case "/management.htm":
						myGoogleMapsClick.clickContactTab(5);
						$("#w4dirigeants").slideDown('fast');
					 break;
					 case "/investors.htm":
					     myGoogleMapsClick.clickContactTab(5);
						 myGoogleMapsClick.clickDirigeants(1);
					 break;
					 case "/associations.htm":
					 	myGoogleMapsClick.clickContactTab(5);
						 myGoogleMapsClick.clickDirigeants(1);
					 break;
					 case "/careers.htm":
					     myGoogleMapsClick.clickContactTab(5);
						 myGoogleMapsClick.clickDirigeants(1);
					 break;
					 case "/contact.htm":
					     myGoogleMapsClick.clickDirigeants(1);
					     if ($.browser.msie) {
							 
							 if ($.browser.version=='7.0') {
					     		$("#myGoogleMaps>iframe").attr('src','/googlemaps-ie7.htm');
							 } else {
								 $("#myGoogleMaps>iframe").attr('src','/googlemaps-en.htm');
							 }
						 } else {
							 $("#myGoogleMaps>iframe").attr('src','/googlemaps-en.htm');
						 } 
					 break;
					 default:
					 break;
				 }
			
		});
	}
	
}

myGoogleMapsClick.init();

var jqsearchutil={
	
	init:function(){
		$(document).ready(function(){
								   
			$("#search_string").click( function() {
				$(this).attr('value', '');
				$(this).css("border-color","#B5CDE5");
			});
		
			jqsearchutil.InitiateMouseOver();
			
			$("#goLinkfr").click( function() {
				jqsearchutil.SearchLinkClick('fr','Veuillez saisir un mot de recherche...','/Resultats.aspx');							
			});
			
			$("#searchFormfr").submit ( function() {
				jqsearchutil.SearchFormSubmit('fr','Veuillez saisir un mot de recherche...','/Resultats.aspx');							
			});
			
			$("#goLinken").click( function() {
				jqsearchutil.SearchLinkClick('en','Please enter a search item...','/Results.aspx');							
			});
										   
			$("#searchFormen").submit ( function() {
				jqsearchutil.SearchFormSubmit('en','Please enter a search item...','/Results.aspx');		
			});
			
			$("#goLinkes").click( function() {
				jqsearchutil.SearchLinkClick('es','Incorpore por favor un artículo de la búsqueda...','/Resultados.aspx');							
			});
										   
			$("#searchFormes").submit ( function() {
				jqsearchutil.SearchFormSubmit('es','Incorpore por favor un artículo de la búsqueda...','/Resultados.aspx');		
			});
			
			$("#goLinkbr").click( function() {
				jqsearchutil.SearchLinkClick('br','Incorpore por favor un artículo de la búsqueda...','/Resultados_br.aspx');							
			});
										   
			$("#searchFormbr").submit ( function() {
				jqsearchutil.SearchFormSubmit('br','Incorpore por favor un artículo de la búsqueda...','/Resultados_br.aspx');		
			});
												   
		});
	},
	
	InitiateMouseOver:function() {
		$("#goLinkfr").mouseover( function() {
				 window.status='';
		});
		
		$("#goLinken").mouseover( function() {
			 window.status='';
		});
		
		$("#goLinkes").mouseover( function() {
			 window.status='';
		});
		
		$("#goLinkbr").mouseover( function() {
			 window.status='';
		});	
	},
	
	SearchLinkClick:function(sLang,sMessageEcran,sResultPage) {
		var sSearchForm = '#searchForm'+sLang;
		if ($("#search_string").attr('value')=='') {
				alert(sMessageEcran);
				$("#search_string").focus();
				return false;
		} else {
			var strResultPage = sResultPage + '?q=' + $("#search_string").attr('value');
			$(sSearchForm).attr('action',strResultPage);
			$(sSearchForm).submit();
		} 
	},
	
	SearchFormSubmit:function(sLang,sMessageEcran,sResultPage) {
		var sSearchForm = '#searchForm'+sLang;
		if ($("#search_string").attr('value')=='') {
				alert(sMessageEcran);
				$("#search_string").focus();
				return false;
		} else {
			var strResultPage = sResultPage + '?q=' + $("#search_string").attr('value');
			$(sSearchForm).attr('action',strResultPage);
		}
	}
};

jqsearchutil.init();

var jqclientlogos={
			
	nCeiling: 45,

	init:function(conf){
		$(document).ready(function(){
								   
         if ($("#clientslide").width()) {								   
								   
			var arrImages = new Array(
	'<img src="/myImages/clientlogos/aftam.jpg" alt="AFTAM" border="0" />',
	'<img src="/myImages/clientlogos/airbus.jpg" alt="AIRBUS" border="0" />',
	'<img src="/myImages/clientlogos/air-france.jpg" alt="Air France" border="0" />',
	'<img src="/myImages/clientlogos/air-liquide.jpg" alt="Air Liquide" border="0" />',
	'<img src="/myImages/clientlogos/anpe.jpg" alt="ANPE" border="0" />',
	'<img src="/myImages/clientlogos/axa.jpg" alt="Axa France" border="0" />',
	'<img src="/myImages/clientlogos/banque-postale.jpg" alt="La Banque Postale" border="0" />',
	'<img src="/myImages/clientlogos/beaute-prestige.jpg" alt="Beauté Prestige" border="0" />',
	'<img src="/myImages/clientlogos/editis.jpg" alt="Editis" border="0" />',
	'<img src="/myImages/clientlogos/emi.jpg" alt="EMI" border="0" />',
	'<img src="/myImages/clientlogos/barclays.jpg" alt="Barclays" border="0" />',
	'<img src="/myImages/clientlogos/bnp-parisbas.jpg" alt="BNP Parisbas" border="0" />',
	'<img src="/myImages/clientlogos/bouygues-construction.jpg" alt="Bouygues Construction" border="0" />',
	'<img src="/myImages/clientlogos/bouygues-immobilier.jpg" alt="Bouygues Immobilier" border="0" />',
	'<img src="/myImages/clientlogos/bred.jpg" alt="Bred" border="0" />',
	'<img src="/myImages/clientlogos/cnasea.jpg" alt="CNASEA" border="0" />',
	'<img src="/myImages/clientlogos/cofrac.jpg" alt="Cofrac" border="0" />',
	'<img src="/myImages/clientlogos/dcns.jpg" alt="DCNS" border="0" />',
	'<img src="/myImages/clientlogos/dexia.jpg" alt="Dexia épargne pension" border="0" />',
	'<img src="/myImages/clientlogos/edf.jpg" alt="EDF" border="0" />',
	'<img src="/myImages/clientlogos/europ-assistance-holding.jpg" alt="Europ Assistance Holding" border="0" />',
	'<img src="/myImages/clientlogos/generali.jpg" alt="Generali" border="0" />',
	'<img src="/myImages/clientlogos/gdf-suez.jpg" alt="GDF SUEZ" border="0" />',
	'<img src="/myImages/clientlogos/hachette-filipacchi-medias.jpg" alt="Hachette Filipacchi Médias" border="0" />',
	'<img src="/myImages/clientlogos/ig3m.jpg" alt="IG3M" border="0" />',
	'<img src="/myImages/clientlogos/irp-auto.jpg" alt="IRP Auto" border="0" />',
	'<img src="/myImages/clientlogos/ipsen.jpg" alt="IPSEN" border="0" />',
	'<img src="/myImages/clientlogos/janssen-cilag.jpg" alt="Janssen Cilag" border="0" />',
	'<img src="/myImages/clientlogos/la-poste.jpg" alt="La Poste" border="0" />',
	'<img src="/myImages/clientlogos/laboratoires-servier.jpg" alt="Laboratoires Servier" border="0" />',
	'<img src="/myImages/clientlogos/ministere-de-l-emploi.jpg" alt="Ministère de l\'emploi" border="0" />',
	'<img src="/myImages/clientlogos/natixis.jpg" alt="Natixis" border="0" />',
	'<img src="/myImages/clientlogos/novartis.jpg" alt="Novartis" border="0" />',
	'<img src="/myImages/clientlogos/orange.jpg" alt="Orange" border="0" />',
	'<img src="/myImages/clientlogos/psa.jpg" alt="PSA" border="0" />',
	'<img src="/myImages/clientlogos/ratp.jpg" alt="RATP" border="0" />',
	'<img src="/myImages/clientlogos/sanofi-aventis.jpg" alt="Sanofi Aventis" border="0" />',
	'<img src="/myImages/clientlogos/sfr.jpg" alt="SFR" border="0" />',
	'<img src="/myImages/clientlogos/siemens.jpg" alt="Siemens" border="0" />',
	'<img src="/myImages/clientlogos/sncf.jpg" alt="SNCF" border="0" />',
	'<img src="/myImages/clientlogos/stallergenes.jpg" alt="Stallergenes" border="0" />',
	'<img src="/myImages/clientlogos/systeme-u.jpg" alt="Système U" border="0" />',
	'<img src="/myImages/clientlogos/thales-alenia-space.jpg" alt="Thales Alenia Space" border="0" />',
	'<img src="/myImages/clientlogos/vente-privee.jpg" alt="Vente Privée" border="0" />',
	'<img src="/myImages/clientlogos/ville-boulogne-billancourt.jpg" alt="Ville de Boulogne-Billancourt" border="0" />'
			);		
			
			
			$("#barrelogos").bind("click",function() {
				window.location = "/clients.htm";
			});

			arrImages = $.shuffle(arrImages);

			jqclientlogos.AddImagestoPage(arrImages);
			
		 }
			
		});
		
		
	},
	
	StartCrossSlide:function() {
		$("#clientsimages").reorder();
		$("#clientslide").crossSlide({
		  speed: 35,  //px/sec
		  fade: 1     //sec
		}, [], "div[id=clientsimages]");
	},
	
		
	AddImagestoPage:function(arrImages) {
		var iIncrement = 0;		
		arrImages = $.shuffle(arrImages);
		$.each(arrImages, function( intIndex, objValue ){
			
			var irand = Math.floor(Math.random() * arrImages.length); 
			var iCutOff = Math.round((arrImages.length)/2);
			if (irand > iCutOff) {	
				iIncrement += 1;								
				$("#clientsimages").append($( objValue));
			} 
			
			if (iIncrement >= jqclientlogos.nCeiling) {
				jqclientlogos.StartCrossSlide();
				return false;
			}
			
			if (intIndex == (arrImages.length-1)) {
				jqclientlogos.StartCrossSlide();
				return false;
			}
			
		});
	}

	
};

jqclientlogos.init();



var accueilpanel={
	
	RefreshContent: [],
	countPanels:0,
	iPause:7000,
	iTimer:7000,
	currentTimer: 0,
	arrayTimer: [],
		
	setTimer:function(sFunctionName, nTime) {
			clearTimeout(accueilpanel.currentTimer);
			accueilpanel.currentTimer = setTimeout(sFunctionName, nTime);
	},
	
	changeContent:function(iC) {
		
		$('#profile-content-en').fadeOut('fast', function() {
			$(this).html(accueilpanel.RefreshContent[iC]);
		}).fadeIn(1000);
		
		$('#bpm-boutons>div').each(function(i) {
			if (iC==i) {
				$(this).removeClass('myopa');
			} else {
				$(this).addClass('myopa');
			}
		});
	},
	
	setPanels:function() {
			
			for (var i = 0; i < accueilpanel.RefreshContent.length; i++) {
				var iCount = i+1;
				if (iCount == accueilpanel.RefreshContent.length) {iCount = 0};
				var sFunction = "accueilpanel.changeContent("+iCount+")";
				var t = setTimeout(sFunction,accueilpanel.iTimer);
				accueilpanel.arrayTimer.push(t);
				accueilpanel.iTimer +=  accueilpanel.iPause;
			}		
			
	},
	
	clearTimer:function() {
		 for (var i = 0; i < accueilpanel.arrayTimer.length; i++) {
			 clearTimeout(accueilpanel.arrayTimer[i]);
		 }
	},
	
	changebandeau:function() {
		var sbandeau = $("#w4topcontainer>div.art-header-new").css('background-image');
		var bandeau1 = 'url("http://www.w4community.eu/myImages/test-bandeau2.jpg")';
		var bandeau2 = 'url("http://www.w4community.eu/myImages/test-bandeau.jpg")';
		
		if (sbandeau==bandeau1) {
			
			$("#w4topcontainer>div.art-header-new").css('background-image',bandeau2);
			
		} else {
			
			$("#w4topcontainer>div.art-header-new").css('background-image',bandeau1);
			
		}
		
	},
	
	init:function(){
		$(document).ready(function(){
			
			/*$("#w4topcontainer>div.art-header-new").click(function() {
				accueilpanel.changebandeau();
			});*/
			
			
			
			//initiate content of 3 panels
			$('#panelcontent>div').each(function(i) {
				accueilpanel.RefreshContent[i] = $(this).html();				
			});
			
			//Set an array of Timers to change content
			for (var i = 0; i < accueilpanel.RefreshContent.length; i++) {
				accueilpanel.setPanels();
			}
			
			//Set buttons on array panel
			switch (window.location.pathname) {
				 case "/bpm.htm":
				 $('#w4pagecontainer>div').prepend('<div id="bpm-boutons"><div id="bb1">1</div><div id="bb2" class="myopa">2</div><div id="bb3" class="myopa">3</div></div>');
				 break;
				  case "/bpm2.htm":
				 $('#w4pagecontainer>div').prepend('<div id="bpm-boutons"><div id="bb1">1</div><div id="bb2" class="myopa">2</div><div id="bb3" class="myopa">3</div></div>');
				 break;
				 case "/":
				 $('#w4pagecontainer>div').prepend('<div id="bpm-boutons"><div id="bb1">1</div><div id="bb2" class="myopa">2</div><div id="bb3" class="myopa">3</div></div>');
				 break;
				 default:
				 break;
			};
			
			$('#bpm-boutons>div').each(function(i) {
				
				/*$(this).hover(function(ev) {
					$(this).removeClass('myopa');
				},function (ev) {
					$(this).addClass('myopa');
				});*/
				
				
				$(this).click(function() {
					accueilpanel.clearTimer();
					var FTimer = "accueilpanel.changeContent("+i+")";
					accueilpanel.setTimer(FTimer,100);
					accueilpanel.iTimer = 5000;
					accueilpanel.setPanels();
				});
				
				$("#bpm-mobile-homepage").click(function() {
					window.location = "/bpm-mobilite.htm";
				});
				
				
				
				
			});

		});
	}
	
}

accueilpanel.init();

var W4breadcrumb = {
	
	divBC: "",
	dividorBC: "  &#8250;  ",
	classCurrLink: "W4breadcrumbCurrent",
	classNormal: "W4breadcrumb",
	
	InsertBreadCrumb:function() {
		//$('h2').css('visibility','hidden');
		$('#w4pagecontainer').prepend('<div id="W4BC">'+W4breadcrumb.divBC+'</div>');
	},
	
	AddDivider:function() {
		W4breadcrumb.divBC += W4breadcrumb.dividorBC;
	},
	
	AddLink:function(strLink, strClass, strText) {
		W4breadcrumb.divBC += '<a href="'+strLink+'" class="'+strClass+'">'+strText+'</a>';
	},
	
	init:function(){
		$(document).ready(function(){
			
			var blnContinue = true;
			
			switch (window.location.pathname) {
				 case "/produits.htm":
				 	blnContinue = false;
				 break;
				 default:
				 break;
			}
			
			
			
			if (blnContinue==true) {
						
			var $headers = $("#myslidemainmenu>ul>li.bctop");
			
			
			
			$headers.each(function(i){
				
				var checkforchildul = $(this).find('ul');
				var bogus = "";			
				
				var $curobj=$(this);
				var $subul=$(this).find('ul:eq(0)') ;
				var strCurrentLink = window.location.pathname;
				var strTopLink = $curobj.find('a:first').attr('href');
				var strTopText = $curobj.find('a:first').text();
				var strSubTopLink = $subul.find('a:first').attr('href');
				var strSubTopText = $subul.find('a:first').text();
				
				if(strCurrentLink==strTopLink) {
					
                    W4breadcrumb.AddLink(strTopLink,W4breadcrumb.classCurrLink,strTopText);
									
					$subul.children().each(function() {
						
						
						var strSubLink = $(this).find('a:first').attr('href');
						var strSubText = $(this).find('a:first').text();
						
						if(strCurrentLink==strSubLink) {
					         
							 W4breadcrumb.AddDivider();
							 W4breadcrumb.AddLink(strSubLink,W4breadcrumb.classCurrLink,strSubText);
							 
					    } else {
								
						     W4breadcrumb.AddDivider();
							 W4breadcrumb.AddLink(strSubLink,W4breadcrumb.classNormal,strSubText);
							
						}
						
						
				    });
					
					W4breadcrumb.InsertBreadCrumb();
				
				} else {
					
					var blnIsCurrent = false;
					
					$subul.children().each(function() {
						
						var strSubLink = $(this).find('a:first').attr('href');
						var strSubText = $(this).find('a:first').text();
						
						if(strCurrentLink==strSubLink) {
					         blnIsCurrent = true; 
					    } 
				    });
					
					if (blnIsCurrent==true) {
						
						W4breadcrumb.divBC = "";
						W4breadcrumb.AddLink(strTopLink,W4breadcrumb.classNormal,strTopText);
						
						$(this).find('ul:first').children().each(function() {
						
						var strSubLink = $(this).find('a:first').attr('href');
						var strSubText = $(this).find('a:first').text();
						
						if(strCurrentLink==strSubLink) {
					         
							 W4breadcrumb.AddDivider();
							 W4breadcrumb.AddLink(strSubLink,W4breadcrumb.classCurrLink,strSubText);
							 
					    } else {
								
						     W4breadcrumb.AddDivider();
							 W4breadcrumb.AddLink(strSubLink,W4breadcrumb.classNormal,strSubText);
							
						}
				    });
						
						W4breadcrumb.InsertBreadCrumb();
					}
					
				}
					
				
				
			
				
			});
			
			} else {
				W4breadcrumb.InsertBreadCrumb();
			}
				 
		    //W4breadcrumb.InsertBreadCrumb();
				 
		});
	}
}

W4breadcrumb.init();

var BFRollovers = {
	init:function(){
		$(document).ready(function(){
			
			$("#imgBF").hover(function(ev) {
				   $(this).find('img').attr('src','/myImages/business-first-circle-over.jpg');
 			},function (ev) {
                    $(this).find('img').attr('src','/myImages/business-first-circle.jpg');
			});
			
			$("#imgCrowd").hover(function(ev) {
				   $(this).find('img').attr('src','/myImages/crowd-circle-over.jpg');
 			},function (ev) {
                    $(this).find('img').attr('src','/myImages/crowd-circle.jpg');
			});
			
			$("#imgAg").hover(function(ev) {
				   $(this).find('img').attr('src','/myImages/agility-cercle-over.jpg');
 			},function (ev) {
                    $(this).find('img').attr('src','/myImages/agility-cercle.jpg');
			});
			
			$("#imgKey").hover(function(ev) {
				   $(this).find('img').attr('src','/myImages/cle-cercle-over.jpg');
 			},function (ev) {
                    $(this).find('img').attr('src','/myImages/cle-cercle.jpg');
			});
			
			$("#imgBudget").hover(function(ev) {
				   $(this).find('img').attr('src','/myImages/budget-cercle-over.jpg');
 			},function (ev) {
                    $(this).find('img').attr('src','/myImages/budget-cercle.jpg');
			});
			
			$("#imgSerious").hover(function(ev) {
				   $(this).find('img').attr('src','/myImages/serious-cercle-over.jpg');
 			},function (ev) {
                    $(this).find('img').attr('src','/myImages/serious-cercle.jpg');
			});
			
			
		});
	}
	
}

BFRollovers.init();
