// Browser Detect
function CheckAgent(){
	var OperaVersion = '';
	OperaVersion = window.navigator.userAgent.substr(window.navigator.userAgent.indexOf("Opera")+6,4);
	if(OperaVersion == 7.54){
		window.document.getElementById('flash_map').className = 'hide';
		window.document.getElementById('no_flash_map').style.display = 'block';
		//window.document.getElementById('main_content').style.marginTop = "-" + 1000 + "px";
		window.document.getElementById('link').style.display = 'none';
		window.document.getElementById('link_map').style.display = 'none';
	} else {
		SetFlashHeight();
	}
}
// Set Flash Height
function SetFlashHeight() {
	var OperaVersion = '';
	OperaVersion = window.navigator.userAgent.substr(window.navigator.userAgent.indexOf("Opera")+6,4);
	if(OperaVersion >= 7.54){
		var Step_1 = window.document.getElementById('step_1').offsetHeight;
		var Step_2 = window.document.getElementById('step_2').offsetHeight;
		var Step_3 = window.document.getElementById('step_3').offsetHeight;
		var SiteHeight = 125 + Step_1 + Step_2 + Step_3;
		window.document.getElementById('flash_map').style.height = SiteHeight + "px";
		//window.document.getElementById('main_content').style.marginTop = "-" + SiteHeight + "px";
		SetHeightOnItem(SiteHeight);
	} else {
		if (window.navigator.userAgent.indexOf ("MSIE") >= 0) {
			IEVersion = 'Explorer';
			IEVersion = window.navigator.userAgent.substr(window.navigator.userAgent.indexOf("MSIE")+5,3);
			if(IEVersion == 6.0){
				var IE_Step_1 = window.document.getElementById('main_content').offsetHeight;
				var IE_Step_2 = window.document.getElementById('step_2').offsetHeight - 3;
				var IE_Step_3 = window.document.getElementById('step_3').offsetHeight;
				var IESiteHeight = IE_Step_1 + IE_Step_2 + IE_Step_3;
				window.document.getElementById('flash_map').style.height = IESiteHeight;
				//window.document.getElementById('main_content').style.marginTop = "-" + IESiteHeight + "px";
				SetHeightOnItem(IESiteHeight);
			} else {
				SetHeight();
			}
		} else {		
			SetHeight();
		} 
	}
	function SetHeight(){
		var Step_1 = window.document.getElementById('step_1').offsetHeight;
		var Step_2 = window.document.getElementById('step_2').offsetHeight;
		var Step_3 = window.document.getElementById('step_3').offsetHeight;
		var SiteHeight = 125 + Step_1 + Step_2 + Step_3;
		window.document.getElementById('flash_map').style.height = SiteHeight + "px";
		//window.document.getElementById('main_content').style.marginTop = "-" + SiteHeight + "px";
		SetHeightOnItem(SiteHeight);
	}
}
// Map Show
function ShowMap() {
	if(window.document.getElementById('main_content').className == 'main'){
		window.document.getElementById('main_content').className = 'hide';
		window.document.getElementById('link').style.display = 'none';
		window.document.getElementById('link_map').style.display = 'block';
		window.document.getElementById('link_map').style.position = 'relative';
		window.document.getElementById('link_map').style.top = '-60px';
		var OperaVersion = '';
		OperaVersion = window.navigator.userAgent.substr(window.navigator.userAgent.indexOf("Opera")+6,4);
		if(OperaVersion > 7.54){
			window.document.getElementById('flash_map').style.height = 100 + "px";
			if(OperaVersion >= 9.0){
				window.document.getElementById('flash_map').style.height = window.document.body.scrollHeight + "px";
			} else {
				window.document.getElementById('flash_map').style.height = 100 + "%";
			}
		} else {
			if (window.navigator.userAgent.indexOf ("MSIE") >= 0) {
				IEVersion = 'Explorer';
				IEVersion = window.navigator.userAgent.substr(window.navigator.userAgent.indexOf("MSIE")+5,3);
				if(IEVersion == 6.0){
					window.document.getElementById('flash_map').style.height = 100 + "%";
				} else {
					window.document.getElementById('flash_map').style.height = 100 + "%";
				}
			} else {
				window.document.getElementById('flash_map').style.height = 100 + "%";
				window.document.getElementById('flash_map').style.height = window.document.body.scrollHeight + "px";
			}
		}
	} else {
		window.document.getElementById('main_content').className = 'main';
		window.document.getElementById('link').style.display = 'block';
		window.document.getElementById('link_map').style.display = 'none';
		var OperaVersion = '';
		OperaVersion = window.navigator.userAgent.substr(window.navigator.userAgent.indexOf("Opera")+6,4);
		if(OperaVersion > 7.54){
			var Step_1 = window.document.getElementById('step_1').offsetHeight;
			var Step_2 = window.document.getElementById('step_2').offsetHeight;
			var Step_3 = window.document.getElementById('step_3').offsetHeight;
			var SiteHeight = 125 + Step_1 + Step_2 + Step_3;
			window.document.getElementById('flash_map').style.height = SiteHeight + "px";
			//window.document.getElementById('main_content').style.marginTop = "-" + SiteHeight + "px";
			SetHeightOnItem(SiteHeight);
		} else {
			if (window.navigator.userAgent.indexOf ("MSIE") >= 0) {
				IEVersion = 'Explorer';
				IEVersion = window.navigator.userAgent.substr(window.navigator.userAgent.indexOf("MSIE")+5,3);
				if(IEVersion == 6.0){
					var IE_Step_1 = window.document.getElementById('main_content').offsetHeight;
					var IE_Step_2 = window.document.getElementById('step_2').offsetHeight - 3;
					var IE_Step_3 = window.document.getElementById('step_3').offsetHeight;
					var IESiteHeight = IE_Step_1 + IE_Step_2 + IE_Step_3;
					window.document.getElementById('main_content').style.position = 'absolute';
					window.document.getElementById('main_content').style.top = '0';
					window.document.getElementById('main_content').style.left = '0';
					if(window.document.getElementById('main_content').style.position == 'absolute') {
					    //window.document.getElementById('main_content').style.position = 'relative';
					    //window.document.getElementById('main_content').style.marginTop = "-" + IESiteHeight + "px";
						window.document.getElementById('main_content').style.position = 'absolute';
						window.document.getElementById('main_content').style.top = '0';
						window.document.getElementById('main_content').style.left = '0';
					    SetHeightOnItem(IESiteHeight);
					}
					
				} else {
					var Step_1 = window.document.getElementById('step_1').offsetHeight;
					var Step_2 = window.document.getElementById('step_2').offsetHeight;
					var Step_3 = window.document.getElementById('step_3').offsetHeight;
					var SiteHeight = 125 + Step_1 + Step_2 + Step_3;
					//window.document.getElementById('main_content').style.marginTop = "-" + SiteHeight + "px";
					SetHeightOnItem(SiteHeight);
				}
			} else {
				var Step_1 = window.document.getElementById('step_1').offsetHeight;
				var Step_2 = window.document.getElementById('step_2').offsetHeight;
				var Step_3 = window.document.getElementById('step_3').offsetHeight;
				var SiteHeight = 125 + Step_1 + Step_2 + Step_3;
				window.document.getElementById('flash_map').style.height = SiteHeight + "px";
				//window.document.getElementById('main_content').style.marginTop = "-" + SiteHeight + "px";
				SetHeightOnItem(SiteHeight);
			}
		}
	}
}
/* Call Back Flash */
function findFlash(movieName) {
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName]
	} else {
		return document[movieName]
	}
}
function showDots() {
	findFlash("planes").showDots();
}
function hideDots() {
	findFlash("planes").hideDots();
}
/* Set Flash Height on Resize */
window.onresize = setResizeHeight;
function setResizeHeight() {
	if(window.document.getElementById('main_content').className == 'hide'){
		var OperaVersion = '';
		OperaVersion = window.navigator.userAgent.substr(window.navigator.userAgent.indexOf("Opera")+6,4);
		if(OperaVersion > 7.54){
			window.document.getElementById('flash_map').style.height = 100 + "px";
			if(OperaVersion >= 9.0){
				window.document.getElementById('flash_map').style.height = window.document.body.scrollHeight + "px";
			} else {
				window.document.getElementById('flash_map').style.height = 100 + "%";
			}
		} else {
			if (window.navigator.userAgent.indexOf ("MSIE") >= 0) {
				IEVersion = 'Explorer';
				IEVersion = window.navigator.userAgent.substr(window.navigator.userAgent.indexOf("MSIE")+5,3);
				if(IEVersion == 6.0){
					window.document.getElementById('flash_map').style.height = 100 + "%";
				} else {
					window.document.getElementById('flash_map').style.height = 100 + "%";
				}
			} else {
				window.document.getElementById('flash_map').style.height = 100 + "%";
				window.document.getElementById('flash_map').style.height = window.document.body.scrollHeight + "px";
			}
		}
	}
}
