﻿var browser=navigator.appName; 
var browserCode=navigator.appCodeName;
var b_version=navigator.appVersion;  
var version=parseFloat(b_version);  
var itineraryImageW = null;
var itineraryImageH = null;
//alert(b_version);
if(browser=='Microsoft Internet Explorer'){
    if(version==6){
    	document.write("<link href='/caa-ttp/css/ie6Fix.css' rel='stylesheet' type='text/css' media='all'/>");    	
    }else if(true){
    	document.write("<link href='/caa-ttp/css/ie8Fix.css' rel='stylesheet' type='text/css' media='all'/>");    	
    }	 
}

function getPosition(){

//varialbles locales
if (window.innerHeight != null)
		{
		 var w =window.innerWidth;
		 var h =window.innerHeight;
		 var wrapW=w-14;
		 var wrapH=h-14;
		 itineraryImageW = w-411;
		 itineraryImageH = h-92;
		 
		}
else 
		{ 
	    var h = document.body.clientHeight;
		var w = document.body.clientWidth;
		var wrapH=h-8;
		var wrapW=w-8;
		 itineraryImageW = w  - 411;
		 itineraryImageH = h-92;
		}
if(map != null){
	
	if(browser=='Microsoft Internet Explorer'){
    
    	  map.setViewSize(w-411,h-92);
	 }else{
					 
		  map.setViewSize(w-411,h-92);
	 }
	
	map.userPOIService.update();	
	 if (showPage == 'localisation') {		 
		 map.show();
	 }
}

document.getElementById('wrap').style.height = wrapH +'px'  ;
document.getElementById('wrap').style.width = wrapW +'px'  ;

var innerW=wrapW;
document.getElementById('header').style.width = innerW +'px'  ;
document.getElementById('content').style.width = innerW +'px'  ;
document.getElementById('footer').style.width = innerW+'px'  ;

var innerH=null;
if(browser=='Microsoft Internet Explorer'){
	innerH =wrapH-85;
}else{
	innerH =wrapH-78;
}
document.getElementById('content').style.height = innerH +'px'  ;
document.getElementById('mapCtn').style.height = innerH +'px'  ;
document.getElementById('planificateur').style.height = innerH +'px'  ;
document.getElementById('itineraire').style.height = innerH +'px'  ;
document.getElementById('localisation').style.height = innerH +'px'  ;

var Hscroll = innerH-33;
document.getElementById('itineraireScroll').style.height = Hscroll +'px'  ;
document.getElementById('localisationScroll').style.height = Hscroll +'px'  ;
var mapW = innerW-400;
document.getElementById('mapCtn').style.width = mapW +'px' ;
}

function collapseMap() {

	//varialbles locales

	var w = document.getElementById('content').clientWidth;

	var supH = document.getElementById('wrap').clientHeight;

	if (document.getElementById('setMapSize').className == "hideplannif") {

		var h = document.getElementById('content').clientHeight;

		itineraryImageW = w - 411;

		if (map != null) {

			if (browser == 'Microsoft Internet Explorer') {
				map.adjustSize(0,0);

			} else {
				map.adjustSize(0,0);
			}
			if (showPage == 'localisation') {
				//updateMap(long,lat,zoomLevelGlobal);
				//map.show();			
			}

		}

		var mapW = w - 400;

		var x = "rect(67px, " + w + "px ," + h + "px , 401px)";

		document.getElementById('mapCtn').style.width = mapW + 'px';
		document.getElementById('setMapSize').className = 'showplannif';
		document.getElementById('planificateur').style.display = "block";
		document.getElementById('dMapContainer1').style.left = "401px";
	}
	else{		
		var h = document.getElementById('wrap').clientHeight - 11;
		itineraryImageW = w - 21;
		if (map != null) {
			if (browser == 'Microsoft Internet Explorer') {
				var x = "rect(67px " + w + "px " + h + "px  2px)";				
				map.adjustSize(-200, 0);
			} else {
				map.adjustSize(-200, 0);
				var x = "rect(67px, " + w + "px ," + h + "px , 2px)";
			}
			if (showPage == 'localisation') {

				//map.show();
				//updateMap(long,lat,zoomLevelGlobal);

			}

		}

		var mapW = w;

		document.getElementById('mapCtn').style.width = w + 'px';

		document.getElementById('planificateur').style.display = "none";

		document.getElementById('setMapSize').className = "hideplannif";

		document.getElementById('dMapContainer').style.clip = x;

		document.getElementById('dMapContainer1').style.left = "2px";

	}

	var dCopywriteVal = supH - 30;

	var dScaleBarMVal = supH - 45;

	var dScaleBarEVal = supH - 60;

	document.getElementById('dCopywrite').style.top = dCopywriteVal + "px";

	document.getElementById('dScaleBarM').style.top = dScaleBarMVal + "px";

	document.getElementById('dScaleBarE').style.top = dScaleBarEVal + "px";

}
