function xmlDecode(str){
	str=str.replace(/stmzxyh/g,">");
	str=str.replace(/stmzdyh/g,"<");
	return str;
}

function createRequest(){
	if(typeof XMLHttpRequest!="undefined"){
		return new XMLHttpRequest();
	}
	else if(typeof ActiveXObject!="undefined"){
		var xmlHttp_ver  = false;
		var xmlHttp_vers =["MSXML2.XmlHttp.5.0","MSXML2.XmlHttp.4.0","MSXML2.XmlHttp.3.0","MSXML2.XmlHttp","Microsoft.XmlHttp"];
		if(!xmlHttp_ver){
			for(var i=0;i<xmlHttp_vers.length;i++){
				try{
					new ActiveXObject(xmlHttp_vers[i]);
					xmlHttp_ver = xmlHttp_vers[i];
					break;
				}
				catch(oError){;}
			}
		}
		if(xmlHttp_ver){
			return new ActiveXObject(xmlHttp_ver);
		}
		else{
			throw new Error("Could not create XML HTTP Request.");
		}
	}
	else{
		throw new Error("Your browser doesn't support an XML HTTP Request.");
	}
}

var xmlHttp;
xmlHttp=createRequest();


var request;

function check_user_name(){
	document.getElementById("userName").className='G_59';
	var name=document.getElementById("userName").value;
	if(name==null || name==""){
		return;
	}
	name=(encodeURI(name));
	var url="/ajax/AjaxCheckUserName?userName="+name+"&time="+(new Date()).getTime();
	if(xmlHttp){
		xmlHttp.open("GET",url,true);
		xmlHttp.onreadystatechange=check_user_name_result;
		xmlHttp.send(null);
	}
}

function check_user_name_result(){
	if(xmlHttp.readyState==4){
		if(xmlHttp.status==200){
			var xml=xmlHttp.responseXML;
			var status=xml.getElementsByTagName("status")[0].firstChild.nodeValue;
			user_name_ok=0;
			if(status=="1"){
				user_name_ok=1;
				document.getElementById("user_name_ok").style.display="";
				document.getElementById("user_name_exist").style.display="none";
				document.getElementById("user_name_error").style.display="none";
			}
			else if(status=="0"){
				user_name_ok=0;
				document.getElementById("user_name_ok").style.display="none";
				document.getElementById("user_name_exist").style.display="";
				document.getElementById("user_name_error").style.display="none";
			}
			else if(status=="2"){
				user_name_ok=0;
				document.getElementById("user_name_ok").style.display="none";
				document.getElementById("user_name_exist").style.display="none";
				document.getElementById("user_name_error").style.display="";
			}
		}
	}
}


function check_user_email(){
	document.getElementById("email").className='G_59';
	var email=document.getElementById("email").value;
	if(email==null || email==""){
		return;
	}
	email=(encodeURI(email));
	var url="/ajax/AjaxCheckUserEmail?email="+email+"&time="+(new Date()).getTime();
	if(xmlHttp){
		xmlHttp.open("GET",url,true);
		xmlHttp.onreadystatechange=check_user_email_result;
		xmlHttp.send(null);
	}
}

function check_user_email_result(){
	if(xmlHttp.readyState==4){
		if(xmlHttp.status==200){
			var xml=xmlHttp.responseXML;
			var status=xml.getElementsByTagName("status")[0].firstChild.nodeValue;
			user_email_ok=0;
			if(status=="1"){
				user_email_ok=1;
				document.getElementById("msg_6").innerHTML = "";
			}
			else if(status=="0"){
				user_email_ok=0;
				document.getElementById("msg_6").innerHTML = getOtherLanguage(13);
			}
		}
	}
}



function check_user_email_edit(){
	document.getElementById("email").className='G_59';
	var email=document.getElementById("email").value;
	if(email==null || email==""){
		return;
	}
	email=(encodeURI(email));
	var url="/ajax/AjaxCheckUserEmail?email="+email+"&time="+(new Date()).getTime();
	if(xmlHttp){
		xmlHttp.open("GET",url,true);
		xmlHttp.onreadystatechange=check_user_email_edit_result;
		xmlHttp.send(null);
	}
}

function check_user_email_edit_result(){
	if(xmlHttp.readyState==4){
		if(xmlHttp.status==200){
			var xml=xmlHttp.responseXML;
			var status=xml.getElementsByTagName("status")[0].firstChild.nodeValue;
			user_email_ok=0;
			if(status=="1"){
				user_email_ok=1;
				document.getElementById("msg_4").innerHTML = "";
			}
			else if(status=="0"){
				user_email_ok=0;
				document.getElementById("msg_4").innerHTML = getOtherLanguage(13);
			}
		}
	}
}


