<!--
function gotoStep(formId,nstep){
	var frm = document.getElementById(formId);
	if(frm){
		var hdn=document.getElementById('jumpToStep');
		if(hdn){
			hdn.value=nstep;
			needConfirm=false;
			frm.submit();
		}
	}
}
/* Update totals - ajax scripts */
var url = "/scripts/updateTotals.php"; // The server-side script

function handleHttpResponse()
{
//
//	the server side ajax script returns the total co2 and total dollar savings
//  separated by a space. Retrieve those values
//
	var results = undefined;

	if (http.readyState == 4)
	{

		// Split the comma delimited response into an array
		results = http.responseText.split(" ");

	//	if (results.indexOf("undefined") < 0)
	//	{
			// if the results don't contain "undefined"

			document.getElementById("total-savings-span").innerHTML = results[0];
			document.getElementById("dollar-savings-span").innerHTML = results[1];
	//	}
	}
}

function updateTotals()
{
	http.open("GET", url, true);
	http.onreadystatechange = handleHttpResponse;
	http.send(null);
	setTimeout(function(){updateTotals()}, 60000)
}

function getHTTPObject()
{
	var xmlhttp;

	/*@cc_on

	@if (@_jscript_version >= 5)
		try
		{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (E)
			{
				xmlhttp = false;
			}
		}
	@else
		xmlhttp = false;
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest != "undefined" )
	{
		try
		{
			xmlhttp = new XMLHttpRequest();
		}
		catch (e)
		{
			xmlhttp = false;
		}
	}

	return xmlhttp;
}

var http = getHTTPObject(); // We create the HTTP Object



/* Dreamweaver functions */

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


/* Disable enter/return to submit forms */
function noenter(event) {
	var el=Event.element(event);

	if(event &&event.keyCode == Event.KEY_RETURN){
		Event.stop(event);
	}
}


/* Hide email addresses */
function hideEmail(name,domain,text){
	if (text == '') { text=name+'@'+domain; }
	var a="<a href='mailto:";
	var b=name+"@"+domain+"' class='linkEmail'>";
	var c=text;
	var d="</a>";
	document.write(a+b+c+d);
}

/* Scrub numbers of invalid characters */
function scrubNumbers(field,acceptedChars) {
//	alert('field: ' + field);

	var alertPopup = false;
	var field = document.getElementById(field);
//	if(!field.value){
//		alert(field.id+' : '+field.value);
//		field.value="0";
//
//
//	}
//	if(field){
		var newValue = new String();
		//var acceptedChars = "0123456789";
		var chars = field.value.split("");
		for (i = 0; i < chars.length; i++) {
			if (acceptedChars.indexOf(chars[i]) != -1) {
				newValue += chars[i];
			} else {
				 alertPopup = true;
			}
		}
		if (alertPopup==true) {
			alert(TXT_PLEASE_USE_THESE_CHARS + acceptedChars);
		}
		if (field.value != newValue) field.value = newValue;
		return newValue;
//	}
	return 0;
}

/* Simple show/hide div function */
function divDisplay(divName,displayStyle) {
	document.getElementById(divName).style.display=displayStyle;
	return false;
}

/* Simple back button function */
function goBack() {
	history.go(-1);
	return false;
}

/* Challenge back button function - fixes re-posting data alert */
function challengeGoBack(step) {
	window.location="/challenge/post_data/step" + step + ".php";
}

/* businessChallenge back button function - fixes re-posting data alert */
function businessChallengeGoBack(step) {
	window.location="/businesses/signup/post_data/step" + step + ".php";
}

function fixNaN(number,defVal){
	if(isNaN(number)){
		return defVal;
	}
	return number;
}

function showHide(elem,stateValueElem){
	var e = $(elem);

	if(e&&e.style){
		if($(stateValueElem).checked){
			new Effect.SlideDown(e,{duration:0.5});
		}else{
			new Effect.SlideUp(e,{duration:0.5});
		}
	}

}
function clearForm(formId){
	var form=$(formId);

	var inputs = form.getElementsByTagName('input');
	for(i in inputs){
		var inp=inputs[i];
		inp.value="";
		inp.checked=false;
		inp.selected=false;
	}
}

/*Event.observe(window,'load',slideUps);

function slideUps(){
	new Effect.SlideUp('indirect_calc');
}
*/
//-->
