function reload(dir, orderBy, direction)
{
	if (dir == '') {
		dir = url_site;
	}
	
	div = document.getElementById('weblinks');
	div.innerHTML = '';
	div1 = document.createElement('div');
	div1.innerHTML = 'Searching ... <br />';
	div1.setAttribute('style', 'width: 100%; margin-top: 15px;');
	div1.setAttribute('align', 'center');
	img = document.createElement('img');
	src = dir + 'images/ajax-loader.gif';
	img.setAttribute('src', src);
	div1.appendChild(img);
	div.appendChild(div1);
	
	/*
	var checkboxes = document.getElementsByTagName('input');
	var features = '';
	for (i = 0; i < checkboxes.length; i++) {
		if (checkboxes[i].checked == true) {
			features += '&features[]=' + checkboxes[i].name;
		}
	}
	*/
	
	var categoryId = document.getElementById('category').value;
	xmlHttp = GetXmlHttpObject();
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	}
	
	var country = document.getElementById("country").value;
	
	var url = dir + 'index.php?action=links_ajaxGetLinks&orderBy=' + orderBy + '&dir=' + direction + '&categoryId=' + categoryId + '&country=' + country;
	
	
	xmlHttp.onreadystatechange = function () {
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			div.innerHTML = xmlHttp.responseText;
			var wrapper = $(div);
			wrapper.find("a.mb").colorbox({
				iframe: true,
		        innerWidth: 600,
		        innerHeight: 400
			});
		}
	};
	xmlHttp.open("GET", url, true);
	xmlHttp.send(null);
}

function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	 {
	 // Firefox, Opera 8.0+, Safari
	 	xmlHttp=new XMLHttpRequest();
	 }
	catch (e)
	 {
	 //Internet Explorer
	 try
	  {
	 	 xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	  }
	 catch (e)
	  {
	 	 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	 }
	return xmlHttp;
}

function checkValues()
{
	var b = true;

	var title = document.getElementById('title');
	var url = document.getElementById('url');
	var country = document.getElementById('cntr');

	if (country.value == '') {
		alert('请选择一个国家。');
		return false; 
	} else if (title.value == '') {
		alert('请填写题目');
		return false;
	} else if (url.value == '') {
		alert('请填写链接地址。');
		return false;
	}
	return true;
}


