var options = "";
function sendToSelection(options)
{
		if(options) {
	        var state = document.getElementById("stateselect1");
	        var city = document.getElementById("cityselect1");
	        var stateindex = document.getElementById("stateselect1").selectedIndex;
	        var cityindex = document.getElementById("cityselect1").selectedIndex;
		} else {
	        var state = document.getElementById("stateselect");
	        var city = document.getElementById("cityselect");
	        var stateindex = document.getElementById("stateselect").selectedIndex;
	        var cityindex = document.getElementById("cityselect").selectedIndex;
        }
        var selectedState = state.options[stateindex].text;
        var selectedCity = city.options[cityindex].text;
        if(selectedCity == "--Select City--") return false;
        selectedState = selectedState.toLowerCase();
        selectedCity = selectedCity.toLowerCase();
        selectedState = selectedState.replace(" ","");
        selectedCity = selectedCity.replace(" ","");
        selectedState = selectedState.replace(".","");
        selectedCity = selectedCity.replace(".","");
        
       	var addOn = "";
       	
        if(options) {
	        options = options.split(",");
	        if(options[0] == "sponsor.php") {
	        addOn = "/"+options[0];
	        } else if(options[0] == "contribute.php") {
	        addOn = "/"+options[0];
	        } else if(options[0] == "suggest.php") {
	        addOn = "/"+options[0];
	        }
        }
        var nlocation = "http://"+selectedCity+"."+selectedState+"blogpage.com"+addOn;
        window.location = nlocation;
}


function textCounter(field,cntfield,maxlimit) {

if (field.value.length > maxlimit) // if too long...trim it!

field.value = field.value.substring(0, maxlimit);

// otherwise, update 'characters left' counter

else

cntfield.value = maxlimit - field.value.length;

}

function checkContactCaptcha(value) {
	var callback = function(result) { document.email.submit.disabled = (result != 1); document.getElementById("captchaGood").style.display = (result== 1?"block":"none"); document.getElementById("captchaBad").style.display = (result!= 1?"block":"none");}
    HTML_AJAX.grab('/common/captchaRequest.php?captcha='+value, callback);
}
function checkJobsCaptcha(value) {
	var callback = function(result) { document.jobs.submit.disabled = (result != 1); document.getElementById("captchaGood").style.display = (result== 1?"block":"none"); document.getElementById("captchaBad").style.display = (result!= 1?"block":"none");}
    HTML_AJAX.grab('/common/captchaRequest.php?captcha='+value, callback);
}