function showMap(idRes)
{
$("#mapFrame").attr("src","modules/resellerMap.php?idRes="+idRes);
$("#contDivResellerMap").fadeIn("slow");

}
function openCakeBuilder(){
	$.get("modules/cakeBuilder.php", "", function(result) {
		  $("#catHolder").fadeOut("fast",function(){
			  $("#catHolder").html(result);$("#currentCat").val("0");
			  });
		  $('#catHolder').fadeIn("fast");
	});	catSyncCaption('12');
}
function scrollNewsUp(){
var pos = $("#homeNewsSlider").position();
var topPos=pos.top;//alert(topPos-40);
if(topPos<0)
$("#homeNewsSlider").animate({top:(topPos+40)}, {duration: 200, easing: 'easeOutCirc'});
}

function scrollNewsDown()
{
var pos = $("#homeNewsSlider").position();
var topPos=pos.top; 

$("#homeNewsSlider").animate({top:(topPos-40)}, {duration: 200, easing: 'easeOutCirc'});
}

function openDetails(itemId)
{
	$.ajax({
	type: "GET",
	url: "modules/itemDetails.php",
	data: "itemId="+itemId,
	cache: true,
	//async: false,
	  success: function(html){
		$("#catDetDiv").html(html);
		$('#slide-'+itemId).cycle({ fx: 'fade', speed:  2500  });
		$("#catDetDiv").fadeIn(600);
		
	  }
	});	
	
}
function openNewDet(newsId)
{
	$.ajax({
	type: "GET",
	url: "modules/newsDetails.php",
	data: "newsId="+newsId,
	cache: true,
	//async: false,
	  success: function(html){
		$("#homeDivNewsDetails").html(html);
		$("#homeDivNewsDetails").fadeIn(600);
	  }
	});	
	
}
function order()
{
	//$("#catOrderFinal").fadeIn("slow");
	$.ajax({
	type: "GET",
	url: "modules/checkOut.php",
	data: "",
	cache: false,
	//async: false,
	  success: function(html){
		$("#catOrderFinal").html(html);
		$("#catOrderFinal").fadeIn(600);
	  }
	});	
}
function closeMap()
{
	$("#contDivResellerMap").fadeOut("fast");
}
function closeDet()
{
	$("#catDetDiv").fadeOut("fast");
}
function closeDoc()
{
	$("#docDiv").fadeOut("fast");
	$("#flashObj").fadeIn("fast");
}
function closeNewsDet(){
	$("#homeDivNewsDetails").fadeOut("fast");
}
function addCart(itemNo,action)
{
	var loadCartPt=loadCart;
	$.ajax({
	type: "GET",
	url: "modules/cart.php",
	data: "item="+itemNo+"&act="+action+"&",
	//cache: false,
	//async: false,
	  success: function(html){
		  loadCartPt();
	  }
	});	
}
function showDetFromslide(idImg)
{
	$("#divSlideDetails").fadeOut("fast",function() {
		$.ajax({
		type: "GET",
		url: "modules/getProductInfo.php",
		data: "idProd="+idImg,
		cache: true,
		async: true,
		success: function(html){
		  $("#divSlideDetails").html(html);
		  }
		});	
		$("#divSlideDetails").fadeIn("fast"); 
	})
}
function loadCart()
{
//alert("load cart");
	$.ajax({
	type: "GET",
	url: "modules/cartbody.php",
	data: "",
	cache: false,
	async: false,
	  success: function(html){
		$("#catCartDivHolder").html(html);
		$('#cartBody tr').tooltip({
	track: true,
	delay: 0,
	showURL: false,
	showBody: " - ",
	fade: 50
}); 

	  }
	});		
}
function loadInfo()
{
//alert("load cart");
	$.ajax({
	type: "GET",
	url: "modules/distribInfo.php",
	data: "",
	cache: false,
	async: false,
	  success: function(html){
		$("#catCartDivHolder").html(html);
	  }
	});		
}
function getSessionValue(sessVal)
{
	var retVal="";
	$.ajax({
	type: "GET",
	url: "modules/getSessionVal.php?sessVal="+sessVal,
	data: "sessVal="+sessVal,
	cache: false,
	 async: false,

	  success: function(html){
		  if(html=='true')retVal='true';
		  else retVal='false';
	  }
	});
	
	return retVal;
}
function chkTogle(sessItem, sessVal){
	//alert("je change la session: "+sessItem+" qui devient: "+$(sessVal).attr('checked'));
	$.ajax({
	type: "GET",
	url: "modules/setSessionVal.php",
	data: "&sessItem="+sessItem+"&sessVal="+$(sessVal).attr('checked'),
	cache: true,
	async: true,
	success: function(html){
		if($("#currentCat").val()!='')document.location='?id=2&cat='+$("#currentCat").val();
		else document.location='?id=2&cakeBuilder=1';
	  }
	});	
	
}
function openWork(idImg)
{
$("img[id^='master']").fadeOut("fast",function() {
 document.location.href="index.php?id=51&work="+idImg
});
}
function dispWorkImg(idImg)
{$("#imgHolder").fadeOut("fast",function() {
 $("#imgHolder").attr("src", "img/img-"+idImg+".jpg");
 $("#imgHolder").fadeIn("fast");
});


}
function changeCss(id,css){
if($("#"+id).attr('class')!='menuLeftPanSelected' &&$("#"+id).attr('class')!='menuRightPanSelected')	$("#"+id).attr({"class": css});
}

