var xmlHttp;

function createXMLHttpRequest()

     {    

  if(window.XMLHttpRequest) { //Mozilla 浏览器

   xmlHttp = new XMLHttpRequest();

   if (xmlHttp.overrideMimeType) {//设置MiME类别

    xmlHttp.overrideMimeType('text/xml');

   }

  }

  else if (window.ActiveXObject) { // IE浏览器

   try {

    xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");

   } catch (e) {

    try {

     xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");

    } catch (e) {}

   }

  }

  if (!xmlHttp) { // 异常，创建对象实例失败

   window.alert("不能创建XMLHttpRequest对象实例.");

   return false;

  }

return xmlHttp;

}



//显示或隐藏层

function showdiv(name,cursel,n){

	for (i=1;i<=n;i++){

    var menu=document.getElementById(name+i);

    var con=document.getElementById(name+"_"+i);

		if (i == cursel){

			menu.className="hover";

			con.style.display = "block";

			show_close("left_db.php?type="+cursel,name+"_"+i);

		} else {

			menu.className="";

			con.style.display = "none";

		}

	}

}



function showgamemoney(name){

	document.getElementById(name).style.display = "";

}



/*function money(url){

	var ajax = createXMLHttpRequest();

	ajax.open("GET", url, true);

	ajax.onreadystatechange = function() {//如果执行是状态正常，那么就把返回的内容赋值给指定的地方

		if (ajax.readyState == 4 && ajax.status == 200) {

			document.productsform.price.value=ajax.responseText;

		}else{

			window.alert("Read data error");

		}

	}

}*/
var http_requestt1=false;

function money(url,div,div1){//初始化，指定处理函数，发送请求的函数

    var http_requestt1=false;

	//开始初始化XMLHttpRequest对象

	if(window.XMLHttpRequest){//Mozilla浏览器

	 http_requestt1=new XMLHttpRequest();

	 if(http_requestt1.overrideMimeType){//设置MIME类别

	   http_requestt1.overrideMimeType("text/xml");

	 }

	}else if(window.ActiveXObject){//IE浏览器

	 try{

	  http_requestt1=new ActiveXObject("Msxml2.XMLHttp");

	 }catch(e){

	  try{

	  http_requestt1=new ActiveXobject("Microsoft.XMLHttp");

	  }catch(e){}

	 }

    }

	if(!http_requestt1){//异常，创建对象实例失败

	 window.alert("创建XMLHttp对象失败！");

	 return false;

	}

http_requestt1.onreadystatechange= function() {

                    if (http_requestt1.readyState == 4) {

                        if (http_requestt1.status == 200) {

                           document.productsform.price.value=http_requestt1.responseText;

                        }else{

							window.alert("Read data error");

                    }

                }

}



//确定发送请求方式，URL，及是否同步执行下段代码

    http_requestt1.open("GET",url,true);

	http_requestt1.send(null);

document.getElementById("USD").style.color=div1=="USD"?"#F00":"";

document.getElementById("EUR").style.color=div1=="EUR"?"#F00":"";

document.getElementById("GBP").style.color=div1=="GBP"?"#F00":"";

if(div1=""){

	document.getElementById("USD").style.color="#F00";

}

}




/*function money2(url){

	var ajax = createXMLHttpRequest();

	ajax.open("GET", url, true);

	ajax.onreadystatechange = function() {//如果执行是状态正常，那么就把返回的内容赋值给指定的地方

		if (ajax.readyState == 4 && ajax.status == 200) {

			document.right.price.value=ajax.responseText;

		}else{

			window.alert("Read data error");

		}

	}

}


*/


var xmlObj=false;

function show_close(url,div){//初始化，指定处理函数，发送请求的函数
   //window.alert(url);
    var xmlObj=false;

	//开始初始化XMLHttpRequest对象

	if(window.XMLHttpRequest){//Mozilla浏览器

	 xmlObj=new XMLHttpRequest();

	 if(xmlObj.overrideMimeType){//设置MIME类别

	   xmlObj.overrideMimeType("text/xml");

	 }

	}else if(window.ActiveXObject){//IE浏览器

	 try{

	  xmlObj=new ActiveXObject("Msxml2.XMLHttp");

	 }catch(e){

	  try{

	  xmlObj=new ActiveXobject("Microsoft.XMLHttp");

	  }catch(e){}

	 }

    }

	if(!xmlObj){//异常，创建对象实例失败

	 window.alert("创建XMLHttp对象失败！");

	 return false;

	}

xmlObj.onreadystatechange= function() {

                    if (xmlObj.readyState == 4) {

                        if (xmlObj.status == 200) {

                           document.getElementById(div).innerHTML=xmlObj.responseText;

                        }else{

							window.alert("Read data error");

                    }

                }

}



//确定发送请求方式，URL，及是否同步执行下段代码

    xmlObj.open("GET",url,true);

	xmlObj.send(null);

}










//下拉框

