        //	Version: 3.0.1
// setPosition / REMPLACER PAR set_position SUR LES PAGES
// parseInt(set_position)+parseInt(1)
// SELECT

function verif_numeric(variable){var exp = new RegExp("^[0-9]+$","g");
return exp.test(variable);}

(function($) {$.prettyPhoto = {version: '3.0'};
$.fn.prettyPhoto = function(pp_settings) {pp_settings = jQuery.extend({animation_speed: 'slow',	slideshow: false, 
autoplay_slideshow: false, opacity: 0.70, show_title: true,	allow_resize: true,	default_width: 500, 
default_height: 344, counter_separator_label: '/', theme: 'facebook', fiscal: 'Bouvard', hideflash: false, 
wmode: 'opaque', autoplay: true, modal: false, overlay_gallery: true, keyboard_shortcuts: true, 
changepicturecallback: function(){}, callback: function(){}, 
	markup: '<div class="pp_pic_holder"> \
<div class="ppt">&nbsp;</div> \
<div class="pp_top"> \
<div class="pp_left"></div> \
<div class="pp_middle"></div> \
<div class="pp_right"></div> \
</div> \
<div class="pp_content_container"> \
<div class="pp_left"> \
<div class="pp_right"> \
<div class="pp_content"><div class="spie"></div> \
<div class="pp_loaderIcon"></div> \
<div class="pp_fade"> \
<a href="#" class="pp_expand" title="Expand the image">Expand</a> \
<div class="pp_hoverContainer"> \
<a class="pp_next" href="#">next</a> \
<a class="pp_previous" href="#">previous</a> \
</div> \
<div id="pp_full_res"></div> \
<div class="pp_details clearfix"> \
<a title="Fermer" class="pp_close" href="javascript:void(0)">Fermer</a><p class="pp_infos">infos</p> \
<div class="pp_nav"> \
<a id="iepap" href="javascript:void(0)" title="Programme pr&#233;c&#233;dent" class="pp_arrow_previous">Previous</a> \
<p class="currentTextHolder">0/0</p> \
<a href="javascript:void(0)" title="Programme suivant" class="pp_arrow_next">Next</a> \
</div><p class="pp_description"></p> \
</div> \
</div> \
</div> \
</div> \
</div> \
</div> \
<div class="pp_bottom"> \
<div class="pp_left"></div> \
<div class="pp_middle"></div> \
<div class="pp_right"></div> \
</div> \
</div> \
<div id="chgcol" class="pp_overlay"></div>',
	gallery_markup: '<a title="Navigation par carte" id="pgmaprog" onmouseout="offmap()" onmouseover="onmap()" href="javascript:void(0)"><img border="0" id="pmap" src="http://www.atoutfisc.com/reduction-impot/template1e/lib/i/navigation/mini_france.png" width="32" height="30"></a> \
<div class="pp_gallery"> \
<select id="selectpgm" name="selectpgm"> \
{gallery} \
<option class="fermer">&nbsp; FERMER pour cette fiscalit&#233;</option> \
</select> \
</div>',
	image_markup: '<img id="fullResImage" src="" />',
	flash_markup: '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',
	quicktime_markup: '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',
	iframe_markup: '<iframe src ="{path}" id="vupgm" width="{width}" height="{height}" frameborder="no"></iframe>',
	inline_markup: '<div class="pp_inline clearfix">{content}</div>',
	custom_markup: ''
}, pp_settings);

var matchedObjects = this, percentBased = false, correctSizes, pp_open,
pp_contentHeight, pp_contentWidth, pp_containerHeight, pp_containerWidth,
windowHeight = $(window).height(), windowWidth = $(window).width(),
pp_slideshow;
doresize = true, scroll_pos = _get_scroll();
$(window).unbind('resize').resize(function(){ _center_overlay(); _resize_overlay(); });

if(pp_settings.keyboard_shortcuts) {$(document).unbind('keydown').keydown(function(e){
if(typeof $pp_pic_holder != 'undefined'){if($pp_pic_holder.is(':visible')){
switch(e.keyCode){
case 37:
$.prettyPhoto.changePage('previous');
break;
case 39:
$.prettyPhoto.changePage('next');
break;
case 27:
if(!settings.modal)
$.prettyPhoto.close();
break;
};
return false;
};	};	});	}

$.prettyPhoto.initialize = function() {settings = pp_settings;
if($.browser.msie && parseInt($.browser.version) == 5) settings.theme = "light_square";
if(settings.allow_resize)
$(window).scroll(function(){ _center_overlay();});
_center_overlay();
set_position = jQuery.inArray($(this).attr('href'), pp_images);
$.prettyPhoto.open();
return false;
}

$.prettyPhoto.open = function(event) {if(typeof settings == "undefined"){settings = pp_settings;
if($.browser.msie && $.browser.version == 5) settings.theme = "light_square";
pp_images = $.makeArray(arguments[0]);
pp_titles = (arguments[1]) ? $.makeArray(arguments[1]) : $.makeArray("");
pp_descriptions = (arguments[2]) ? $.makeArray(arguments[2]) : $.makeArray("");
buildOverlay();
isSet = (pp_images.length > 1) ? true : false;
if(typeof set_position == "undefined") {set_position = 0};}

if($.browser.msie && $.browser.version == 5) $('select').css('visibility','hidden');
if(settings.hideflash) $('object,embed').css('visibility','hidden');
_checkPosition($(pp_images).size());
$('.pp_loaderIcon').show();

if(typeof overcol == "undefined") {overcol = '#00CCFF'};
$pp_overlay.css("background-color",overcol);

if($ppt.is(':hidden')) $ppt.css('opacity',0).show();
$pp_overlay.show().fadeTo(settings.animation_speed,settings.opacity);

$pp_pic_holder.find('.currentTextHolder').text((parseInt(set_position)+parseInt(1)) + settings.counter_separator_label + $(pp_images).size());

function scposlid(peq) { if($('#slider2').slider('value')!=peq){$('#slider2').slider('value', peq);}}
if($('#page').hasClass('pgscellier')) {
if(set_position == 0){$('#body').removeClass().addClass('prim'); scposlid(4);};
if(set_position == 1){$('#body').removeClass().addClass('mdeux'); scposlid(4);};
if(set_position == 2){$('#body').removeClass().addClass('mtrois'); scposlid(4);};
if(set_position == 3){$('#body').removeClass().addClass('mkat'); scposlid(4);};
if(set_position == 4){$('#body').removeClass().addClass('msinq'); scposlid(0);};
if(set_position == 5){$('#body').removeClass().addClass('msis'); scposlid(0);};
if(set_position == 6){$('#body').removeClass().addClass('mset'); scposlid(0);};
if(set_position == 7){$('#body').removeClass().addClass('fin'); scposlid(0);};
}

function lmposlid(seq) { if($('#slider1').slider('value')!=seq){$('#slider1').slider('value', seq);}}
if($('#page').hasClass('pglmnp')) {
if(set_position == 0){$('#body').removeClass().addClass('komens'); lmposlid(20);};
if(set_position == 1){$('#body').removeClass().addClass('mdeux'); lmposlid(20);};
if(set_position == 2){$('#body').removeClass().addClass('mtrois'); lmposlid(20);};
if(set_position == 3){$('#body').removeClass().addClass('mquatre'); lmposlid(20);};
if(set_position == 4){$('#body').removeClass().addClass('mcinq'); lmposlid(16);};
if(set_position == 5){$('#body').removeClass().addClass('msix'); lmposlid(16);};
if(set_position == 6){$('#body').removeClass().addClass('msept'); lmposlid(16);};
if(set_position == 7){$('#body').removeClass().addClass('mhuit'); lmposlid(16);};
if(set_position == 8){$('#body').removeClass().addClass('mneuf'); lmposlid(12);};
if(set_position == 9){$('#body').removeClass().addClass('mdix'); lmposlid(12);};
if(set_position == 10){$('#body').removeClass().addClass('monze'); lmposlid(12);};
if(set_position == 11){$('#body').removeClass().addClass('mouze'); lmposlid(12);};
if(set_position == 12){$('#body').removeClass().addClass('meize'); lmposlid(8);};
if(set_position == 13){$('#body').removeClass().addClass('torz'); lmposlid(8);};
if(set_position == 14){$('#body').removeClass().addClass('qinz'); lmposlid(8);};
if(set_position == 15){$('#body').removeClass().addClass('sez'); lmposlid(8);};
if(set_position == 16){$('#body').removeClass().addClass('dset'); lmposlid(4);};
if(set_position == 17){$('#body').removeClass().addClass('duit'); lmposlid(4);};
if(set_position == 18){$('#body').removeClass().addClass('dneuf'); lmposlid(4);};
if(set_position == 19){$('#body').removeClass().addClass('vun'); lmposlid(4);};
if(set_position == 20){$('#body').removeClass().addClass('vetun'); lmposlid(0);};
if(set_position == 21){$('#body').removeClass().addClass('vdeu'); lmposlid(0);};
if(set_position == 22){$('#body').removeClass().addClass('fin'); lmposlid(0);};
}

if($('#page').hasClass('lois')) {
if(set_position == 0){$('#body').removeClass().addClass('ini'); $('#interior').removeClass().addClass('pepper'); $('#tabs').tabs('select', 6 );};
if(set_position == 1){$('#body').removeClass().addClass('mdeux'); $('#interior').removeClass().addClass('south'); $('#tabs').tabs('select', 7 );};
if(set_position == 2){$('#body').removeClass().addClass('mtrois'); $('#interior').removeClass().addClass('sunny'); $('#tabs').tabs('select', 8 );};
}

$pp_pic_holder.find('.pp_play').attr( 'title', 'Parcours AUTO');

if ((rv >0) && (rv <7)) {$('#pmap').attr('src','http://www.atoutfisc.com/reduction-impot/template1e/lib/i/navigation/france.gif');}

$pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[set_position]));
(settings.show_title && pp_titles[set_position] != "" && typeof pp_titles[set_position] != "undefined") ? $ppt.html(unescape(pp_titles[set_position])) : $ppt.html('&nbsp;');

movie_width = ( parseFloat(grab_param('width',pp_images[set_position])) ) ? grab_param('width',pp_images[set_position]) : settings.default_width.toString();
movie_height = ( parseFloat(grab_param('height',pp_images[set_position])) ) ? grab_param('height',pp_images[set_position]) : settings.default_height.toString();

if(movie_width.indexOf('%') != -1 || movie_height.indexOf('%') != -1){
movie_height = parseFloat(($(window).height() * parseFloat(movie_height) / 100) - 100);
movie_width = parseFloat(($(window).width() * parseFloat(movie_width) / 100) - 50);
percentBased = true;
}else{percentBased = false;}

$pp_pic_holder.fadeIn(function(){imgPreloader = ""; 
switch(_getFileType(pp_images[set_position])){

case 'image':
imgPreloader = new Image();
nextImage = new Image();
if(isSet && set_position > $(pp_images).size()) nextImage.src = pp_images[set_position + 1];
prevImage = new Image();
if(isSet && pp_images[set_position - 1]) prevImage.src = pp_images[set_position - 1];
$pp_pic_holder.find('#pp_full_res')[0].innerHTML = settings.image_markup;
$pp_pic_holder.find('#fullResImage').attr('src',pp_images[set_position]);
imgPreloader.onload = function(){correctSizes = _fitToViewport(imgPreloader.width,imgPreloader.height); 
_showContent();};
imgPreloader.onerror = function(){alert('Image cannot be loaded. Make sure the path is correct and image exist.'); 
$.prettyPhoto.close();};
imgPreloader.src = pp_images[set_position];
break;
case 'youtube':
correctSizes = _fitToViewport(movie_width,movie_height);
movie = 'http://www.youtube.com/v/'+grab_param('v',pp_images[set_position]);
if(settings.autoplay) movie += "&autoplay=1";
toInject = settings.flash_markup.replace(/{width}/g,correctSizes['width']).replace(/{height}/g,correctSizes['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);
break;
case 'vimeo':
correctSizes = _fitToViewport(movie_width,movie_height);
movie_id = pp_images[set_position];
var regExp = /http:\/\/(www\.)?vimeo.com\/(\d+)/;
var match = movie_id.match(regExp);
movie = 'http://player.vimeo.com/video/'+ match[2] +'?title=0&amp;byline=0&amp;portrait=0';
if(settings.autoplay) movie += "&autoplay=1;";
vimeo_width = correctSizes['width'] + '/embed/?moog_width='+ correctSizes['width'];
toInject = settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,correctSizes['height']).replace(/{path}/g,movie);
break;
case 'quicktime':
correctSizes = _fitToViewport(movie_width,movie_height);
correctSizes['height']+=15; correctSizes['contentHeight']+=15; correctSizes['containerHeight']+=15;
toInject = settings.quicktime_markup.replace(/{width}/g,correctSizes['width']).replace(/{height}/g,correctSizes['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);
break;
case 'flash':
correctSizes = _fitToViewport(movie_width,movie_height);
flash_vars = pp_images[set_position];
flash_vars = flash_vars.substring(pp_images[set_position].indexOf('flashvars') + 10,pp_images[set_position].length);
filename = pp_images[set_position];
filename = filename.substring(0,filename.indexOf('?'));
toInject =  settings.flash_markup.replace(/{width}/g,correctSizes['width']).replace(/{height}/g,correctSizes['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+'?'+flash_vars);
break;
case 'iframe':
correctSizes = _fitToViewport(movie_width,movie_height);
frame_url = pp_images[set_position];
frame_url = frame_url.substr(0,frame_url.indexOf('iframe')-1);
toInject = settings.iframe_markup.replace(/{width}/g,correctSizes['width']).replace(/{height}/g,correctSizes['height']).replace(/{path}/g,frame_url);
break;
case 'custom':
correctSizes = _fitToViewport(movie_width,movie_height);
toInject = settings.custom_markup;
break;
case 'inline':
myClone = $(pp_images[set_position]).clone().css({'width':settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline clearfix"></div></div>').appendTo($('body'));
correctSizes = _fitToViewport($(myClone).width(),$(myClone).height());
$(myClone).remove();
toInject = settings.inline_markup.replace(/{content}/g,$(pp_images[set_position]).html());
break;
};
if(!imgPreloader){$pp_pic_holder.find('#pp_full_res')[0].innerHTML = toInject;
_showContent();	};
});
return false;
};

$.prettyPhoto.changePage = function(direction){currentGalleryPage = 0;
if(direction == 'previous') {set_position--;
if (set_position < 0){set_position = 0;
return;
};
}else if(direction == 'next'){set_position++;
if(set_position > $(pp_images).size()-1) {set_position = 0;	}
}else{set_position=direction;
};

if(!doresize) doresize = true;
$('.pp_contract').removeClass('pp_contract').addClass('pp_expand');
_hideContent(function(){ $.prettyPhoto.open(); });
};

$.prettyPhoto.changeGalleryPage = function(direction){
if(direction=='next'){currentGalleryPage ++;
if(currentGalleryPage > totalPage){currentGalleryPage = 0;};
}else if(direction=='previous'){currentGalleryPage --;
if(currentGalleryPage < 0){currentGalleryPage = totalPage;};
}else{currentGalleryPage = direction;};
};

$.prettyPhoto.startSlideshow = function(){if(typeof pp_slideshow == 'undefined'){
$pp_pic_holder.find('.pp_play').unbind('click').removeClass('pp_play').addClass('pp_pause').click(function(){
$.prettyPhoto.stopSlideshow();
return false;
});
pp_slideshow = setInterval($.prettyPhoto.startSlideshow,settings.slideshow);

$pp_pic_holder.find('.pp_pause').attr('title', 'Parcours Manuel');
}else{$.prettyPhoto.changePage('next');	};
}

$.prettyPhoto.stopSlideshow = function(){$pp_pic_holder.find('.pp_pause').unbind('click').removeClass('pp_pause').addClass('pp_play').click(function(){
$.prettyPhoto.startSlideshow();
return false;
});
clearInterval(pp_slideshow);
pp_slideshow=undefined;
}

$.prettyPhoto.close = function(){clearInterval(pp_slideshow);
$pp_pic_holder.stop().find('object,embed').css('visibility','hidden');
$('div.pp_pic_holder,div.ppt,.pp_fade').fadeOut(settings.animation_speed,function(){ $(this).remove(); });
$pp_overlay.fadeOut(settings.animation_speed, function(){
if($.browser.msie && $.browser.version == 5) $('select').css('visibility','visible');
if(settings.hideflash) $('object,embed').css('visibility','visible');
$(this).remove();
$(window).unbind('scroll');
settings.callback();
doresize = true;
pp_open = false;
delete settings;
});
};
	
_showContent = function(){$('.pp_loaderIcon').hide();
$ppt.fadeTo(settings.animation_speed,1);
projectedTop = scroll_pos['scrollTop'] + ((windowHeight/2) - (correctSizes['containerHeight']/2));
if(projectedTop < 0) projectedTop = 0;
$pp_pic_holder.find('.pp_content').animate({'height':correctSizes['contentHeight']},settings.animation_speed);
$pp_pic_holder.animate({
'top': projectedTop,
'left': (windowWidth/2) - (correctSizes['containerWidth']/2),
'width': correctSizes['containerWidth']
},settings.animation_speed,function(){
$pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(correctSizes['height']).width(correctSizes['width']);
$pp_pic_holder.find('.pp_fade').fadeIn(settings.animation_speed);
if(isSet && _getFileType(pp_images[set_position])=="image") { $pp_pic_holder.find('.pp_hoverContainer').show(); }else{ $pp_pic_holder.find('.pp_hoverContainer').hide(); }
if(correctSizes['resized']) $('a.pp_expand,a.pp_contract').fadeIn(settings.animation_speed);
if(settings.autoplay_slideshow && !pp_slideshow && !pp_open) $.prettyPhoto.startSlideshow();
settings.changepicturecallback();
pp_open = true;
});
};
		
function _hideContent(callback){$pp_pic_holder.find('#pp_full_res object,#pp_full_res embed').css('visibility','hidden');
$pp_pic_holder.find('.pp_fade').fadeOut(settings.animation_speed,function(){
$('.pp_loaderIcon').show();
callback();
});
};
	
function _checkPosition(setCount){
if(set_position == setCount-1) {$pp_pic_holder.find('a.pp_next').css('visibility','hidden');
$pp_pic_holder.find('.pp_nav a.pp_arrow_next').addClass('disabled').unbind('click');
$pp_pic_holder.find('.pp_nav a.pp_arrow_next').unbind('mouseover');
$('a.pp_arrow_next').removeAttr("title");
}else{ 
$pp_pic_holder.find('a.pp_next').css('visibility','visible');
$pp_pic_holder.find('.pp_nav a.pp_arrow_next').bind('mouseover',function(){
	$pp_pic_holder.find('.pp_infos').show().html(unescape(pp_descriptions[parseInt(set_position)+parseInt(1)])) });
$pp_pic_holder.find('.pp_nav a.pp_arrow_next').bind('mouseout',function(){
	$pp_pic_holder.find('.pp_infos').hide() });	
$('a.pp_arrow_next').attr('title','Programme suivant');
$pp_pic_holder.find('.pp_nav a.pp_arrow_next.disabled').removeClass('disabled').bind('click',function(){
$.prettyPhoto.changePage('next');
$("#selectpgm option:eq(0)").attr("selected", "selected");
$('#selectpgm').selectmenu("value", 0);
return false;
});
};
if(set_position == 0) {$pp_pic_holder.find('a.pp_previous').css('visibility','hidden');
$pp_pic_holder.find('.pp_nav a.pp_arrow_previous').addClass('disabled').unbind('click');
$pp_pic_holder.find('.pp_nav a.pp_arrow_previous').unbind('mouseover');
$('a.pp_arrow_previous').removeAttr("title");
}else{$pp_pic_holder.find('a.pp_previous').css('visibility','visible');
$pp_pic_holder.find('.pp_nav a.pp_arrow_previous').bind('mouseover',function(){
	$pp_pic_holder.find('.pp_infos').show().html(unescape(pp_descriptions[set_position-1])) });
$pp_pic_holder.find('.pp_nav a.pp_arrow_previous').bind('mouseout',function(){
	$pp_pic_holder.find('.pp_infos').hide() });	
$('a.pp_arrow_previous').attr('title','Programme précédent');
$pp_pic_holder.find('.pp_nav a.pp_arrow_previous.disabled').removeClass('disabled').bind('click',function(){
$.prettyPhoto.changePage('previous');
$("#selectpgm option:eq(0)").attr("selected", "selected");
$('#selectpgm').selectmenu("value", 0);
return false;
});
};
(setCount > 1) ? $('.pp_nav').show() : $('.pp_nav').hide();
};
	
function _fitToViewport(width,height){resized = false;
_getDimensions(width,height);
imageWidth = width, imageHeight = height;
if( ((pp_containerWidth > windowWidth) || (pp_containerHeight > windowHeight)) && doresize && settings.allow_resize && !percentBased) {
resized = true, fitting = false;
while (!fitting){
if((pp_containerWidth > windowWidth)){imageWidth = (windowWidth - 200);
imageHeight = (height/width) * imageWidth;
}else if((pp_containerHeight > windowHeight)){imageHeight = (windowHeight - 200);
imageWidth = (width/height) * imageHeight;
}else{fitting = true; };
pp_containerHeight = imageHeight, pp_containerWidth = imageWidth;
};
_getDimensions(imageWidth,imageHeight);
};
return {
width:Math.floor(imageWidth),
height:Math.floor(imageHeight),
containerHeight:Math.floor(pp_containerHeight),
containerWidth:Math.floor(pp_containerWidth) + 40,
contentHeight:Math.floor(pp_contentHeight),
contentWidth:Math.floor(pp_contentWidth),
resized:resized
}; };
		
function _getDimensions(width,height){width = parseFloat(width);
height = parseFloat(height);
$pp_details = $pp_pic_holder.find('.pp_details');
$pp_details.width(width);
detailsHeight = parseFloat($pp_details.css('marginTop')) + parseFloat($pp_details.css('marginBottom'));
$pp_details = $pp_details.clone().appendTo($('body')).css({
	'position':'absolute',
	'top':-10000
});
detailsHeight += $pp_details.height();
detailsHeight = (detailsHeight <= 34) ? 36 : detailsHeight;
if($.browser.msie && $.browser.version==7) detailsHeight+=8;
$pp_details.remove();
pp_contentHeight = height + detailsHeight;
pp_contentWidth = width;
pp_containerHeight = pp_contentHeight + $ppt.height() + $pp_pic_holder.find('.pp_top').height() + $pp_pic_holder.find('.pp_bottom').height();
pp_containerWidth = width;
		}

function _getFileType(itemSrc){
if (itemSrc.match(/youtube\.com\/watch/i)) {
	return 'youtube';
}else if (itemSrc.match(/vimeo\.com/i)) {
	return 'vimeo';
}else if(itemSrc.indexOf('.mov') != -1){ 
	return 'quicktime';
}else if(itemSrc.indexOf('.swf') != -1){
	return 'flash';
}else if(itemSrc.indexOf('iframe') != -1){
	return 'iframe';
}else if(itemSrc.indexOf('custom') != -1){
	return 'custom';
}else if(itemSrc.substr(0,1) == '#'){
	return 'inline';
}else{
	return 'image';
};
};
	
function _center_overlay(){if(doresize && typeof $pp_pic_holder != 'undefined') {
scroll_pos = _get_scroll();
titleHeight = $ppt.height(), contentHeight = $pp_pic_holder.height(), contentwidth = $pp_pic_holder.width();
projectedTop = (windowHeight/2) + scroll_pos['scrollTop'] - (contentHeight/2);
$pp_pic_holder.css({
'top': projectedTop,
'left': (windowWidth/2) + scroll_pos['scrollLeft'] - (contentwidth/2)
}); };
};
	
function _get_scroll(){if (self.pageYOffset) {
return {scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset};
} else if (document.documentElement && document.documentElement.scrollTop) {
return {scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft};
} else if (document.body) {
return {scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft};
};	};
	
function _resize_overlay() {windowHeight = $(window).height(), windowWidth = $(window).width();
if(typeof $pp_overlay != "undefined") $pp_overlay.height($(document).height());
};

var addressFormatting = function(text){var newText = text;
var findreps = [
{find:/(\[[^\|><]+\])$/g, rep: '<span>$1</span>'}
];
for(var i in findreps){
newText = newText.replace(findreps[i].find, findreps[i].rep);
}
return newText;
}
	
function buildOverlay(){$('body').append(settings.markup);
$pp_pic_holder = $('.pp_pic_holder') , $ppt = $('.ppt'), $pp_overlay = $('div.pp_overlay');
if(settings.overlay_gallery) {currentGalleryPage = 0;
toInject = "<option>CHOISIR autre "+ settings.fiscal +"</option>";
for (var i=0; i < pp_images.length; i++) {
toInject += "<option value='"+ [i] +"' class='ic"+ [i] +"'>"+ pp_descriptions[i] +"</option>";
};
toInject = settings.gallery_markup.replace(/{gallery}/g,toInject);
$pp_pic_holder.find('#pp_full_res').after(toInject);

var addressFormatting = function(text){
var newText = text;
var findreps = [
{find:/(\[[^\|><]+\])$/g, rep: '<span class="bebece">$1</span>'}
];
for(var i in findreps){
newText = newText.replace(findreps[i].find, findreps[i].rep);
}
return newText;
}

custom = function(){if(typeof settings !="undefined"){ $('#selectpgm').selectmenu({style:'popup', 
positionOptions: {my: "left bottom", at: "left bottom",	offset: "0 25"},
icons: [
{find: '.ic0', icon: 'selec-icon-script'},
{find: '.ic1', icon: 'selec-icon-image'},
{find: '.ic2', icon: 'selec-icon-contact'},
{find: '.ic3', icon: 'selec-icon-extlink'},
{find: '.ic4', icon: 'selec-icon-newwin'},
{find: '.ic5', icon: 'selec-icon-refresh'},
{find: '.ic6', icon: 'selec-icon-document'},
{find: '.ic7', icon: 'selec-icon-suitcase'},
{find: '.ic8', icon: 'selec-icon-comment'},
{find: '.ic9', icon: 'selec-icon-person'},
{find: '.ic10', icon: 'selec-icon-print'},
{find: '.ic11', icon: 'selec-icon-trash'},
{find: '.ic12', icon: 'selec-icon-calendar'},
{find: '.ic13', icon: 'selec-icon-cart'},
{find: '.ic14', icon: 'selec-icon-pencil'},
{find: '.ic15', icon: 'selec-icon-zoomin'},
{find: '.ic16', icon: 'selec-icon-zoomout'},
{find: '.ic17', icon: 'selec-icon-search'},
{find: '.ic18', icon: 'selec-icon-wrench'},
{find: '.ic19', icon: 'selec-icon-link'},
{find: '.ic20', icon: 'selec-icon-cancel'},
{find: '.ic21', icon: 'selec-icon-plus'},
{find: '.ic22', icon: 'selec-icon-minus'},
{find: '.ic23', icon: 'selec-icon-minusthick'},
{find: '.ic24', icon: 'selec-icon-key'},
{find: '.ic25', icon: 'selec-icon-lightbulb'},
{find: '.ic26', icon: 'selec-icon-clipboard'},
{find: '.ic27', icon: 'selec-icon-copy'},
{find: '.ic28', icon: 'selec-icon-help'},
{find: '.ic29', icon: 'selec-icon-check'},
{find: '.ic30', icon: 'selec-icon-signal'},
{find: '.fermer', icon: 'selec-icon-neutre'}
],
format: addressFormatting
});

if(settings.fiscal == 'programme Scellier') {$("#selstyl").attr({href: 'http://www.atoutfisc.com/reduction-impot/template1e/theme/select/eggplant.css'});
 };
if(settings.fiscal == 'programme Bouvard') {$('.selec-selectmenu-menu li').addClass('pbouvard');
$("#selstyl").attr({href: 'http://www.atoutfisc.com/reduction-impot/template1e/theme/select/sunny.css'});
 };
if(settings.fiscal == 'dispositif fiscal') {$('.selec-selectmenu-menu li').addClass('pfiscal');
$("#selstyl").attr({href: 'http://www.atoutfisc.com/reduction-impot/template1e/theme/select/hot-sneaks.css'});
 };
if(settings.fiscal == 'programme BBC') {$('.selec-selectmenu-menu li').addClass('pbbc');
$("#selstyl").attr({href: 'http://www.atoutfisc.com/reduction-impot/template1e/theme/select/le-frog.css'});
 };
}}

if ((rv >0) && (rv <7)) {setTimeout('custom()', 5000);}
else {$('#selectpgm').selectmenu({style:'popup', 
positionOptions: {my: "left bottom", at: "left bottom", offset: "0 25"},
icons: [
{find: '.ic0', icon: 'selec-icon-script'},
{find: '.ic1', icon: 'selec-icon-image'},
{find: '.ic2', icon: 'selec-icon-contact'},
{find: '.ic3', icon: 'selec-icon-extlink'},
{find: '.ic4', icon: 'selec-icon-newwin'},
{find: '.ic5', icon: 'selec-icon-refresh'},
{find: '.ic6', icon: 'selec-icon-document'},
{find: '.ic7', icon: 'selec-icon-suitcase'},
{find: '.ic8', icon: 'selec-icon-comment'},
{find: '.ic9', icon: 'selec-icon-person'},
{find: '.ic10', icon: 'selec-icon-print'},
{find: '.ic11', icon: 'selec-icon-trash'},
{find: '.ic12', icon: 'selec-icon-calendar'},
{find: '.ic13', icon: 'selec-icon-cart'},
{find: '.ic14', icon: 'selec-icon-pencil'},
{find: '.ic15', icon: 'selec-icon-zoomin'},
{find: '.ic16', icon: 'selec-icon-zoomout'},
{find: '.ic17', icon: 'selec-icon-search'},
{find: '.ic18', icon: 'selec-icon-wrench'},
{find: '.ic19', icon: 'selec-icon-link'},
{find: '.ic20', icon: 'selec-icon-cancel'},
{find: '.ic21', icon: 'selec-icon-plus'},
{find: '.ic22', icon: 'selec-icon-minus'},
{find: '.ic23', icon: 'selec-icon-minusthick'},
{find: '.ic24', icon: 'selec-icon-key'},
{find: '.ic25', icon: 'selec-icon-lightbulb'},
{find: '.ic26', icon: 'selec-icon-clipboard'},
{find: '.ic27', icon: 'selec-icon-copy'},
{find: '.ic28', icon: 'selec-icon-help'},
{find: '.ic29', icon: 'selec-icon-check'},
{find: '.ic30', icon: 'selec-icon-signal'},
{find: '.fermer', icon: 'selec-icon-neutre'}
],
format: addressFormatting
});
}

$('#selectpgm').change(function(){if(verif_numeric($(this).val()))	{				
$.prettyPhoto.changePage($(this).val())	; cpterendu(pp_descriptions[set_position]); }
if ($("#selectpgm option:last").attr("selected") == true) {$.prettyPhoto.close();}
	return false;});
$(this).find('a').unbind('click').click(function(){$.prettyPhoto.changePage(i);
$.prettyPhoto.stopSlideshow();
return false;
});	};

if(settings.slideshow){$pp_pic_holder.find('.pp_nav').prepend('<a href="#" class="pp_play">Play</a>')
$pp_pic_holder.find('.pp_nav .pp_play').click(function(){
$.prettyPhoto.startSlideshow();
return false;
});
}

$pp_pic_holder.attr('class','pp_pic_holder ' + settings.theme);
$pp_overlay
.css({
'opacity':0,
'height':$(document).height(),
'width':$(document).width()
})
.bind('click',function(){
if(!settings.modal) $.prettyPhoto.close();
});

$('a.pp_close').bind('click',function(){ $.prettyPhoto.close(); return false; });
$('#pgmaprog').bind('click',function(){ settings.callback = function(){centerPopup(); loadPopup()}; $.prettyPhoto.close(); return false; });

$('a.pp_expand').bind('click',function(e){if($(this).hasClass('pp_expand')){
$(this).removeClass('pp_expand').addClass('pp_contract');
doresize = false;
}else{$(this).removeClass('pp_contract').addClass('pp_expand');
doresize = true;
};

_hideContent(function(){ $.prettyPhoto.open(); });
return false;
});

$pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click',function(){$.prettyPhoto.changePage('previous');
$("#selectpgm option:eq(0)").attr("selected", "selected");
$('#selectpgm').selectmenu("value", -1);
cpterendu(pp_descriptions[set_position]);
$.prettyPhoto.stopSlideshow();
return false;
});
		
$pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click',function(){$.prettyPhoto.changePage('next');
$("#selectpgm option:eq(0)").attr("selected", "selected");
$('#selectpgm').selectmenu("value", -1);
cpterendu(pp_descriptions[set_position]);
$.prettyPhoto.stopSlideshow();
return false;
});
_center_overlay();
};
return this.unbind('click').click($.prettyPhoto.initialize);
};
	
	function grab_param(name,url){
	  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	  var regexS = "[\\?&]"+name+"=([^&#]*)";
	  var regex = new RegExp( regexS );
	  var results = regex.exec( url );
	  return ( results == null ) ? "" : results[1];
	}
	
})(jQuery);

/* VERSION SIMPLE
if (!(page==11)){local = "programme_immobilier/"}
else {local = "http://www.atoutfisc.com/programme_immobilier/"};
*/

pprog = oURL.substring(oURL.lastIndexOf('.com'));
dprog = pprog.substring(5,16); //  alert(pprog);alert(dprog);alert(page);  // immobilier_
if (!(page==11)){if (dprog=='immobilier_') {local = "../programme_immobilier/"} else{local = "programme_immobilier/"} }
else {local = "http://www.atoutfisc.com/programme_immobilier/"};

function voirpgm(unit){
$("#selstyl").attr({href: 'http://www.atoutfisc.com/reduction-impot/template1e/theme/select/sunny.css'});
	$("a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook', fiscal: 'programme Bouvard'});
var larg; var haut;
var chlmp = local+'lmnp-bouvard/';
var chaff = local+'lmnp-affaires/';
var tpa = 'Gamme LMNP BOUVARD (Tourisme et Affaires)';
var tpt = 'Gamme LMNP BOUVARD (Tourisme et Loisirs)';
var tps = 'Gamme LMNP BOUVARD (Tourisme et Santé)';
var tpm = 'Gamme LMNP BOUVARD (Tourisme et Mer)';
var tpg = 'Gamme LMNP BOUVARD (Tourisme et Montagne)';
var tpw = 'Gamme LMNP Amortissement (Tourisme et Montagne)';
if ($(window).width() < 1025){larg ='100%'; haut='98%'} else {larg ='90%'; haut='90%'};
overcol = '#754600'; // #000044
set_position = unit;	
	images = [chlmp+'biarritz/bouvard_biarritz_patios-eugenie.htm?iframe=true&width='+larg+'&height='+haut,chlmp+'eco_le-ruitor/le-ruitor_sainte-foy.htm?iframe=true&width='+larg+'&height='+haut,chlmp+'sainte-foy-tarentaise/la-chapelle.htm?iframe=true&width='+larg+'&height='+haut,chlmp+'sophia-antipolis/campus-sophia.htm?iframe=true&width='+larg+'&height='+haut,chlmp+'vars/hameau-des-rennes.htm?iframe=true&width='+larg+'&height='+haut,chlmp+'val-thorens/montana_plein-sud.htm?iframe=true&width='+larg+'&height='+haut,chlmp+'morillon/palladior_morillon.htm?iframe=true&width='+larg+'&height='+haut,chlmp+'hauteluce/chalets-celine.htm?iframe=true&width='+larg+'&height='+haut,chlmp+'isola/isola-2000.htm?iframe=true&width='+larg+'&height='+haut,chlmp+'chatel/le-grand-lodge_chatel.htm?iframe=true&width='+larg+'&height='+haut,chlmp+'vars/hameau-des-rennes.htm?iframe=true&width='+larg+'&height='+haut,chlmp+'briancon/aigle-bleu_serre-chevalier.htm?iframe=true&width='+larg+'&height='+haut,chlmp+'contrexeville/la-source.htm?iframe=true&width='+larg+'&height='+haut,chaff+'ferney-voltaire/la-suisse.htm?iframe=true&width='+larg+'&height='+haut,chlmp+'corse-borgo/aqua-bella.htm?iframe=true&width='+larg+'&height='+haut,chlmp+'biscarosse/biscarrosse-ocean.htm?iframe=true&width='+larg+'&height='+haut,chlmp+'lac-biscarosse/hameau-aouchet.htm?iframe=true&width='+larg+'&height='+haut,chlmp+'gordes/domaine-enclos_luberon.htm?iframe=true&width='+larg+'&height='+haut,chlmp+'aigues-mortes/mas-des-flamants.htm?iframe=true&width='+larg+'&height='+haut,chlmp+'malaucene/les-mazets-du-ventoux_malaucene.htm?iframe=true&width='+larg+'&height='+haut,chlmp+'pezenas/les-templiers.htm?iframe=true&width='+larg+'&height='+haut,chlmp+'saint-saturnin-les-apt/le-clos-savornin.htm?iframe=true&width='+larg+'&height='+haut,chlmp+'cavalaire-sur-mer/eilen_villas.htm?iframe=true&width='+larg+'&height='+haut];
	titles = [tpm,tpg,tpg,tpa,tpg,tpg,tpg,tpg,tpg,tpg,tpw,tpg,tps,tpa,tpm,tpm,tpm,tpt,tpt,tpt,tpt,tpt,tpm];
	descriptions = ['Biarritz / Les Patios Eugénie','Ste-foy Tarentaise / Eco Le Ruitor 4*','Ste-foy Tarentaise / La Chapelle 4*','Sophia Antipolis / Le Campus','Vars / Le Hameau des Rennes 4*','Val-Thorens / Le Montana Plein-sud 4*','Morillon Haute-Savoie / Le Lac bleu','Hauteluce, Mt Blanc / Chalets Céline','Isola 2000 / Les Terrasses 4*','Châtel / Les Portes du Soleil','Vars / Le Hameau des Rennes 4*','Briançon Serre-Chevalier / Aigle bleu','Contrexeville / Résidence La Source','Ferney Voltaire Genève / La Suisse','Corse, Borgo / maisons Aqua-Bella','Biscarosse océan/ Les Balcons','Lac de Biscarosse / hameau Aouchet','Gordes, Lubéron / Le Domaine Enclos','Aigues-Mortes / les Flamants','Malaucène, Lubéron / Mazets Ventoux','Pézenas, méditerranée / Les Templiers','St-Saturnin-lès-Apt, Lubéron / Savornin','Cavalaire sur mer / Villas Eilen'];
	$.prettyPhoto.open(images,titles,descriptions);
	cpterendu(pp_descriptions[set_position]);
	if ($('#busy').opts !== false) {$('#busy').activity(false); $('.busywait').css('display','none');}
	}

function voirscel(unit){
$("#selstyl").attr({href: 'http://www.atoutfisc.com/reduction-impot/template1e/theme/select/eggplant.css'});
	$("a[rel^='prettyPhoto']").prettyPhoto({theme:'dark_rounded', fiscal: 'programme Scellier'});
var larg; var haut;
var chscel = local+'scellier/';
var tcf = 'Gamme SCELLIER';
if ($(window).width() < 1025){larg ='100%'; haut='98%'} else {larg ='90%'; haut='90%'}
overcol = '#808080';
set_position = unit;	
	images = [chscel+'cavaillon/pradon.htm?iframe=true&width='+larg+'&height='+haut,chscel+'thonon-les-bains/les-aubades.htm?iframe=true&width='+larg+'&height='+haut,chscel+'thouare-sur-loire/residence-alinea.htm?iframe=true&width='+larg+'&height='+haut,chscel+'marseille_maristella/les-hauts-de-maristella.htm?iframe=true&width='+larg+'&height='+haut,chscel+'sorgues-avignon/jardins-traille.htm?iframe=true&width='+larg+'&height='+haut,chscel+'frejus_st-raphael/residence-charley.htm?iframe=true&width='+larg+'&height='+haut,chscel+'narbonne_fleury-d-aude/les-mas-de-la-mer.htm?iframe=true&width='+larg+'&height='+haut,chscel+'etrembieres/BBC_scellier-mont-saleve.htm?iframe=true&width='+larg+'&height='+haut];
	titles = [tcf,tcf,'Gamme SCELLIER BBC',tcf,tcf,tcf,tcf,'Gamme SCELLIER BBC'];
	descriptions = ["Cavaillon - VAUCLUSE","Thonon-les-bains (Hte-Savoie)","Thouaré-sur-Loire (44)&nbsp; [ BBC ]","Marseille Hauts de Ste-Marthe","Sorgues - Avignon (84)","Fréjus/St Raphaël (83)","Narbonne/Fleury d'Aude (11)","Etrembières, Hte-Savoie [ BBC ]"];
	$.prettyPhoto.open(images,titles,descriptions);
	cpterendu(pp_descriptions[set_position]);
	if ($('#busy').opts !== false) {$('#busy').activity(false); $('.busywait').css('display','none');}
	}

function voirloi(posit){
$("#selstyl").attr({href: 'http://www.atoutfisc.com/reduction-impot/template1e/theme/select/hot-sneaks.css'});
	$("a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook', fiscal: 'dispositif fiscal'});
var larg; var haut;
var infoloi = 'Informations - Dispositifs fiscaux';
var infoPgmScellier = '52 Programmes Scellier actables 2011';
var chloi = local+'BBC-SCELLIER_batiment-basse-consommation/';
var chloib = local+'informations-investissement/';
var chinfo;
if ($(window).width() < 1025){larg ='100%'; haut='98%'} else {larg ='90%'; haut='90%'};
overcol = '#993366';
set_position = posit;	
	images = [chloib+'niche-fiscale_Scellier_BBC.htm?iframe=true&width='+larg+'&height='+haut,chloib+'loi-bouvard_BBC.htm?iframe=true&width='+larg+'&height='+haut,chloi+'label-bbc.htm?iframe=true&width='+larg+'&height='+haut,local+'scellier/2011/scellier.htm?iframe=true&width='+larg+'&height='+haut];
	titles = [infoloi,infoloi,infoloi,infoPgmScellier];
	descriptions = ['La niche fiscale BBC en loi Scellier','Défiscalisation Loueur meublé Bouvard','Label BBC construction et critère fiscal','Tous programmes Scellier / BBC 2011'];
	$.prettyPhoto.open(images,titles,descriptions);
	cpterendu(pp_descriptions[set_position]);
	if ($('#busy').opts !== false) {$('#busy').activity(false); $('.busywait').css('display','none');}
	}

function voirbbc(unit){
$("#selstyl").attr({href: 'http://www.atoutfisc.com/reduction-impot/template1e/theme/select/le-frog.css'});
	$("a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook', fiscal: 'programme BBC'});
var larg; var haut;
var vert = 'Gamme SCELLIER BBC';
var BBCPgm = '52 Programmes Scellier actables 2011';
var loivert = 'Information dispositif BBC';
var chbbc = local+'scellier/';
if ($(window).width() < 1025){larg ='100%'; haut='98%'} else {larg ='90%'; haut='90%'};
overcol = '#336600';
set_position = unit;	
	images = [chbbc+'thouare-sur-loire/residence-alinea.htm?iframe=true&width='+larg+'&height='+haut,chbbc+'etrembieres/BBC_scellier-mont-saleve.htm?iframe=true&width='+larg+'&height='+haut,'programme_immobilier/BBC-SCELLIER_batiment-basse-consommation/label-bbc.htm?iframe=true&width='+larg+'&height='+haut,chbbc+'2011/scellier.htm?iframe=true&width='+larg+'&height='+haut];
	titles = [vert,vert,loivert,BBCPgm];
	descriptions = ['Thouaré-sur-Loire (44)','Etrembières / Annemasse (74)','Label BBC construction et critère fiscal','Tous programmes Scellier / BBC 2011'];
	$.prettyPhoto.open(images,titles,descriptions);
	cpterendu(pp_descriptions[set_position]);
	if ($('#busy').opts !== false) {$('#busy').activity(false); $('.busywait').css('display','none');}
	}


