function loading_open() {
	id$("contents").display="none";
	id$("loading").display="block";
}

function loading_close() {
	id$("contents").display="block";
	id$("loading").display="none";
}

function ajax_excel(code) {
	openWin("excel.php?code=" + code,500,500,false);
	return false;
}

function ajax_login() {
	var xmlhttp;
	if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}
	else {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			var str = xmlhttp.responseText;
			if(str == "1") {
				top.location.href="home.php";
			} else {
				alert(str);
			}
			loading_close();
		}
	}
	var v = prepare_submission();
	loading_open();
	xmlhttp.open("POST","ajax.php",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send("mode=ajax_login&values=" + Url.encode(v));
	return false;
}

function ajax_country() {
	var xmlhttp;
	if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}
	else {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			var str = xmlhttp.responseText;
			if(str == "1") {
				alert("Saved!");
				window.location = window.location;
			} else {
				alert(str);
			}
			loading_close();
		}
	}
	var v = prepare_submission();
	loading_open();
	xmlhttp.open("POST","ajax.php",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send("mode=ajax_country&values=" + Url.encode(v));
	return false;
}

function ajax_language() {
	var xmlhttp;
	if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}
	else {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			var str = xmlhttp.responseText;
			if(str == "1") {
				alert("Saved!");
				window.location = window.location;
			} else {
				alert(str);
			}
			loading_close();
		}
	}
	var v = prepare_submission();
	loading_open();
	xmlhttp.open("POST","ajax.php",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send("mode=ajax_language&values=" + Url.encode(v));
	return false;
}

function ajax_language_new() {
	var xmlhttp;
	if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}
	else {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			var str = xmlhttp.responseText;
			if(str == "1") {
				alert("Saved!");
				window.location = "websites_language.php";
			} else {
				alert(str);
			}
			loading_close();
		}
	}
	var v = prepare_submission();
	loading_open();
	xmlhttp.open("POST","ajax.php",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send("mode=ajax_language&values=" + Url.encode(v));
	return false;
}

function ajax_changepassword() {
	var xmlhttp;
	if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}
	else {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			var str = xmlhttp.responseText;
			if(str == "1") {
				alert("Password is changed!");
				window.location = window.location;
			} else {
				alert(str);
			}
			loading_close();
		}
	}
	var v = prepare_submission();
	loading_open();
	xmlhttp.open("POST","ajax.php",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send("mode=ajax_changepassword&values=" + Url.encode(v));
	return false;
}

function ajax_users() {
	var xmlhttp;
	if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}
	else {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			var str = xmlhttp.responseText;
			if(str == "1") {
				alert("Saved!");
				window.location = "admin_users.php";
			} else {
				alert(str);
			}
			loading_close();
		}
	}
	var v = prepare_submission();
	loading_open();
	xmlhttp.open("POST","ajax.php",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send("mode=ajax_users&values=" + Url.encode(v));
	return false;
}

function ajax_users_resetpassword() {
	var xmlhttp;
	if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}
	else {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			var str = xmlhttp.responseText;
			if(str == "1") {
				alert("Reset to NSKMOTION&CONTROL");
				window.location = window.location;
			} else {
				alert(str);
			}
			loading_close();
		}
	}
	var v = prepare_submission();
	loading_open();
	xmlhttp.open("POST","ajax.php",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send("mode=ajax_users_resetpassword&values=" + Url.encode(v));
	return false;
}

function ajax_users_delete() {
	var xmlhttp;
	if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}
	else {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			var str = xmlhttp.responseText;
			if(str == "1") {
				alert("Deleted!");
				window.location = window.location;
			} else {
				alert(str);
			}
			loading_close();
		}
	}
	var v = prepare_submission();
	loading_open();
	xmlhttp.open("POST","ajax.php",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send("mode=ajax_users_delete&values=" + Url.encode(v));
	return false;
}

function ajax_users_inactivate() {
	var xmlhttp;
	if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}
	else {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			var str = xmlhttp.responseText;
			if(str == "1") {
				alert("Inactivated!");
				window.location = window.location;
			} else {
				alert(str);
			}
			loading_close();
		}
	}
	var v = prepare_submission();
	loading_open();
	xmlhttp.open("POST","ajax.php",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send("mode=ajax_users_inactivate&values=" + Url.encode(v));
	return false;
}