/*=======================================================================================*/
var global_pre_element_id="";
var global_layer=2;
var xmlDoc;
var classifyId = 0;
var property = "";
var object ;
var propertyLanguage;
var propertyIds = new Array();
/**会员中心产品编辑 和添加*/
function get_children_classify_list(o,pre_element_id,layer,languageHobby){
	if(o==null){
		return;
	}
	propertyLanguage = languageHobby;
	object = o;
	global_pre_element_id=pre_element_id;
	global_layer=layer;
	var selectedIndex = object.selectedIndex;
	var id = object.options[selectedIndex].value;
	url="/ajax/AjaxGetChildrenClassifyList?classifyId="+id+"&time="+(new Date()).getTime();
	if(xmlHttp){
		xmlHttp.open("GET",url,true);
		xmlHttp.onreadystatechange=get_children_classify_list_result;
		xmlHttp.send(null);
	}
}

function get_children_classify_list_result(){
	if(xmlHttp.readyState==4){
		if(xmlHttp.status==200){
			//get classify list
			var xml=xmlHttp.responseXML;
			var classifyList=xml.getElementsByTagName("classify");
			var i=0;
			var str="";
			
			var select=null;
			var option=null;
			//clear select option
			for(i=global_layer;i<=4;i++){
				select=document.getElementById(global_pre_element_id+i);
				while(select.options.length >1) {
					select.options[1] = null;
				}
			}
			//insert select option
			select=document.getElementById(global_pre_element_id+global_layer);
			for(i=0;i<classifyList.length;i++){
				option=new Option(classifyList[i].getElementsByTagName("name")[0].firstChild.nodeValue, classifyList[i].getElementsByTagName("id")[0].firstChild.nodeValue);
					option.title = classifyList[i].getElementsByTagName("property")[0].firstChild.nodeValue;
				select.options[i+1]=option;
			}
			typeChange(object);
		}
	}
}
/*=======================================================================================*/
/**会员中心产品编辑 和添加*/
function get_children_classify_list_search(o,pre_element_id,layer,languageHobby){
	if(o==null){
		return;
	}
	propertyLanguage = languageHobby;
	object = o;
	global_pre_element_id=pre_element_id;
	global_layer=layer;
	var selectedIndex = object.selectedIndex;
	var id = object.options[selectedIndex].value;
	url="/ajax/AjaxGetChildrenClassifyList?classifyId="+id+"&time="+(new Date()).getTime();
	if(xmlHttp){
		xmlHttp.open("GET",url,true);
		xmlHttp.onreadystatechange=get_children_classify_list_result_search;
		xmlHttp.send(null);
	}
}

function get_children_classify_list_result_search(){
	if(xmlHttp.readyState==4){
		if(xmlHttp.status==200){
			//get classify list
			var xml=xmlHttp.responseXML;
			var classifyList=xml.getElementsByTagName("classify");
			var i=0;
			var str="";
			
			var select=null;
			var option=null;
			//clear select option
			for(i=global_layer;i<=4;i++){
				select=document.getElementById(global_pre_element_id+i);
				while(select.options.length >1) {
					select.options[1] = null;
				}
			}
			//insert select option
			select=document.getElementById(global_pre_element_id+global_layer);
			for(i=0;i<classifyList.length;i++){
				option=new Option(classifyList[i].getElementsByTagName("name")[0].firstChild.nodeValue, classifyList[i].getElementsByTagName("id")[0].firstChild.nodeValue);
				select.options[i+1]=option;
			}
		}
	}
}
/*=======================================================================================*/

function handleStateChange(){
   		if(xmlHttp.readyState==4){
      		if(xmlHttp.status==200){
				xmlDoc = xmlHttp.responseXML;
				}
	 }
}
function showSub(){
	if(xmlHttp){
		xmlHttp.onreadystatechange = handleStateChange;
		xmlHttp.open("GET","/propertys.xml",true);
		xmlHttp.send(null);
	}
}
function typeChange(object){
	var selectedIndex = object.selectedIndex;
	var classifyId = object.options[selectedIndex].value;
	var property =object.options[selectedIndex].title;
	if(property!=null&&property!=""){
		var propertys = xmlDoc.getElementsByTagName("property");
		var p = document.getElementById("p");
		if(p==null)return;
		var str = "<table width='740'  cellspacing='0' cellpadding='0' border='0'>";
		p.innerHTML="";
		var numbers = property.split(",");
		propertyIds= numbers;
		for(var i=0;i<numbers.length;i++){
			for(var k=0;k<propertys.length;k++){
				var propertyId=propertys[k].getElementsByTagName("propertyId")[0].childNodes[0].nodeValue;
				if(numbers[i]==propertyId){
					var language = propertys[k].getElementsByTagName("language")[propertyLanguage].childNodes[0].nodeValue;
					var pHTML = p.innerHTML;
					str=str+"<tr><td valign='top' align='right' width='180px' style='padding: 6px 10px;' class='G_98'>"+language+":</td><td style='padding: 6px 5px;'><input type='text' size='35' id='property"+
							propertyId+"'  onfocus=this.className='G_59_1' style='width: 235px;' onblur=this.className='G_59' class='G_59' /></td></tr>";
				}
			}
		}
		p.innerHTML=str+"</table>";
	}else{
		if(document.getElementById("p")!=null)
		document.getElementById("p").innerHTML="";
	}
}
var classifyId=0;
var editLanguage=0;
function handleStateChange1(){
   		if(xmlHttp.readyState==4){
      		if(xmlHttp.status==200){
				xmlDoc = xmlHttp.responseXML;
				loadSetType(classifyId,editLanguage);
				}
	 }
}
function showSub1(id,languageHobby){
	classifyId=id;
	editLanguage = languageHobby;
	if(xmlHttp){
		xmlHttp.onreadystatechange = handleStateChange1;
		xmlHttp.open("GET","/propertys.xml",true);
		xmlHttp.send(null);
	}
}

