function seo_string(field_name,str,dirlist,dirchk)
{
	dir_pat=RegExp("^("+dirlist.replace(/,/g,"|")+")$","i");
	dir_str=dirlist.replace(/,/g,", ");
	if(str.match(/^[^a-zA-Z]|[^a-zA-Z0-9_\-]|[^a-zA-Z]$/))
		return (field_name+" must begin and end with an alphabet and can contain only alphanumeric, underscore and hypen characters");
	else if(dirchk==true && str.match(dir_pat) )
		return ("This value of "+field_name+" is not allowed. Try appending /removing some characters to the value");
	else
		return false;	
}

function seo_dircompare(arr)
{
	for(i=0;i<arr.length;i++)
	{	
		str1=RegExp(arr[i],"i");
		for(j=i+1;j<arr.length;j++)
		{
			str2=RegExp(arr[j],"i");
			if(arr[i].match(str2) || arr[j].match(str1))
				return ("Value must not be substring of other_"+j);
		}	
	}
	return false;	
}

function sbconvert_toseo(title,seo)
{
	a=title.value.replace(/^[^a-zA-Z]+/,"");
	a=a.replace(/[^a-zA-Z0-9_\-]+/g,"_");
	a=a.replace(/[^a-zA-Z]+$/,"");
	seo.value=a;
}