//========================================================================================xmlHttp错误列表
//xmlhttp的status错误列表
function xmlhttpStatus(status)
{
	var httpStatus;
	switch(status)
	{
		case 100:
			httpStatus = "Continue";
			break;
		case 101:
			httpStatus = "Switching protocols";
			break;
		case 200:
			httpStatus = "OK";
			break;
		case 201:
			httpStatus = "Created";
			break;
		case 202:
			httpStatus = "Accepted";
			break;
		case 203:
			httpStatus = "Non-Authoritative Information";
			break;
		case 204:
			httpStatus = "No Content";
			break;
		case 205:
			httpStatus = "Reset Content";
			break;
		case 206:
			httpStatus = "Partial Content";
			break;
		case 300:
			httpStatus = "Multiple Choices";
			break;
		case 301:
			httpStatus = "Moved Permanently";
			break;
		case 302:
			httpStatus = "Found";
			break;
		case 303:
			httpStatus = "See Other";
			break;
		case 304:
			httpStatus = "Not Modified";
			break;
		case 305:
			httpStatus = "Use Proxy";
			break;
		case 307:
			httpStatus = "Temporary Redirect";
			break;
		case 400:
			httpStatus = "Bad Request";
			break;
		case 401:
			httpStatus = "Unauthorized";
			break;
		case 402:
			httpStatus = "Payment Required";
			break;
		case 403:
			httpStatus = "Forbidden";
			break;
		case 404:
			httpStatus = "Not Found";
			break;
		case 405:
			httpStatus = "Method Not Allowed";
			break;
		case 406:
			httpStatus = "Not Acceptable";
			break;
		case 407:
			httpStatus = "Proxy Authentication Required";
			break;
		case 408:
			httpStatus = "Request Timeout";
			break;
		case 409:
			httpStatus = "Conflict";
			break;
		case 410:
			httpStatus = "Gone";
			break;
		case 411:
			httpStatus = "Length Required";
			break;
		case 412:
			httpStatus = "Precondition Failed";
			break;
		case 413:
			httpStatus = "Request Entity Too Large";
			break;
		case 414:
			httpStatus = "Request-URI Too Long";
			break;
		case 415:
			httpStatus = "Unsupported Media Type";
			break;
		case 416:
			httpStatus = "Requested Range Not Suitable";
			break;
		case 417:
			httpStatus = "Expectation Failed";
			break;
		case 500:
			httpStatus = "Internal Server Error";
			break;
		case 501:
			httpStatus = "Not Implemented";
			break;
		case 502:
			httpStatus = "Bad Gateway";
			break;
		case 503:
			httpStatus = "Service Unavailable";
			break;
		case 504:
			httpStatus = "Gateway Timeout";
			break;
		case 505:
			httpStatus = "HTTP Version Not Supported";
			break;
		default:
			httpStatus = "异常！传进来的stauts为："+ status;
			break;			
	}
	return httpStatus;
}
//xmlHttpReadyState的状态
function xmlHttpReadyState(state)
{
	var readyState;
	switch(state)
	{
		case 0:
			readyState = "(未初始化)对象已建立，但是尚未初始化（尚未调用open方法）";
			break;
		case 1:
			readyState = " (初始化)对象已建立，尚未调用send方法";
			break;
		case 2:
			readyState = "(发送数据)send方法已调用，但是当前的状态及http头未知";
			break;
		case 3:
			readyState = "(数据传送中)已接收部分数据，因为响应及http头不全，这时通过responseBody和responseText获取部分数据会出现错误";
			break;
		case 3:
			readyState = "(完成)数据接收完毕,此时可以通过通过responseBody和responseText获取完整的回应数据";
			break;
		case 4:
			readyState = "Created";
			break;
		default:
			readyState = "异常！传进来的State为："+state;
			break;
	}
	return readyState;	
}
//========================================================================================xmlHttp错误列表结束

