function CheckDataSearch(Form)
{
	var str='';
	Form.ss.value = Form.ss.value.replace(/^\s+/g, '').replace(/\s+$/g, '');
	Form.ss.value = Form.ss.value.replace(/[^a-zA-Z0-9+ ]/g, ' ');
	if (Form.ss.value.length < 3)
	{
		alert("Enter at least three characters for search.");
		Form.ss.focus();
		return false;
	}
	else
	{
		if(Form.searchfor.value == "comp")
                {
			var str1 = Form.ss.value.replace(/\+/g, ' ');
			str1 = escape(str1.replace(/\s+/g, '+'));
                        str +='ss='+str1;

			str = "http://dir.indiamart.com/cgi/compcatsearch.mp?"+str;
			str = myReplace(str,"\\\\?\\\\&","?");
			window.location = str;
			return false;
                }
                else if(Form.searchfor.value == "product")
                {
			var str2 = Form.ss.value.replace(/\+/g, ' ');
			str2 = escape(str2.replace(/\s+/g, '+'));
                        str +='ss='+str2;

			str = "http://catalogs.indiamart.com/cgi/catprdsearch.mp?"+str;
			str = myReplace(str,"\\\\?\\\\&","?");
			window.location = str;
			return false;
                }
                else if(Form.searchfor.value == "offer")
                {
			var str3 = Form.ss.value.replace(/\+/g, ' ');
			str3 = escape(str3.replace(/\s+/g, '+'));
                        str +='search='+str3;

			str = "http://trade.indiamart.com/search.mp?"+str;
			str = myReplace(str,"\\\\?\\\\&","?");
			window.location = str;
			return false;
                }
		else if(Form.searchfor.value == "tenders")
		{
			var str4 = Form.ss.value.replace(/\+/g, ' ');
			str4 = escape(str4.replace(/\s+/g, '+'));
			str4 = str4.toLowerCase();
			str +='ss='+str4;

// 			str += '&searchfor='+Form.searchfor.value;
// 			str +='&modid=TDR';
// 			str +='&cr=td';
// 			str +='&sr=1';

			str = "http://tenders.indiamart.com/search.cgi?"+str;
			str = myReplace(str,"\\\\?\\\\&","?");
			window.location = str;
			return false;
		}
	}
}

function myReplace(str, a, b) {
	var re = new RegExp(a, "g");
	var ret = str.replace(re,b);
	return ret;
}