function memb_login()
{
	if(document.f1.lgname.value=="")
		{
		alert("Please Enter Your Login Name");
		document.f1.lgname.focus();
		return;
		}
	if(document.f1.psword.value=="")
		{
		alert("Please Enter Password");
		document.f1.psword.focus();
		return;
		}
	document.f1.action="http://ntserver/yellowpages/reghere/default1.asp";
	document.f1.submit();

}

function trimed(trimstring)
{
	startcounter = 0;
	for(i=0; i < trimstring.length; i++)
	{ 
	//alert(trimstring.charAt(i));
		if(trimstring.charAt(i) == " ") 
			++startcounter;
		else
			break;
				   
	}

	endcounter = trimstring.length;
	for(i=(trimstring.length-1); i > 0; i--)
	{ 
	//alert(trimstring.charAt(i));
	   if(trimstring.charAt(i) == " ") 
			--endcounter;
		else
			break;
				   
    }
	
	trimmedstring = trimstring.substring(startcounter, endcounter);
	if(endcounter <= startcounter)
	{
		trimmedstring = "";
	}
	
	return trimmedstring;
}

function cat()
{	

	document.f2.ok.value="cat";
	j=document.f2.category.selectedIndex;
	//alert(j);
	if (j==0)
	{
		alert("Please select a category");
		return;	
	}

	document.f2.action="./result/output.asp";
	document.f2.submit();
}
function service()
{
	document.f2.ok.value="serv";
	//alert("in service");
	s1=document.f2.service.value;
	
	if (s1.length<=2)
	{
		alert("Enter atleast 3 characters");
		document.f2.service.value="";
		document.f2.service.focus();
		return;
	}
	if(trimed(document.f2.service.value)=="")
	{
		alert("Enter Product/Service ");
		document.f2.service.value="";
		document.f2.service.focus();
	}
	else
	{
		document.f2.action="./result/output.asp";
		document.f2.submit();	
	}
}
function company1()
{

	if(document.f2.rd1[0].checked)
	{
		document.f2.ok.value="comp";
		s1=document.f2.company.value;
				
		if(trimed(document.f2.company.value)=="")
		{
			alert("Enter Company Name");
			document.f2.company.value="";
			document.f2.company.focus();

		}
		else
		{
			document.f2.action="./result/output.asp";
			document.f2.submit();	
		}
	}
	if(document.f2.rd1[1].checked)
	{

		document.f2.ok.value="contc";
									
		if(trimed(document.f2.company.value)=="")
		{
			alert("Enter Contact Person Name");
			document.f2.company.value="";
			document.f2.company.focus();
		}
		else
		{
			document.f2.action="./result/output.asp";
			document.f2.submit();	
		}
	}
}

function jobsearch1()
{

// if (document.f2.jobcatg.selectedIndex < 0)
//  {
//    alert("Please select one of the \"Job Category\" options.");
//    document.f2.jobcatg.focus();
//    return (false);
//  }

//  if (document.f2.postinglocation.selectedIndex < 0)
//  {
//    alert("Please select one of the \"Place of Posting\" options.");
//    document.f2.postinglocation.focus();
//    
//  }

//  if (document.f2.exp.selectedIndex < 0)
//  {
//    alert("Please select one of the \"Experience\" options.");
//    document.f2.exp.focus();
//    
//  }

//  if (document.f2.salary.selectedIndex < 0)
//  {
//    alert("Please select one of the \"Salary\" options.");
//    document.f2.salary.focus();
//    
//  }
  document.f2.submit();
  
}


function dispcat()
{
	
	i=document.f2.catalpha.selectedIndex;
	ch=document.f2.catalpha.options[i].value;
	if (ch=="")
	{
		alert("Please select an alphabet");
		return;
	}
	document.f2.action="default1.asp";
	document.f2.submit();
}

function replaceSpaces(str)
{

	var str_with_spaces=str ;	
	var tempstr="";	
	for (var i=0;i<str_with_spaces.length;i++)
	{
		var s=str_with_spaces.charAt(i);
		if(s==" ")
		tempstr=tempstr+"+";
		else
		{
		tempstr=tempstr+s;
		}
	}
	return tempstr;
}

function winopen()
{
	window.open('sendpage.asp','','width=300,height=250')
}