function goTo(page){
//closeDet($('#portOpened').val());
//alert(page);
	var coeff=-page+1;
	$("span[id^='pageSpan']").css({'background-color' : 'white', 'font-weight' : 'normal', 'color' : '#666'});
	$('#pageSpan'+page).css({'background-color' : '#f66', 'font-weight' : 'bolder', 'color' : '#fff'});
	$('#catSlider').animate({top:346*coeff}, {duration: 900, easing: 'easeOutCirc'});
}
function goPageHome(pageNo){
	var coeff=-pageNo+1;
	$('#homeInfosSlider').animate({left:370*coeff}, {duration: 500, easing: 'easeOutCirc'});	
}
function catSyncCaption(catId){
	  $.get("modules/catalogCaption.php", "&catId="+catId, function(result) {
						$("#catDivHeader").fadeOut("fast",function(){
											  $("#catDivHeader").html(result);});
						$('#catDivHeader').fadeIn("fast");
	});
}
function catSyncItems(catId){	
	$.get("modules/catalogItems.php", "&catId="+catId, function(result) {
						$("#catHolder").fadeOut(
									"fast",function(){
											  $("#catHolder").html(result);$("#currentCat").val(catId);catSyncCaption(catId);
											  });
						$('#catHolder').fadeIn("fast");
	});	
}
function sendFormData()
{
	var data=$("#cakeBuilderForm").serialize();
		
	$.ajax({
	type: "GET",
	url: "modules/addSpecialData.php",
	data: data,
	cache: false,
	async: false,
	success: function(html){
	addCart(html,'add');
	  }
	});	
}

function checkOut()
{
	var data=$("#formCheckOut").serialize();
		
	$.ajax({
	type: "GET",
	url: "modules/sendData.php",
	data: data,
	cache: false,
	async: false,
	success: function(html){
		alert(html);
		closeCheckOut();
	  }
	});	
}
function orderNot()
{
	alert("Vous devez commander pour une somme suppérrieur à 45.- (livraison incluse) pour que vous puissiez finaliser votre commande. Merci pour votre compréhension.");
}


function openDoc(docId){
	  $.get("modules/docText.php", "&docId="+docId, function(result) {
						$("#docDiv").fadeOut("fast",function(){
									$("#flashObj").fadeOut("fast");
									$("#docDiv").html(result);});
						$('#docDiv').slideDown("fast");
	});
}












