function GetXmlHttpObject()
{ 
	var objXMLHttp=null;
	if (window.XMLHttpRequest)
		objXMLHttp=new XMLHttpRequest();
	else if (window.ActiveXObject)
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");

	return objXMLHttp;
}

function MyTrim(str)
{
	while(str.charAt(0) == (" ") )
		str = str.substring(1);

	while(str.charAt(str.length-1) == " " )
		str = str.substring(0,str.length-1);

	return str;
}


function SendMessageForm()
{
if (MyTrim(document.frm_SendMessage.QuerySubject.value) == "")
	{
		alert ("Please Enter a Subject of Your Query");
		document.frm_SendMessage.QuerySubject.focus();
		return 0;
	}
if (MyTrim(document.frm_SendMessage.BusinessQuery.value) == "")
	{
		alert ("Please Enter a Value for Your Query");
		document.frm_SendMessage.BusinessQuery.focus();
		return 0;
	}
if (MyTrim(document.frm_SendMessage.VerificationCode.value) == "")
	{
		alert ("Enter the Verify Code shown on Image.");
		document.frm_SendMessage.VerificationCode.focus();
		return 0;
	}

		document.frm_SendMessage.submit();
		return true;
}

function Check_Search()
{
	if (MyTrim(document.frm_Search.q.value) == "")
	{
	alert ("Please Enter Something To Search...");
	document.frm_Search.q.focus();
	return false;
	}
	if (MyTrim(document.frm_Search.SearchWhat.value) == "TradeOffersSell")
	{
	alert ("OOps Sorry Trade Leads are under Process Please Wait Some Time...");
	document.frm_Search.SearchWhat.focus();
	return false;
	}
	if (MyTrim(document.frm_Search.SearchWhat.value) == "TradeOffersBuy")
	{
	alert ("OOps Sorry Trade Leads are under Process Please Wait Some Time...");
	document.frm_Search.SearchWhat.focus();
	return false;
	}

	
	if (document.frm_Search.SearchType[0].checked == true)
		document.location="http://www.punjabb2b.com/search/All/" + document.frm_Search.SearchWhat.value +"/" + document.frm_Search.q.value +"/0.html";
	else if (document.frm_Search.SearchType[1].checked == true)
		document.location="http://www.punjabb2b.com/search/Any/" + document.frm_Search.SearchWhat.value +"/" + document.frm_Search.q.value +"/0.html";

	return true;
}
