/*
	HITACHI CONSTRUCTION MACHINERY
	JS FILE [/locator/mapfunction.js]
 */


var loaded = 0;
var currentCountoryName="";
var toggle=false;

map_off = new Image();map_off.src = cdnPath + '/global/images/locator/index/map_off.gif';
map_africa = new Image();map_africa.src = cdnPath + '/global/images/locator/index/map_africa.gif';
map_asia = new Image();map_asia.src = cdnPath + '/global/images/locator/index/map_asia.gif';
map_europe = new Image();map_europe.src = cdnPath + '/global/images/locator/index/map_europe.gif';
map_middleeast = new Image();map_middleeast.src = cdnPath + '/global/images/locator/index/map_middleeast.gif';
map_oceania = new Image();map_oceania.src = cdnPath + '/global/images/locator/index/map_oceania.gif';
map_america = new Image();map_america.src = cdnPath + '/global/images/locator/index/map_america.gif';

bg = new Image();bg.src = cdnPath + '/global/images/locator/index/arrow_bg_small.gif';

function dellink(id,tagname){
	var items = document.getElementById(id).getElementsByTagName(tagname);
	for(var i=0 ; i < items.length; i++){
		items[i].setAttribute("href","javascript:void(0)");
	}
}

function switchLayer(id,condition){
	if(w3c) document.getElementById(id).style.display = ((condition =="on")? "block" : "none");
}
function switchStyle(id,condition){
	if(w3c){
		document.getElementById(id +"btn").firstChild.className =  ((condition =="on")? "linkon" : "link");
		document.getElementById(id +"btn").className= id + ((condition =="on")? "btnon" : "btn");
	}
}

function roll(imageState) {
	if (loaded){
		if(!imageState) document ['mapimage'].src = eval("map_off.src");
		else document ['mapimage'].src = eval("map_"+imageState+".src");
	}
}

function showList(countryName){
	
	switchStyle(countryName,"on");
	if(!(currentCountoryName=="")&&(currentCountoryName != countryName)){
		switchStyle(currentCountoryName,"off");
		switchLayer(currentCountoryName + "list","off");
	}
	
	switchLayer(countryName + "list","on");
	switchLayer("mapimage","off");
	toggle=true;
	currentCountoryName = countryName;
}

function backtoworld(){
	switchStyle(currentCountoryName,"off");
	switchLayer(currentCountoryName + "list","off");
	switchLayer("mapimage","on");
}
function mapInit(){
	loaded = 1;
	dellink("area","area");
	dellink("leftnavigation","a");
}
window.addOnload(mapInit);

function submitform(country_id , pref_exist) {
	if(pref_exist == 0){
		document.form1.action="information.html";
	}else{
		document.form1.action="prefecture.html";
	}
	document.form1.countryId.value=country_id;
	document.form1.page_pre.value='1';
	document.form1.submit();
}


