var loginWindow;

function openLoginWindow(url) {
	var target = url
			+ "?" + "lang=" + window.document.forms[0].lang.value
			+ "&" + "mode=" + window.document.forms[0].mode.value;
	loginWindow = window.open( target, "Login", "width=300,height=300,scrollbars=no, status=no");
	loginWindow.focus();
}
function closeLoginWindow(){
	if( loginWindow != null ){
		if( !loginWindow.closed ){
			loginWindow.close();
			loginWindow = null;
		}
	}

}

var stateWindow;

function openStateWindow1(url,name) {
	if((stateWindow != null) && !(stateWindow.closed)) {
		stateWindow.close();
	}
	stateWindow = window.open(url, name, "width=250,height=500,scrollbars=yes, status=no");
}

function setState(stateName) {
	if(window.name == "state1") {
		opener.document.AS0201Form.state1.value=stateName;
		self.close();
	}
	if(window.name == "state2") {
		opener.document.AS0201Form.state2.value=stateName;
		self.close();
	}
	if(window.name == "state") {
		opener.document.AS0206Form.state.value=stateName;
		self.close();
	}
	if(window.name == "state3") {
		opener.document.AS0211Form.state.value=stateName;
		self.close();
	}
}

function setCountryState( country, stateName ) {
	if(window.name == "state1") {
		opener.document.AS0201Form.state1.value=stateName;
		opener.document.AS0201Form.country1.value=country;
		self.close();
	}
	if(window.name == "state2") {
		opener.document.AS0201Form.state2.value=stateName;
		opener.document.AS0201Form.country2.value=country;
		self.close();
	}
	if(window.name == "state") {
		opener.document.AS0206Form.state.value=stateName;
		opener.document.AS0206Form.country.value=country;
		self.close();
	}
	if(window.name == "state3") {
		opener.document.AS0211Form.state.value=stateName;
		opener.document.AS0211Form.country.value=country;
		self.close();
	}
}


function closeStateWindow() {
	if(stateWindow != null) {
		stateWindow.close();
	}
}

function closeStateAndSubmit(form) {
	closeStateWindow();
	form.submit();
}

function toMainWindow() {
	opener.location.href = "AS0002.jsp";
	self.close();
}

function setHomePoint(point) {
	document.AS0202RegistHomeForm.pointName.value=point;
	document.AS0202RegistHomeForm.submit();
}

function removeInterim(index) {
	document.AS0207Form.interimIndex.value=index;
	document.AS0207Form.submit();
}

function openIntersectionMap(url, windowName) {
	var newMapWindow = window.open(url, windowName, "width=800,height=500,scrollbars=no, status=no");
	newMapWindow.focus();
}

function closeSelfWindow() {
	self.close();
}

function hideDownloadButton() {
	document.AS0205FormDefault.wait.style.visibility = "visible";
	document.AS0205FormDefault.download.style.visibility = "hidden";
	document.AS0205FormDefault.cancel.style.visibility = "hidden";
//	document.downloadAction.submit();
	AREASHOT_DOWNLOAD.document.downloadAction.submit();
}

function toDirection() {
	MM_preloadImages('images/map/map_btn_zoomp_mo.gif','images/map/map_btn_zoomin_mo.gif','images/map/map_btn_zoomout_mo.gif');
	window.location.href="#destination";
}

function openIntermWindow(url, index) {
	var windowName = 'interimWindow' + index;
	var newMapWindow = window.open(url, windowName, "width=800,height=440,scrollbars=no, status=no");
	newMapWindow.focus();
}

function openCopyrightWindow( url ) {
	var newCopyRightWindow = window.open( url, "LicenseCopyright" );
	newCopyRightWindow.focus();
}

function TownhideDownloadButton() {
	document.AS0215FormDefault.wait.style.visibility = "visible";
	document.AS0215FormDefault.download.style.visibility = "hidden";
	document.AS0215FormDefault.cancel.style.visibility = "hidden";
//	document.downloadAction.submit();
	//AREASHOT_DOWNLOAD.document.TowndownloadAction.submit();
	document.TowndownloadAction.submit();
}

