/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

var photothequePanel;
var isPhotothequeVisible = true;
var Tips;


var box = {};
var menu = {};

var map = new Array(7);

map['creation']		= new Array(1014,600,1022,527,1056,428,1088,353,1130,401,1130,436,1183,445,1186,392,1216,378,1240,415,1243,447,1304,473,1318,
								447,1345,470,1349,512,1327,561,1249,628,1152,646,1052,622,1014,600);
map['piscine']		= new Array(721,346,798,302,842,328,940,273,1056,345,951,451,809,404,721,346);
map['maconnerie']	= new Array(856,835,791,782,785,735,907,639,970,628,1095,721,889,853,856,835);
map['entretien']	= new Array(621,790,674,741,727,743,795,798,860,862,807,912,621,790);
map['bureau']		= new Array(514,508,509,412,414,356,450,332,577,407,580,472,514,508);
map['pro']			= new Array(389,672,597,555,606,469,726,403,848,475,854,577,918,610,715,737,679,738,597,795,389,672);
map['presentation']	= new Array(207,550,207,456,400,349,508,412,512,508,320,619,207,550);

function resizeMap()
{		
	$$('.over').each( function(el) { 
		el.setPosition( $('base_img').getPosition() );
	});
	$$('#mainMap area').each(resizeCoords);
}

function resizeCoords(area)
{
	var name	= area.id.slice(4);
	var coords	= area.getAttribute('coords');
	coords		= coords.split(',');
	
	for (var j=0; j<coords.length; j++)
	{
		coords[j] = parseInt(map[name][j].valueOf() * parseInt(document.getElementById("base_img").width) / 1600);
	}
	
	coords = coords.join(",");
	area.setAttribute('coords', coords);
}

function showOver(inImage)
{ $('over_'+inImage).style.display = 'block'; }

function hideOver(inImage)
{ $('over_'+inImage).style.display = 'none'; }

window.addEvent('domready', function()
{  
	SqueezeBox.initialize();
	
    /**
     * Assign SqueezeBox to all links with rel="boxed" attribute, the class then reads the "href".
     */
    SqueezeBox.assign($$('a[rel=squeezebox]'));
	
    menu = new MenuMatic({ id:"mainMenu",
                            direction:{y:"up"},
                            opacity:92});
    /*
    milkbox.addEvent('xmlGalleries',function(){
	$('testButton').addEvent('click', function(e){
		e.preventDefault();
		milkbox.showGallery({ gallery:'xmlG2' });
	});
	});

	milkbox.addGalleries('galleries.xml');
    */
    Tips = new Tips($$('.map'),{ className: 'tool'} );
    /* Phototheque not implemented yet doesn't work
    photothequePanel = new Fx.Slide('photothequePanel');
    
    $('photothequeButton').addEvent('click', function(event){
    event.stop();
    photothequePanel.slideIn();
	});
	*/
	$$('#mainMap area').each(resizeCoords);
	resizeMap();
});

window.addEvent('resize', resizeMap); 



