function replaceChars(entry) {
out = " "; // replace this
add = "+"; // with this
temp = "" + entry; // temporary holder

while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add + 
temp.substring((pos + out.length), temp.length));
}
return temp;
}


function ErrorCheckSubmit(){

var strcity;

strcity = 'test';


var i;
for(i=document.theform.tempcity.length-1;i>=0;i--)
{
if(document.theform.tempcity[i].selected)
strcity = strcity + ', ' + replaceChars(document.theform.tempcity[i].value);
}



//if strcity has test in it, we clear string...  search all cities
if(document.theform.tempcity[0].selected) {
strcity = '';
}

document.theform.city.value = strcity;


//alert(document.theform.city.value);
document.theform.submit();
}


        function Mid(str, start, len)

        {
                // Make sure start and len are within proper bounds
                if (start < 0 || len < 0) return "";

                var iEnd, iLen = String(str).length;
                if (start + len > iLen)
                        iEnd = iLen;
                else
                        iEnd = start + len;

                return String(str).substring(start,iEnd);
        }




        function Len(str)

        {  return String(str).length;  }




function InStr(strSearch, charSearchFor)

{
	for (i=0; i < Len(strSearch); i++)
	{
	    if (charSearchFor == Mid(strSearch, i, 1))
	    {
			return i;
	    }
	}
	return -1;
}

objects = document.getElementsByTagName("object");
for (var i = 0; i < objects.length; i++)
{
objects[i].outerHTML = objects[i].outerHTML;
}


