
//for search page....
function CheckDataSearch(Form)
{
	var str='';
	Form.ss.value = Form.ss.value.replace(/^\s+/g, '').replace(/\s+$/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")
                {
			str +='ss='+escape(Form.ss.value);
			//str += '&searchfor='+Form.searchfor.value;
			str += '&modid=SII';

			str = "http://dir.indiamart.com/cgi/compcatsearch.mp?"+str;
			str = myReplace(str,"\\\\?\\\\&","?");

			window.location = str;
			return false;
                }
                else if(Form.searchfor.value == "product")
                {
			str +='ss='+escape(Form.ss.value);
			//str += '&searchfor='+Form.searchfor.value;
			//str +='&modid=CTL';

			str = "http://catalogs.indiamart.com/cgi/catprdsearch.mp?"+str;
			str = myReplace(str,"\\\\?\\\\&","?");

			window.location = str;
			return false;
                }
                else if(Form.searchfor.value == "offer")
                {
			str +='search='+escape(Form.ss.value);
			//str += '&searchfor='+Form.searchfor.value;
			//str +='&modid=ETO';
			
			str = "http://trade.indiamart.com/search.mp?"+str;
			str = myReplace(str,"\\\\?\\\\&","?");

			window.location = str;
			return false;
                }
		else if(Form.searchfor.value == "tenders")
		{
			str +='ss='+escape(Form.ss.value);
			str += '&searchfor='+Form.searchfor.value;
			str +='&modid=TDR';
			str +='&cr=td';
			str +='&sr=1';

			str = "http://tenders.indiamart.com/tenders-search.pl?"+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;
}
//end of serach


//for login check...
function Check_Login()
{

	if(document.loginform.usr_name.value == "" ) {
	alert("Kindly enter your User Name/E-mail ID.");
	document.loginform.usr_name.focus();
	return false;
	}
	else if(document.loginform.usr_name.value.length < 4) {
	alert("The User Name should be atleast 4 characters long.");
	document.loginform.usr_name.focus();
	return false;
	}
	else if(document.loginform.usr_pass.value == "" ) {
	alert("Kindly enter your Password.");
	document.loginform.usr_pass.focus();
	return false;
	}
	else if(document.loginform.usr_pass.value.length < 4) {
	alert("The Password should be atleast 4 characters long.");
	document.loginform.usr_pass.focus();
	return false;
	}
	else {
	return true;
	}

}
//end of login check

//email validations
function validateit(theForm)
{
	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(theForm.email.value)))
	{
		alert("Invalid Email ID. Kindly enter the correct ID.");
		theForm.email.focus();
		return (false);
	}
}

function getblank(this1)  {
	if (this1.value = "Your Email Here.") {
		this1.value = "";
	}
    return true;
}
//end of email
