// JavaScript Document
function checkDel() {
	if(confirm("确认要删除")) {
		return true;
	}
	else {
		return false;
	}
}

var xmlHttp = false;
if(typeof(HTMLElement)!="undefined" && !window.opera){
		HTMLElement.prototype.__defineGetter__("outerHTML",function()
		{
			var a=this.attributes, str="<"+this.tagName, i=0;for(;i<a.length;i++)
			if(a[i].specified)
				str+=" "+a[i].name+'="'+a[i].value+'"';
			if(!this.canHaveChildren)
				return str+" />";
			return str+">"+this.innerHTML+"</"+this.tagName+">";
		});
		HTMLElement.prototype.__defineSetter__("outerHTML",function(s)
		{
			var r = this.ownerDocument.createRange();
			r.setStartBefore(this);
			var df = r.createContextualFragment(s);
			this.parentNode.replaceChild(df, this);
			return s;
		});
		HTMLElement.prototype.__defineGetter__("canHaveChildren",function()
		{
			return !/^(area|base|basefont|col|frame|hr|img|br|input|isindex|link|meta|param)$/.test(this.tagName.toLowerCase());
		});
}
//调用ajax
function ajax_get(){
	var value = document.getElementById("f_area").value;
	if(value == "0"){
		var optionsValue = "<select name='f_city' id='f_city' class='small'><option label='国道府県' value='0'>国道府県</option></select>";
		document.getElementById("f_city").outerHTML=optionsValue;
	}
	else{
		sendRequest("index.php?controller=Ajax&action=ShowArea&dic_value="+value+"&id="+Math.random());
	}
}
//ajax建立
function sendRequest(url){
	if(window.ActiveXObject){
		try{
			xmlHttp = new ActiveXObject('Msxml2.XMLHTTP');
		}
		catch(e){
			try{
				xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
			}
			catch(e){
				
			}
		}
	}
	else if(window.XMLHttpRequest){
		xmlHttp = new XMLHttpRequest();
		if(xmlHttp.overridMimeType){
			xmlHttp.overridMimeType("txt/html");
		}
	}
	if(!xmlHttp){
		window.alert("can not creat xmlHttp");
		return false;
	}
	xmlHttp.onreadystatechange = processRequest;
	xmlHttp.open('GET',url,true);
	xmlHttp.send(null);	
}
//处理ajax返回值
function processRequest(){
	if(xmlHttp.readyState == 4){
		if(xmlHttp.status == 200){
			var res = xmlHttp.responseText;
			document.getElementById("f_city").style.display = "block";
			document.getElementById("f_city").outerHTML=res;
		}
		else{
			alert(xmlHttp.status);
		}
	}
}
