function tglfrm(d) {
	if (d == 'a') { 
		udc(icobs_a)
	}
	else {
		udc(icobs_s)
	}
}

function tglsimt(d) {
	if (d == 'w') {
		document.getElementById('fw').className = 'fws'
		document.getElementById('fc').className = 'fc'
	}
	else {
		document.getElementById('fw').className = 'fw'
		document.getElementById('fc').className = 'fcs'
	}
	document.getElementById('singletemp').value = d
}

function correct(cor,locid) {
	if (cor =='y'){
		px('/User/Correct/?cor=y&loc='+locid,'cory')
	}
	else {
		udc(icobs)
	}
}

function udc(msg) {
	document.getElementById('crc').innerHTML = msg
}

function corn() {
	var url = '/User/Correct/?cor=n'
	var theForm = document.forms[0]
	for(i=0; i<theForm.elements.length; i++){url = url + '&' + theForm.elements[i].name + '=' + theForm.elements[i].value}
	px(url,'corn')
}

function px(url,op) {
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = prc(op);
        req.open("GET", url, true);
        req.send(null);
    } else if (window.ActiveXObject) {
        isIE = true;
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = prc(op);
            req.open("GET", url, true);
            req.send();
        }
    }
}

function prc(op) {
	switch(op){
		case 'cory': {
			udc('<p>Good stuff! Thanks for filling us in.</p>')
			break 
		}
		case 'corn': {
			udc('<p>Cracking, thanks for correcting us!</p>')
			break 
		}
	}
}