//xmlhttprequest
var http_request = false;
formStr = "";
obj = "";
//////////////////////////////////////////////////////////////////////////////////////////////////
function radio_send_request(obj,formStr,url)
{
	http_request = false;
	window.formStr = formStr;
	window.obj = obj;
	//alert("window.obj= "+ window.obj);
	if(window.XMLHttpRequest)//非ie浏览器
	{
		http_request = new XMLHttpRequest();
		if(http_request.overrideMimeType)
		{
			http_request.overrideMimeType("text/xml");
		}
	}
	else if(window.ActiveXObject)//ie浏览器
	{
		try
		{
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){}	
		}
	}
	if(!http_request)
	{
		window.alert("不能创建XMLHttpRequest对象实例");
		return false;
	}
	
	http_request.onreadystatechange=radio_processRequest;
	
	http_request.open("GET",url,true);
	//http_request.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded;text/xml;charset=utf-8");
	http_request.send(null);
}


//xmlhttprequest结束
function radio_processRequest()
{
	if(http_request.readyState==4)
	{
		if(http_request.status==200)
		{
			radio_processDetail();//具体的处理方法
		}
		else
		{
			alert("您请求的页面有异常："+ xmlhttpStatus(http_request.status));
		}
	}
	else
	{
		//alert(xmlHttpReadyState(http_request.readyState));//调试用
	}
}

//具体的处理方法
function radio_processDetail()
{
	//preloadimages("../images/point.gif","../images/point.gif");//预加载图片
	var json;
	json= eval("("+http_request.responseText+")");
	radio_selectMenu(window.obj,window.formStr,json);
}

//无限级select框的连动
//obj当前选中的select，formStr所有select框name的数组，json：json的文件
function radio_selectMenu(obj,formStr,json)//form的名字必须是"frm"
{

	var num,tmp,i,tempStr,lengthOfFromStr,selectStr,j;
		
	lengthOfFromStr = formStr.length;
	num=2;
	fromStr[num]
	for (i=0;i<lengthOfFromStr;i++ )//得到当前选中的是数组里的第几个。
	{
		if (obj==eval("document.frm."+formStr[i]))
		{
			num = i;
			//alert("num= "+num);
			//alert("formStr="+formStr);
			//alert("json="+json);
		}
		else if(obj==eval("document.frm.scen"))
		{
		    alert("单选按钮");
		}
		else
		{
			
		}
	}
	
	for (j=1;j < lengthOfFromStr-num; j++)//初始化选中select以下级的select框
	{
		selectStr = eval("document.frm."+formStr[num+j]);
		delSelectOption(selectStr);
		var oOption = new window.Option();
		oOption.text = "=请选择="//+selectStr.parentNode.previousSibling.innerText;
		oOption.value = "";
		selectStr.add(oOption);
	}

	for(i=0;i<eval("json."+formStr[num+1]+".length");i++)//添加select框的选项
	{
		selectStr = eval("document.frm."+formStr[num+1]);
		tempStr = eval("json."+formStr[num+1]+"["+i+"]");
		var oOption = new window.Option();
		oOption.text = tempStr.text;
		oOption.value = tempStr.value;
		selectStr.add(oOption);
	}
}

//////////////////////////////////////////////////////////////////////////////////////////////////

function send_request(obj,formStr,url)
{
	http_request = false;
	window.formStr = formStr;
	window.obj = obj;
	//alert("window.obj= "+ window.obj);
	if(window.XMLHttpRequest)//非ie浏览器
	{
		http_request = new XMLHttpRequest();
		if(http_request.overrideMimeType)
		{
			http_request.overrideMimeType("text/xml");
		}
	}
	else if(window.ActiveXObject)//ie浏览器
	{
		try
		{
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){}	
		}
	}
	if(!http_request)
	{
		window.alert("不能创建XMLHttpRequest对象实例");
		return false;
	}
	
	http_request.onreadystatechange=processRequest;
	
	http_request.open("GET",url,true);
	//http_request.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded;text/xml;charset=utf-8");
	http_request.send(null);
}


