function opennewwindow(type) {
	var obj = document.getElementById('inputformq');
	var q = encodeURI(obj.value);
	var url = '';
	var urlself = '';
	switch(type) {
		case 'video':
			url = 'http://search.cctv.com/prosearch.php';
			urlself = 'searchindex.html';
			break;
		case 'web':
			url = 'http://search.cctv.com/websearch.php';
			urlself = 'searchweb.html';
			break;
		case 'news':
			url = 'http://search.cctv.com/news.php';
			urlself = 'searchnews.html';
			break;
		case 'img':
			url = 'http://search.cctv.com/imgsearch.php';
			urlself = 'searchimg.html';
			break;
		case 'blog':
			url = 'http://search.cctv.com/blog.php';
			urlself = 'searchblog.html';
			break;
		default:
			url = 'http://search.cctv.com/prosearch.php';
			urlself = 'searchindex.html';
	}
	var openwin = '';
	if(q != '') {
		openwin = open(url + '?q=' + q, "_blank", "");
	}
	var openwinself = open(urlself + '?q=' + q, "_self", "");
}
function getquery(qname) {
	var querystring = document.location.href.substring(document.location.href.indexOf('?')+1);
	qarray = querystring.split('&');
	for(var i=0; i < qarray.length; i++) {
		if(qarray[i].indexOf(qname+'=') == 0) {
			return qarray[i].substring(qname.length+1);
		}
	}
	return '';
}