rowTextURL = "http://www.google.com/search?q=";
ChinaTextURL = "http://www.google.cn/search?q=";
rowImageURL = "http://images.google.com/images?q=";
ChinaImageURL = "http://images.google.cn/images?q=";

function doTextSearch()

{

	return doSearch1(rowTextURL, ChinaTextURL);

}

function doImageSearch()

{

	return doSearch1(rowImageURL, ChinaImageURL);

}

function doSearch1(rowURL, ChinaURL)

{

	var q;
	
	q = trim(document.forms.inputForm.q.value);
	if(q == "")
		return false;
	q = escape(q);
	parent.frames[1].location.href = rowURL + q;
	parent.frames[2].location.href = ChinaURL + q;
	return false;

}

function trim(str)

{

	return (str + "").replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1");

}

function doImageSwitch()

{

	parent.location.href = "imagesearch.htm?" + trim(document.forms.inputForm.q.value);
	return false;

}

function doTextSwitch()

{

	parent.location.href = "textsearch.htm?" + trim(document.forms.inputForm.q.value);
	return false;

}