function loadSetType(id,languageHooby){
	var classifyId = id;
	var property =document.getElementById("propertyValue").value;
	if(property!=null&&property!=""){
		var propertys = xmlDoc.getElementsByTagName("property");
		var p = document.getElementById("p");
		if(p==null){return;}
		var str = "<table width='740'  cellspacing='0' cellpadding='0' border='0'>";
		p.innerHTML="";
		var numbers = property.split(",");
		var propertyValues = document.getElementById("propertyValue").value.split("#@@#");
		propertyIds= numbers;
		for(var i=0;i<numbers.length;i++){
			for(var k=0;k<propertys.length;k++){
				var propertyId=propertys[k].getElementsByTagName("propertyId")[0].childNodes[0].nodeValue;
				
				if(numbers[i]==propertyId){
					var language = propertys[k].getElementsByTagName("language")[languageHobby].childNodes[0].nodeValue;
					var pHTML = p.innerHTML;
					str=str+"<tr><td valign='top' align='right' width='180px' style='padding: 6px 10px;' class='G_98'>"+language+":</td><td style='padding: 6px 5px;'><input type='text' size='35' id='property"+
							propertyId+"'  onfocus=this.className='G_59_1' style='width: 235px;' onblur=this.className='G_59' class='G_59' value='"+propertyValues[i]+"'/></td></tr>";
					
				}
			}
		}
		p.innerHTML=str+"</table>";
	
	}else{
		if(document.getElementById("p")!=null)
		document.getElementById("p").innerHTML="";
	}
}
function handleStateChangeInfo(){
   		if(xmlHttp.readyState==4){
      		if(xmlHttp.status==200){
				xmlDoc = xmlHttp.responseXML;
				loadSetTypeInfo(classifyId,editLanguage);
				}
	 }
}
function showSubInfo(id,languageHobby){
	classifyId=id;
	editLanguage = languageHobby;
	if(xmlHttp){
		xmlHttp.onreadystatechange = handleStateChangeInfo;
		xmlHttp.open("GET","/propertys.xml",true);
		xmlHttp.send(null);
	}
}

function loadSetTypeInfo(id,languageHooby){
	var classifyId = id;
	var property =document.getElementById("propertys").value;
	if(property!=null&&property!=""){
		var propertys = xmlDoc.getElementsByTagName("property");
		var p = document.getElementById("p");
		if(p==null){return;}
		var str="<table class='G_79' width='465' cellspacing='0' cellpadding='0' border='0'";
		p.innerHTML="";
		var numbers = property.split(",");
		var propertyValues = document.getElementById("propertyValue").value.split("#@@#");
		propertyIds= numbers;
		for(var i=0;i<numbers.length;i++){
			for(var k=0;k<propertys.length;k++){
				var propertyId=propertys[k].getElementsByTagName("propertyId")[0].childNodes[0].nodeValue;
				if(numbers[i]==propertyId){
					var language = propertys[k].getElementsByTagName("language")[languageHobby].childNodes[0].nodeValue;
					var pHTML = p.innerHTML;
					str=str+"<tr><td width='295' bgcolor='#fbfbf3' align='left' style='padding: 8px;'>"+language+"&nbsp;</td><td width='1' bgcolor='#d3dde7'/><td width='155'  align='left' style='padding: 8px;'>"+
					propertyValues[i]+"</td></tr><tr bgcolor='#d3dde7'><td height='1' colspan='3'/></tr>";
				}
			}
		}
		p.innerHTML=str;
	}else{
		if(document.getElementById("p")!=null)
		document.getElementById("p").innerHTML="";
	}
}
function set_propertyValue(){
	var i=0;
	var str="";
	if(propertyIds.length>1){
	for(i=0;i<propertyIds.length;i++){
		if(i<propertyIds.length-1){
				str+= document.getElementById("property"+propertyIds[i]).value+"#@@#";
			}else{
				str+= document.getElementById("property"+propertyIds[i]).value;
			}
		}
	}
	document.getElementById("propertyValue").value=str;
}