function search(obj)
{
	var word = obj.kw.value;
	if (word == '')
	{
		obj.kw.focus();
		return false;
	}
	else
	{
		obj.submit();
	}
}
/* set value to cookies */
setCookie = function (name, value) 
{
	date = new Date();
	date.setTime(date.getTime() + 1 * (24 * 60 * 60 * 1000));
	document.cookie = name + "=" + value + "; path=/; domain=qihoo.com; expires=" + date.toGMTString();
}
getCookie = function(name) 
{
	var search;
	search = name + "="
	offset = document.cookie.indexOf(search) 
	if (offset != -1) 
	{
		offset += search.length ;
		end = document.cookie.indexOf(";", offset) ;
		if (end == -1)
			end = document.cookie.length;
		return unescape(document.cookie.substring(offset, end));
	}
	else
	{
		return "";
	}
}
/* bbs search hidden & display content */
showContent = function()
{
	if(document.getElementById('showContentImg').src == 'http://img.qihoo.com/images/search/v2/img/but_060626.gif')
	{
		setCookie ("showcontent", 0);
		for(i=0; i < 50; i++)
		{
			elementId1 = "content_"+i;
			elementId2 = "source_"+i;
			if(document.getElementById(elementId1) == null)
				break;
			document.getElementById(elementId1).style.display='none';
			document.getElementById(elementId2).style.display='none';
		}
		document.getElementById('showContentImg').src='http://img.qihoo.com/images/search/v2/img/but_xs_060626.gif';
	}
	else
	{
		setCookie ("showcontent", 1);
		for(i=0; i < 50; i++)
		{
			elementId1 = "content_"+i;
			elementId2 = "source_"+i;
			if(document.getElementById(elementId1) == null)
				break;
			document.getElementById(elementId1).style.display='';
			document.getElementById(elementId2).style.display='';
		}
		document.getElementById('showContentImg').src='http://img.qihoo.com/images/search/v2/img/but_060626.gif';
	}
}

AutoChangeImg = function( img , size , pad)
{
	var width 	= img.width;
	var height	= img.height;
	var tmp = 0;
	if (width == 0) 
	{
		img.fireEvent("onerror");
		return;
	}
	if (width >= height)
	{
		if (width > 120)
		{
			tmp = 120 / width;
			width = 120;
			height = height * tmp;
		}
	}
	else 
	{
		if (height > 120)
		{
			tmp = 105 / height;
			height = 105;
			width = width * tmp;
		}
	}
	//alert(width+'_'+height);
	img.width 	= width;
	img.height	= height;
	var padding = (size - height) / 2;
	img.style.visibility = 'visible';
	return true;
}