function getXMLHTTPRequest() 
{ 
	/*var xRequest=null; 
	if (window.XMLHttpRequest) 
	{ 
		xRequest=new XMLHttpRequest(); 
	} 
	else if (typeof ActiveXObject != "undefined") 
	{ 
		xRequest=new ActiveXObject("Microsoft.XMLHTTP"); 
	}
	return xRequest; */
	var ajax=false;
	try {
		ajax = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			ajax = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			ajax = false;
		}
	}
	if (!ajax && typeof XMLHttpRequest!='undefined') {
		ajax = new XMLHttpRequest();
	}
	return ajax;
} 

function createQueryString(){
	return Typeid
}


function Getschinfo(url) 
{
	var keywords = document.getElementById("skeywords").value;
	//if(getLangCookie() == 1){
	keywords = Tran_text(keywords);
		
	//}	
	keywords=encodeURI(keywords);
	if(keywords=="%E9%97%9C%E9%8D%B5%E5%AD%97%E6%90%9C%E5%B0%8B")
	{
		alert("Please enter some keywords!");
		return false;
	}

	var Type="0";
	if (document.getElementById("search_male").checked) 
	{
		Type="1";
	}else if(document.getElementById("search_female").checked)
	{
		Type="2";
	}else if(document.getElementById("search_nomale").checked)
	{
		Type="3";
	}else if(document.getElementById("search_name").checked)
	{ 
		Type="4";
	}

	url=url+"?type="+Type+"&kw="+keywords;
	window.location.href=url;
}


function GetTopschinfo(url) 
{
	var keywords=encodeURI(document.getElementById("topkeywords").value);

	if(keywords=="%E9%97%9C%E9%8D%B5%E5%AD%97%E6%90%9C%E5%B0%8B")
	{
		alert("Please enter some keywords!");
		return false;
	}
	
	url=url+"?q="+keywords;
	window.location.href=url;
}

// open a new window to show baidu
// url: which to encode the keywords file
function GetschinfobyBaidu(url) 
{
	var type=0;
	var sch= document.getElementsByName("sch1");
	
	for(var i=0;i<sch.length;i++)  
	{  
		if(sch[i].checked)
			type=sch[i].value;  
	}  

	var keywords= document.getElementById("skeywords").value;
    keywords=encodeURI(keywords);
	if(keywords=="%E9%97%9C%E9%8D%B5%E5%AD%97%E6%90%9C%E5%B0%8B")
	{
		alert("Please enter some keywords!");
		return false;
	}
	
	AjaxObj = getXMLHTTPRequest(); 
	AjaxObj.onreadystatechange = evtprocessRequest; 
	
	url=url+"?text="+ keywords+"&type="+type;
	AjaxObj.open("GET",url,true); 
	AjaxObj.setRequestHeader('Content-type','application/x-www-form-urlencoded'); 
	//AjaxObj.setRequestHeader("Content-Type","text/xml");
	AjaxObj.send(null); 
}

// Change the color of current search type
function ChangeColor(schid) 
{
	for(var i=1;i<5;i++)
	{
		var sid = document.getElementById("shd"+i);
		if(i==schid)
		{
			sid.style.color="#FF9900";
		}
		else
		{
			sid.style.color="#FFFFFF";
		}
	}	
}

// get keywords encode value
function evtprocessRequest() 
{ 
	if(AjaxObj.readyState == 4) 
	{ 
		if(AjaxObj.status == 200) 
		{ 
			if(AjaxObj.responseText != "") 
			{
				//var url="http://www.baidu.com/s?wd="+AjaxObj.responseText;
				document.location.href = (AjaxObj.responseText);
			} 
		} 
		else 
		{ 
		alert(AjaxObj.status);
			alert("您所请求的页面有异常。");
		} 
	} 
	else 
	{ 

	} 
} 
