var img = null;

var flag = false;

var current_region = {
	'france' : null,
	'paris' : null
};

function get(id){
	return document.getElementById(id);
}

function prechargimg() {
	var doc=document;
	if(doc.images){
		if(!doc.precharg) doc.precharg=new Array();
		var i,j=doc.precharg.length,x=prechargimg.arguments;
		for(i=0; i<x.length; i++)
			if (x[i].indexOf("#")!=0){
				doc.precharg[j]=new Image;
				doc.precharg[j++].src=x[i];
			}
	}
}

function display_hotels(type, id){
	for(i = 0 ; i < region[type].length ; i++){
		get(region[type][i]).style.visibility="hidden";
	}
	
	get(type+'_title').innerHTML = region_name[type][id];
	
	get(id).style.visibility="visible";
	get('france_title').style.visibility="visible";
}

function reset_map(map){
	if(flag == true) return;
	get(map).src='images/cartes/'+map+'/'+map+'.png';

	current_region[map] = null;
}

function select_map(map,region){
	if(map == 'france' && region == 'martinique') {
		return;
	}
	
	flag = true;
	get(map).src='images/cartes/'+map+'/'+region+'.png';

	current_region = region;
}

function prechargimg() {
	var doc=document;
	if(doc.images){
		if(!doc.precharg) doc.precharg=new Array();
		var i,j=doc.precharg.length,x=prechargimg.arguments;
		for(i=0; i<x.length; i++)
			if (x[i].indexOf("#")!=0){
				doc.precharg[j]=new Image;
				doc.precharg[j++].src=x[i];
			}
	}
}

function ManagementCheckBox (ValNumber, type)
{
	if (type==1){
		for (var x=1;x<=(ValNumber-1);x++)
		{
			get("rss_"+x).checked=true;
		}
	}else{
		for (var x=1;x<=(ValNumber-1);x++)
		{
			get("rss_"+x).checked=false;
		}
	}
}


function getDim(){

	var xScroll, yScroll;

	if (window.innerHeight && window.scrollMaxY) {
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}

	var windowWidth, windowHeight;

	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth;
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}

	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){
		pageWidth = xScroll;
	} else {
		pageWidth = windowWidth;
	}

	return [pageWidth,pageHeight];
}
