/* MAIN NAVIGATION SLIDE UP/DOWN */
$(document).ready(function(){
    // 1. On cache les sous-menus
    $("ul.subNavigation").hide();
    // 2. On affiche ou masque le sous-menu
	$("li.toggleSubNaivgation").hover(
		function(){
			$(this).find("ul.subNavigation").show();
			$(this).find("span:first").addClass("over");
		},
		function(){
			$(this).find("ul.subNavigation").hide();
			$(this).find("span:first").removeClass("over");;
		}
	);   
});



/* ESTIMATE FORM */
$(document).ready(function(){
	displaySwitchboard();
	$("select#estimate_form_needs").change(function(){
		displaySwitchboard()
	});
});	
	
function displaySwitchboard(){
	if($("#estimate_form_needs option:selected").val()=="switchboard"){
		$("div.switchboard").show();
	}
	else{
		$("div.switchboard").hide();	
	}
}



/* POP-IN CALLBACK */
$(document).ready(function(){
	$("li.callback a").nyroModal({
		width: 420,
		height: 430,
		padding:0,
		resizable: false,
		autoSizable: false
	});
});

/* POP-IN CENTREX EQUIPMENT */
$(document).ready(function(){
	$("a.centrex_equipment").nyroModal({
		minWidth: 450,
		minHeight: 250,
		padding:0
	});
});

/* POP-IN CENTREX FUNCTIONNALITY */
$(document).ready(function(){
	$("a.centrex_functionnality").nyroModal({
		minWidth: 450,
		minHeight: 150,
		padding:0,
		autoSizable: true
	});
});

/* POP-IN IPBX EQUIPMENT */
$(document).ready(function(){
	$("a.ipbx_equipment").nyroModal({
		minWidth: 450,
		minHeight: 150,
		padding:0,
		autoSizable: true
	});
});

/* POP-IN IPBX FUNCTIONNALITY */
$(document).ready(function(){
	$("a.ipbx_functionnality").nyroModal({
		minWidth: 450,
		minHeight: 150,
		padding:0,
		autoSizable: true
	});
});

/* POP-IN MEMO-CARDS */
$(document).ready(function(){
	$("ul.memo_cards a").nyroModal({
		minWidth: 321,
		minHeight: 208,
		padding:0,
		autoSizable: false
	});
});



/* TESTIMONY SELECTION */
$(document).ready(function(){
	testimonySwitch();
	$(".selector select").change( function(){
		testimonySwitch();
	});
});

function testimonySwitch(){	
	$(".testimony_list .testimony_box").hide();
	$("."+$(".selector select option:selected").val()).show();
}



/* TOPIC SLIDE UP/DOWN */
$(document).ready(function(){
	setContentClick();
});

function setContentClick(){
	$("li.topic .news_content").hide();
	$("li.topic .toggle_link").click(
		function(){
			var that = this;
			if($(this).prev(".news_content").css("display")=="none"){
				$(this).prev(".news_content").slideDown("slow",function(){
					$(that).text("Masquer le contenu");
				 });
			}
			else{
				$(this).prev(".news_content").slideUp("",function(){
					$(that).text("En savoir plus ...");
				 });
			}
		}
	);
}

/* TOPIC SELECTION */
$(document).ready(function(){
	topicSwitch();
	$(".selector select").change( function(){
		topicSwitch();
	});
});

function topicSwitch(){	
	$("li.topic").hide();
	$("."+$(".selector select option:selected").val()).show();
}