//xmlhttprequest结束
function processRequest()
{
	if(http_request.readyState==4)
	{
		if(http_request.status==200)
		{
			processDetail();//具体的处理方法
		}
		else
		{
			alert("您请求的页面有异常："+ xmlhttpStatus(http_request.status));
		}
	}
	else
	{
		//alert(xmlHttpReadyState(http_request.readyState));//调试用
	}
}

//具体的处理方法
function processDetail()
{
	//preloadimages("../images/point.gif","../images/point.gif");//预加载图片
	var json;
	//alert("http_request.responseText= "+http_request.responseText);
	json= eval("("+http_request.responseText+")");
	//alert("json= "+json);
	selectMenu(window.obj,window.formStr,json);
}

//无限级select框的连动
//obj当前选中的select，formStr所有select框name的数组，json：json的文件
function selectMenu(obj,formStr,json)//form的名字必须是"frm"
{

	var num,tmp,i,tempStr,lengthOfFromStr,selectStr,j;
		
	lengthOfFromStr = formStr.length;
	
	for (i=0;i<lengthOfFromStr;i++ )//得到当前选中的是数组里的第几个。
	{
		if (obj==eval("document.frm."+formStr[i]))
		{
			num = i;
			//alert("num= "+num);
			//alert("formStr="+formStr);
			//alert("json="+json);
		}
	}
	
	for (j=1;j < lengthOfFromStr-num; j++)//初始化选中select以下级的select框
	{
		selectStr = eval("document.frm."+formStr[num+j]);
		delSelectOption(selectStr);
		var oOption = new window.Option();
		oOption.text = "=请选择="//+selectStr.parentNode.previousSibling.innerText;
		oOption.value = "";
		selectStr.add(oOption);
	}

	for(i=0;i<eval("json."+formStr[num+1]+".length");i++)//添加select框的选项
	{
		selectStr = eval("document.frm."+formStr[num+1]);
		tempStr = eval("json."+formStr[num+1]+"["+i+"]");
		var oOption = new window.Option();
		oOption.text = tempStr.text;
		oOption.value = tempStr.value;
		selectStr.add(oOption);
	}
}

//删除select的所有选项
function delSelectOption(obj)
{
	var i;
	while(obj.length > 0)
	{
		obj.remove(0);
	}
}
//===============================================================================
//图片预加载
function preloadimages()
{
	var myimages=new Array()
	for (i=0;i<preloadimages.arguments.length;i++)
	{
		myimages[i]=new Image()
		myimages[i].src=preloadimages.arguments[i]
	}
}

function img_onClick()
{
	window.location.href = "../union/newsdetail.asp?id="+nid;
}


//鼠标移上去图片效果
function imageOver(tag)
{
	var num = 0;
	if (typeof(tag.tagName)=="undefined")
	{
		tag = tag_u;
	}
	while (tag.tagName != "TD" && num<15)
	{		
		num++;
		tag = tag.parentNode;
		if (tag.tagName == "TD")
		{	
			//obj.style.paddingLeft = "2px";
			tag.style.paddingBottom = "1px";
			break;
		}
	}
}

function imageOut(tag)
{
	var num = 0;
	if (typeof(tag.tagName)=="undefined")
	{
		tag = tag_u;
	}
	while (tag.tagName != "TD" && num<15)
	{	
		num++;
		tag = tag.parentNode;
		if (tag.tagName == "TD")
		{	
			//obj.style.paddingLeft = "0px";
			tag.style.paddingBottom = "0px";
			break;
		}
	}
	
}
function imageOut_reduce(tag)
{
	tag.height = tag.height - 1;
	
}

function imageOver_zoom(tag)
{
	tag.height = tag.height + 1;
}