var initWidth=Number('238');
var addWidth =Number('179');
var addWidth2 =Number('358');
var loading = '

');
var doAction = function(){
if(m=='2') var block = "pdvDistri";
else var block = "pdvPays";
if( $("#"+block).length==0 ) $("#pdvContinent").after('');
$("#"+block).html(loading);
href=href.replace("points.php","ajax_points.php");
$.get(href,function(e){
var html = e; $("#"+block).fadeOut(100,function(){ $(this).html(e).fadeIn(250); if(m=="2") eventDistri(); else eventPays(); });
});
};
var myWidth = addWidth; if(m=="2") myWidth = addWidth2;
var el = $("#pdvBlock"); var width = initWidth+myWidth; var CurrentWidth=el.width();
$("#pdvContinent .content").css({'border-right':'3px solid #B3B1AD'});
if(CurrentWidth!=width) $("#pdvBlock").animate({width:width},300,doAction);
else doAction();
}
return false;
});
};
var eventPays = function(){
$("#pdvPays a").click(function(){
if( !$(this).is('.select') ){
var href = $(this).attr('href');
$("#pdvPays a.select").each(function(){
$(this).removeClass('select');
$(this).next('img').remove();
});
$(this).addClass('select');
$(this).after('
');
var doAction = function(){
if( $("#pdvVille").length==0 ) $("#pdvPays").after('');
$("#pdvVille").html(loading);
href=href.replace("points.php","ajax_points.php");
$.get(href,function(e){
var html = e; $("#pdvVille").fadeOut(100,function(){ $(this).html(e).fadeIn(250); eventVille(); });
});
};
var el = $("#pdvBlock"); var width = initWidth+addWidth+addWidth; var CurrentWidth=el.width();
$("#pdvPays .content").css({'border-right':'3px solid #B3B1AD'});
if(CurrentWidth!=width) $("#pdvBlock").animate({width:width},300,doAction);
else doAction();
}
return false;
});
};
var eventVille = function(){
$("#pdvVille a").click(function(){
if( !$(this).is('.select') ){
var href = $(this).attr('href');
$("#pdvVille a.select").each(function(){
$(this).removeClass('select');
$(this).next('img').remove();
});
$(this).addClass('select');
$(this).after('
');
var doAction = function(){
if( $("#pdvDistri").length==0 ) $("#pdvVille").after('');
$("#pdvDistri").html(loading);
href=href.replace("points.php","ajax_points.php");
$.get(href,function(e){
var html = e; $("#pdvDistri").fadeOut(100,function(){ $(this).html(e).fadeIn(250); eventDistri(); });
});
};
var el = $("#pdvBlock"); var width = initWidth+addWidth+addWidth+addWidth; var CurrentWidth=el.width();
$("#pdvVille .content").css({'border-right':'3px solid #B3B1AD'});
if(CurrentWidth!=width) $("#pdvBlock").animate({width:width},300,doAction);
else doAction();
}
return false;
});
};
var eventDistri = function(){
$("#pdvDistri a").click(function(){
if( !$(this).is('.select') ){
var href = $(this).attr('href');
$("#pdvDistri a.select").each(function(){
$(this).removeClass('select');
$(this).next('img').remove();
});
$(this).addClass('select');
$(this).after('
');
var doAction = function(){
if( $("#pdvMask").length==0 ) $("#pdvBlock").after('');
if( $("#pdvFiche").length==0 ) $("#pdvMask").after('');
$("#pdvMask").css('opacity','0').show().animate({opacity:0.7},300);
$("#pdvFiche").fadeIn(300,function(){
$(this).html(loading);
href=href.replace("points.php","ajax_points.php");
$.get(href,function(e){
var html = e; $("#pdvFiche").fadeOut(100,function(){ $("#pdvFiche").html(html).fadeIn(250); eventFiche(); });
});
});
};
$("#pdvMask, #pdvFiche").remove();
doAction();
}
return false;
});
};
var eventFiche = function(){
$("#pdvClose a").click(function(){
$("#pdvFiche").fadeOut(650,function(){
$(this).remove();
$("#pdvMask").fadeOut(300);
});
$("#pdvDistri a.select").each(function(){
$(this).removeClass('select');
$(this).next('img').remove();
});
return false;
});
};
var allEvents = function(){
eventContinent();
eventPays();
eventVille();
eventDistri();
eventFiche();
};
$(document).ready(function(){ allEvents(); });