// VARIABLES

var myWidth=		0;		var myHeight=		0;		var base_espace=	20;		var base_logo=		60;
var normal_width=	1910;	var base_height=	888;	var base_img=		30;		var val_img=		0;
var stackspeed=		300;	var base_right=		135;	var base_stack=		55;		var val_stack=		base_stack;
var base_h1=		18;		var base_h2=		17;		var base_h4=		16;		var base_txt=		14;

function get_param()
{
	if( typeof( window.innerWidth ) == 'number' ) {myWidth = window.innerWidth;myHeight = window.innerHeight;
	} else if( document.documentElement &&
	( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {myWidth = document.documentElement.clientWidth;myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {myWidth = document.body.clientWidth;myHeight = document.body.clientHeight;}
}

function hide_marq(){$("#marq").hide("slow");}

function make_stack()
{	
	var vertical=0;var horizontal=1;var $el=$('.stack>img');
	$el.next().children().each(function(){$(this).animate({top: '-' + vertical + 'px', left: horizontal + 'px'}, stackspeed);vertical = vertical + val_stack;/*horizontal = (horizontal-.75)*1.75;;*/});
	$el.next().animate({top: '-35px', left: '10px'}, stackspeed).addClass('openStack').find('li a>img').animate({height: val_img+'px', marginLeft: '9px'}, stackspeed);$el.animate({paddingTop: '0'});
}

function show_diapo(){$("#diaporama_wait").hide("slow");$("#diaporama").show("slow");fullwin();}

function addText(instext)
{
    var mess = document.formulaire.message;
        //IE support
        if (document.selection) {mess.focus();sel = document.selection.createRange();sel.text = instext;document.guestbook.focus();}
        //MOZILLA/NETSCAPE support
        else if (mess.selectionStart || mess.selectionStart == "0") {
            var startPos = mess.selectionStart;	var endPos = mess.selectionEnd;	var chaine = mess.value;
			mess.value = chaine.substring(0, startPos) + instext + chaine.substring(endPos, chaine.length);
			mess.selectionStart = startPos + instext.length;mess.selectionEnd = endPos + instext.length;mess.focus();
        } else {mess.value += instext; mess.focus();}
}

function create_flash(src,width,height,wmode,oop,loop,allowfullscreen,allowscriptaccess,img)
{
	document.write("<object width='"+width+"' height='"+height+"'><param name='movie' value='"+src+"'/><param name='wmode' value='"+wmode+"'/><param name='oop' value='"+oop+"'/><param name='loop' value='"+loop+"'/>");
	document.write("<param name='allowFullScreen' value='"+allowfullscreen+"'/><param name='allowscriptaccess' value='"+allowscriptaccess+"'/>");
	document.write("<embed src='"+src+"' type='application/x-shockwave-flash' width='"+width+"'	height='"+height+"'	oop='"+oop+"' wmode='"+wmode+"' loop='"+loop+"'	allowscriptaccess='"+allowscriptaccess+"'	");
	document.write("allowfullscreen='"+allowfullscreen+"'></embed></object>	");return false;
}

function change_h_col(first){$(chback).each(function(){this.style.background=($(((first)?"#firstliimg span":"li.active span")).html())});}

function plus(){$("h4 a[title]").tooltip({ effect: 'slide'});}

function fullwin()
{	$(document).ready(function()
	{get_param();
		var ft=Math.floor(myWidth*(base_txt-2)/normal_width);$("#menu *").css('fontSize',ft*.9);$("#resa_block *").css('fontSize',ft);
		$("#droite #resa p,#gauche #retour p,.reserver").css('fontSize',Math.floor(myWidth*base_h2/normal_width));
		$('#diaporama li img').each(function(){$(this).css("width",myWidth + 'px');});
		var nh=Math.floor((myHeight-(myWidth*900/1920))/2);
		$('#diaporama li').css("top",( nh + 'px'));
		val_img=Math.floor(base_img*(myHeight/base_height));
		val_stack=Math.floor(base_stack*(myHeight/base_height));make_stack();
		if(!controlbutn){
			var espace=(Math.floor((base_espace*myHeight)/base_height)); espace=(espace<=0)?0:espace;
			$("#entete h1").css('fontSize',Math.floor(myWidth*base_h1/normal_width)); $("#entete h2").css('fontSize',Math.floor(myWidth*base_h2/normal_width));
			$("#droite #centre #marq *").css('fontSize',Math.floor(myWidth*base_txt/normal_width)); $("#droite #centre #marq h4").css('fontSize',Math.floor(myWidth*base_h4/normal_width));
			$("#droite #centre .contact div a span").css('fontSize',Math.floor(myWidth*(base_txt-2)/normal_width));
			$('.espace').each(function(){$(this).animate({height: espace + 'px'}, speed);});
		}else {$("#centre, .stack").hide("slow");$("#gauche").show("slow");}
	})
}

window.orientationchange=fullwin();