function ajax_users_activate() {
	var xmlhttp;
	if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}
	else {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			var str = xmlhttp.responseText;
			if(str == "1") {
				alert("Activated!");
				window.location = window.location;
			} else {
				alert(str);
			}
			loading_close();
		}
	}
	var v = prepare_submission();
	loading_open();
	xmlhttp.open("POST","ajax.php",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send("mode=ajax_users_activate&values=" + Url.encode(v));
	return false;
}

function ajax_addressbook() {
	var xmlhttp;
	if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}
	else {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			var str = xmlhttp.responseText;
			if(str == "1") {
				alert("Saved!");
				window.location = "admin_addressbook.php";
			} else {
				alert(str);
			}
			loading_close();
		}
	}
	var v = prepare_submission();
	loading_open();
	xmlhttp.open("POST","ajax.php",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send("mode=ajax_addressbook&values=" + Url.encode(v));
	return false;
}

function ajax_addressbook_delete() {
	var xmlhttp;
	if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}
	else {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			var str = xmlhttp.responseText;
			if(str == "1") {
				alert("Deleted!");
				window.location = window.location;
			} else {
				alert(str);
			}
			loading_close();
		}
	}
	var v = prepare_submission();
	loading_open();
	xmlhttp.open("POST","ajax.php",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send("mode=ajax_addressbook_delete&values=" + Url.encode(v));
	return false;
}

function ajax_addressbook_inactivate() {
	var xmlhttp;
	if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}
	else {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			var str = xmlhttp.responseText;
			if(str == "1") {
				alert("Inactivated!");
				window.location = window.location;
			} else {
				alert(str);
			}
			loading_close();
		}
	}
	var v = prepare_submission();
	loading_open();
	xmlhttp.open("POST","ajax.php",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send("mode=ajax_addressbook_inactivate&values=" + Url.encode(v));
	return false;
}

function ajax_addressbook_activate() {
	var xmlhttp;
	if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}
	else {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			var str = xmlhttp.responseText;
			if(str == "1") {
				alert("Activated!");
				window.location = window.location;
			} else {
				alert(str);
			}
			loading_close();
		}
	}
	var v = prepare_submission();
	loading_open();
	xmlhttp.open("POST","ajax.php",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send("mode=ajax_addressbook_activate&values=" + Url.encode(v));
	return false;
}

function ajax_enquiry() {
	var xmlhttp;
	if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}
	else {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			var str = xmlhttp.responseText;
			if(str == "1") {
				alert("Saved!");
				window.location = "admin_enquiry.php";
			} else {
				alert(str);
			}
			loading_close();
		}
	}
	var v = prepare_submission();
	loading_open();
	xmlhttp.open("POST","ajax.php",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send("mode=ajax_enquiry&values=" + Url.encode(v));
	return false;
}

function ajax_enquiry_delete() {
	var xmlhttp;
	if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}
	else {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			var str = xmlhttp.responseText;
			if(str == "1") {
				alert("Deleted!");
				window.location = window.location;
			} else {
				alert(str);
			}
			loading_close();
		}
	}
	var v = prepare_submission();
	loading_open();
	xmlhttp.open("POST","ajax.php",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send("mode=ajax_enquiry_delete&values=" + Url.encode(v));
	return false;
}

function ajax_newsletter_delete() {
	var xmlhttp;
	if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}
	else {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			var str = xmlhttp.responseText;
			if(str == "1") {
				alert("Deleted!");
				window.location = window.location;
			} else {
				alert(str);
			}
			loading_close();
		}
	}
	var v = prepare_submission();
	loading_open();
	xmlhttp.open("POST","ajax.php",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send("mode=ajax_newsletter_delete&values=" + Url.encode(v));
	return false;
}

function ajax_versionbase_delete() {
	var xmlhttp;
	if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}
	else {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			var str = xmlhttp.responseText;
			if(str == "1") {
				alert("Deleted!");
				window.location = window.location;
			} else {
				alert(str);
			}
			loading_close();
		}
	}
	var v = prepare_submission();
	loading_open();
	xmlhttp.open("POST","ajax.php",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send("mode=ajax_versionbase_delete&values=" + Url.encode(v));
	return false;
}

function ajax_versionbase_restore() {
	var xmlhttp;
	if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}
	else {xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 && xmlhttp.status==200){
			var str = xmlhttp.responseText;
			if(str == "1") {
				alert("Restored! It will create a new version as Draft.");
				window.location = window.location;
			} else {
				alert(str);
			}
			loading_close();
		}
	}
	var v = prepare_submission();
	loading_open();
	xmlhttp.open("POST","ajax.php",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send("mode=ajax_versionbase_restore&values=" + Url.encode(v));
	return false;
}
