


$(document).ready(function(){


$(function() {
		$("#dialog").dialog({
			bgiframe: true,
draggable:false,
        
			modal: true,

			buttons: {
				Ok: function() {
					$(this).dialog('close');
				}
			}
		});
	});


//$(".imgOverlay").height($("#page").height()); // configure la hauteur de l overlay en fonction de la hauteur du div global
var temp = '';
/*--------------------  box language    -------------------------*/
	$(".language .menu_languages ").click(function(){
		$(".ui-language").show();
		return false;
	});
	$(".language .close-box").click(function(){
		$(".ui-language").hide();
		return false;
	});
	
/*-------------------- Inpu field  -------------------------*/	 
$("input.txt").focus(function (){
	if($(this).val().length!=0) {
		temp=$(this).val();	
		$(this).val('');
	} 
});
$("input.txt").blur(function (){
	if($(this).val().length==0) {
		$(this).val(temp);
	}
});	 


/*------------------------ main  menu for all pages  -----------------------------------*/
	$(".imgOverlay").hide();
	$("#main-menu .submenu").hide();
	$("#item1").prepend("<a id='fake_about' href='"+$("#about-item").attr("href")+"'>&nbsp;</a>");
	$("#item2").prepend("<a id='fake_solutions' href='"+$("#solutions-item").attr("href")+"'>&nbsp;</a>");
	$("#item3").prepend("<a id='fake_services' href='"+$("#services-item").attr("href")+"'>&nbsp;</a>");
	$("#item4").prepend("<a id='fake_news' href='"+$("#news-item").attr("href")+"'>&nbsp;</a>");
	
	$("#main-menu .menu .linkItem").not("#careers-item").not("#contact-item").hover(function(){
		$(".imgOverlay").show();
	},
	function(){
	});
	
	$("#main-menu .menu .linkItem").not("#careers-item").not("#contact-item").hover(function(){
		$(this).parent().addClass("selected");
		$(this).next().show(); //display the next div	
	},
	function(){});
	
	$("#main-menu .menu .linkItem").next().hover(function(){
	},
	function(){
		$(".imgOverlay").click();
	});
	
	$(".close-box").click(function(){
		$(".imgOverlay").hide();
		$("#main-menu .submenu").hide();
		$(this).parents("li:first").removeClass("selected");
		return false;
	});
	
	$(".imgOverlay").click(function(){
		$(".close-box").click();
	});
	
	if ($("#main-menu .menu li").length != 0)
	{
		$("#main-menu > .menu > li > div > a").each(function(){
				$(this).hover(function(e){$(this).parent().show()},function(e){ 
				$(this).parent().hide();});
		});
		$(".center-repeat").hover(function(e){
			$(this).parent().show();
		},function(e){$(this).parent().hide();});
	}
	
	
/*------------------------ left home menu -----------------------------------*/
	// we show the first drop down 
	if ( $("#link-corporate").parents(".fr").length != 0){
		$("#link-corporate").css({
							background:"url(/digitalAssets/0/341_bg_hover_home_menu.png) no-repeat 0 0", 
							paddingLeft:"100px",
							width:"208px"						
						});
	}
	else{
		$("#link-corporate").css({
							background:"url(/digitalAssets/0/341_bg_hover_home_menu.png) no-repeat 0 0", 
							paddingLeft:"115px",
							width:"193px"						
						});
	}
	$("#link-corporate .img").css('background-position','top right');		
	$("#menu-left-home #nav1 .submenu-left").show();
	$(" #menu-left-home .main-menu li").hover(function(){	
		//
		$("#menu-left-home #nav1 .submenu-left").hide();
		$("#link-corporate .img").css('background-position','top left');					
		$("#link-corporate").css({
							background:"url(/digitalAssets/0/342_bg_grey_home_menu.png) no-repeat 0 0",
							padding:"8px 22px 8px 0",
							width:"288px"					
						});
		$(".image-banner").children(":eq(" + $(this).parents(".main-menu:first").children().index(this) + ")").show();
		$(".image-banner").children(":not(:eq(" + $(this).parents(".main-menu:first").children().index(this) + "))").hide();
		
		$(this).children(" .submenu-left").show();
		$(this).children("a").children(".img").css('background-position','top right');
		$(this).children("a").css("background","url(/digitalAssets/0/341_bg_hover_home_menu.png) no-repeat 0 0");
		switch ($(this).children("a").attr("id"))
		{
			case "link-corporate":
								if ($(this).children("a").parents(".fr").length != 0){
									 $(this).children("a").css({
										paddingLeft:"100px",
										width:"208px"
									});
								}
								else{
									$(this).children("a").css({
										paddingLeft:"115px",
										width:"193px"
									});
								}
								break;
								
			case "link-government":
								if ($(this).children("a").parents(".fr").length != 0){
									 $(this).children("a").css({
										paddingLeft:"78px",
										width:"230px"
									});
								}
								else{
									$(this).children("a").css({
										paddingLeft:"100px",
										width:"208px"
									});
								}
								 break;
			
			case "link-retail":
								if ($(this).children("a").parents(".fr").length != 0){
									 $(this).children("a").css({
										paddingLeft:"90px",
										width:"290px"
									});
								}
								else{
									$(this).children("a").css({
										paddingLeft:"150px",
										width:"158px"
									});
								}
								break;
								 
			case "link-finance":
								if ($(this).children("a").parents(".fr").length != 0){
									 $(this).children("a").css({
										paddingLeft:"35px",
										width:"273px"
									});
								}
								else{
									$(this).children("a").css({
									paddingLeft:"55px",
									width:"293px"
									});
								}
								
								 break;
			case "link-solutions":
								if ($(this).children("a").parents(".fr").length != 0){
									 $(this).children("a").css({
										paddingLeft:"25px",
										width:"283px"
									});
								}
								else{
									$(this).children("a").css({
										paddingLeft:"35px",
										width:"273px"
									});
									 break;
								}
								
		}
	},
	function(){
		$(this).children("a").css({padding:"8px 22px 8px 0",
									width:"288px"});
		$(this).children(" .submenu-left").hide();
		$(this).children("a").children(".img").css('background-position',' top left');
		$(this).children("a").css("background","#383537 url(/digitalAssets/0/342_bg_grey_home_menu.png) no-repeat 0 0");
		if ( $(this).children("a").attr("id") == 'link-solutions'){
			$("#link-solutions").css("background","#000000 url(/digitalAssets/0/344_bg_black_home_menu.png) no-repeat 0 0");
		}
		
	});
	
	$(" #menu-left-home .main-menu li .submenu-left").hover(function(){
		$(this).prev().children(".img").css('background-position','top right');
		$(this).prev().css("background","url(/digitalAssets/0/341_bg_hover_home_menu.png) no-repeat 0 0");
	},
	function(){
	});
	
	
});