function getoption(url){//url是网址

var ajax = createXMLHttpRequest();

ajax.open("GET", url, true);

ajax.onreadystatechange = function() {//如果执行是状态正常，那么就把返回的内容赋值给指定的地方

if (ajax.readyState == 4 && ajax.status == 200) {

	var obj = ajax.responseXML;

	var games = obj.getElementsByTagName("game");

	if(games.length>0){

		for (var i=0;i<games.length;i++) {

			var this_game_id = games[i].getElementsByTagName("this_game_id")[0].firstChild.nodeValue;

		}

	}

			

	var serverss = obj.getElementsByTagName("server");

	if(serverss.length>0){

		for (var i=0;i<serverss.length;i++) {

			var this_server_id = serverss[i].getElementsByTagName("this_server_id")[0].firstChild.nodeValue;

		}

		

	}else{

		var this_server_id = "";

	}
	if (this_server_id == "" && this_game_id != ""){

		var properties = obj.getElementsByTagName("property");

		if (properties.length > 0) {

			document.productsform.server_id.options.length = 1;

			for (var i=0,x=1;i<properties.length;i++,x++) {

				name = properties[i].getElementsByTagName("name")[0].firstChild.nodeValue;

				value = properties[i].getElementsByTagName("value")[0].firstChild.nodeValue;

				document.productsform.server_id.options[x] = new Option();

				document.productsform.server_id.options[x].text = name;

				document.productsform.server_id.options[x].value = value;

			}

		}else{

				document.productsform.server_id.options[1] = new Option();

				document.productsform.server_id.options[1].text = "";

				document.productsform.server_id.options[1].value = "";

		}

	} 

	

	if (this_server_id != "" && this_game_id != ""){

		var gold_tables = obj.getElementsByTagName("gold_table");

		if (gold_tables.length > 0) {

			document.productsform.products_gold_id.options.length = 1;

			for (var i=0,x=1;i<gold_tables.length;i++,x++) {

				name6 = gold_tables[i].getElementsByTagName("gold_count")[0].firstChild.nodeValue;

				value6 = gold_tables[i].getElementsByTagName("gold_id")[0].firstChild.nodeValue;

				document.productsform.products_gold_id.options[x] = new Option();

				document.productsform.products_gold_id.options[x].text = name6;

				document.productsform.products_gold_id.options[x].value = value6;

			}

		} else {

			document.productsform.products_gold_id.length=0;

			document.productsform.products_gold_id.click;

			document.productsform.products_gold_id.options[0] = new Option();

			document.productsform.products_gold_id.options[0].text = "Choose the production";

			document.productsform.products_gold_id.options[0].value = "";

		}

	}
}

}

ajax.send(null);

}
//下拉框

function getoption1(url){//url是网址

var ajax = createXMLHttpRequest();

ajax.open("GET", url, true);

ajax.onreadystatechange = function() {//如果执行是状态正常，那么就把返回的内容赋值给指定的地方

if (ajax.readyState == 4 && ajax.status == 200) {

	var obj = ajax.responseXML;

	var games = obj.getElementsByTagName("game");

	if(games.length>0){

		for (var i=0;i<games.length;i++) {

			var this_game_id = games[i].getElementsByTagName("this_game_id")[0].firstChild.nodeValue;

		}

	}

			

	var serverss = obj.getElementsByTagName("server");

	if(serverss.length>0){

		for (var i=0;i<serverss.length;i++) {

			var this_server_id = serverss[i].getElementsByTagName("this_server_id")[0].firstChild.nodeValue;

		}

		

	}else{

		var this_server_id = "";

	}

	

	

	if (this_server_id == "" && this_game_id != ""){

		var properties = obj.getElementsByTagName("property");

		if (properties.length > 0) {

			document.right.server_id.options.length = 1;

			for (var i=0,x=1;i<properties.length;i++,x++) {

				name = properties[i].getElementsByTagName("name")[0].firstChild.nodeValue;

				value = properties[i].getElementsByTagName("value")[0].firstChild.nodeValue;

				document.right.server_id.options[x] = new Option();

				document.right.server_id.options[x].text = name;

				document.right.server_id.options[x].value = value;

			}

		}else{

				document.right.server_id.options[1] = new Option();

				document.right.server_id.options[1].text = "";

				document.right.server_id.options[1].value = "";



		}

	} 

	

	if (this_server_id != "" && this_game_id != ""){

		var gold_tables = obj.getElementsByTagName("gold_table");

		if (gold_tables.length > 0) {

			document.right.products_gold_id.options.length = 1;

			for (var i=0,x=1;i<gold_tables.length;i++,x++) {

				name6 = gold_tables[i].getElementsByTagName("gold_count")[0].firstChild.nodeValue;

				value6 = gold_tables[i].getElementsByTagName("gold_id")[0].firstChild.nodeValue;

				document.right.products_gold_id.options[x] = new Option();

				document.right.products_gold_id.options[x].text = name6;

				document.right.products_gold_id.options[x].value = value6;

			}

		} else {

			document.right.products_gold_id.length=0;

			document.right.products_gold_id.click;

			document.right.products_gold_id.options[0] = new Option();

			document.right.products_gold_id.options[0].text = "Choose the production";

			document.right.products_gold_id.options[0].value = "";

		}

	}

	

	

	

}

}

ajax.send(null);

}


