/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

var xmlHttp; 
//创建XMLHttpRequest对象
function CreateXMLHttpRequest()
{
	if (window.ActiveXObject)
	{
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		xmlHttp = new XMLHttpRequest();
	}
}
//返回学校选择列表
function Showshinfo(uid,rid)
{  
	CreateXMLHttpRequest();
	if(xmlHttp)
	{
		xmlHttp.open('get','./ajax_sch.php?aid='+uid+'&tid='+rid,true);
		xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		var SendData = 'aid='+uid+'&tid='+rid;
		xmlHttp.send(SendData);
		xmlHttp.onreadystatechange=function()
		{
		   if(xmlHttp.readyState==4)
		   {
			 if(xmlHttp.status==200)
			 {
			   var str=xmlHttp.responseText;
               mystr=str.split("@@@");
              //alert(mystr)
            // GetId("showinfo").innerHTML = mystr[0];

			 //alert(mystr)
			  GetId("select1").innerHTML = mystr[0];
			  GetId("select2").innerHTML="<select name='bm_zyid1' id='bm_zy1'><option value='' selected>请选择专业</option><optgroup label='请选择学校'></select>";
			  GetId("select3").innerHTML="<select name='bm_zyid2' id='bm_zy2'><option value='' selected>请选择专业</option><optgroup label='请选择学校'></select>";
               //alert(mystr[0])
			 }
			 else
			 {
				GetId("select1").innerHTML='出错：'+xmlHttp.statusText;
			 }
		   }
		   else
		   {
				GetId("select1").innerHTML="正在提交数据...";
			}
	  	}

	 }
	 else
	 {
	 	GetId("select1").innerHTML='抱歉，您的浏览器不支持XMLHttpRequest，请使用IE6以上版本！';
	 }
}
//返回专业选择列表
//sid 学校编号
function Showzyinfo(sid)
{
	CreateXMLHttpRequest();
	if(xmlHttp)
	{
		xmlHttp.open('POST','./ajax_zy.php?sid='+sid,true);
		xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		var SendData = 'sid='+sid;
		xmlHttp.send(SendData);
		xmlHttp.onreadystatechange=function()
		{
		   if(xmlHttp.readyState==4)
		   {
			 if(xmlHttp.status==200)
			 {
			   var str=xmlHttp.responseText;
                //mystr=str.split("@@@");
              //alert(mystr)
             //GetId("select2").innerHTML = mystr[0];
			 // GetId("SID").value = sid;
			  GetId("select2").innerHTML = "<select name='bm_zyid1' id='bm_zy1'>"+str+"</select>";
			  GetId("select3").innerHTML = "<select name='bm_zyid2' id='bm_zy2'>"+str+"</select>";
			 }
			 else
			 {
				GetId("select2").innerHTML='出错：'+xmlHttp.statusText;
				GetId("select3").innerHTML='出错：'+xmlHttp.statusText;
			 }
		   }
		   else
		   {
				GetId("select2").innerHTML="正在提交数据...";
				GetId("select3").innerHTML="正在提交数据...";
			}
	  	}

	 }
	 else
	 {
	 	GetId("select2").innerHTML='抱歉，您的浏览器不支持XMLHttpRequest，请使用IE6以上版本！';
		GetId("select3").innerHTML='抱歉，您的浏览器不支持XMLHttpRequest，请使用IE6以上版本！';
	 }
}


//取得页面对象
//id,层id
function GetId(id)
{
	return document.getElementById(id);
}


function selesch(sid,tid){

     alert(sid);
	 alert(tid);

}



