function check_blur(obj, text, type) {
	if(obj.value == '')
		obj.value = text;
/*	if(type == 'password') {
		var o=document.createElement("INPUT");
		o.type='text';
		o.className = obj.className;
		o.onfocus=obj.onfocus;
		o.onblur=obj.onblur;
		o.name=obj.name;
		o.value=obj.value;
		document.getElementById('passwordCont').innerHTML = '';
		document.getElementById('passwordCont').appendChild(o);
	}
*/
}

function check_focus(obj, text, type) {
	if(text == obj.value)
		obj.value = '';
/*
	if(type == 'password') {
		var o=document.createElement("INPUT");
		o.type='password';
		o.className = obj.className;
		o.onfocus=obj.onfocus;
//alert(obj.onblur);
		o.onblur=obj.onblur;
		o.name=obj.name;
		o.value=obj.value;
		document.getElementById('passwordCont').innerHTML = '';
		document.getElementById('passwordCont').appendChild(o);
//		alert(document.getElementById('passwordCont').innerHTML);
	}
*/
}

function submitLogin() {
	var todo = document.getElementById('formTodo').options[document.getElementById('formTodo').selectedIndex].value;
	if(todo == 'email') {
		form = document.getElementById('emailForm');
		form.imapuser.value = document.getElementById('formLogin').value;
		form.pass.value = document.getElementById('formPassword').value;
		form.submit();
	} else if(todo == 'stats') {
		form = document.getElementById('statsForm');
		form.user.value = document.getElementById('formLogin').value;
		form.pass.value = document.getElementById('formPassword').value;
		form.submit();
	}
}

function checkbox(obj) {
	var tot = document.getElementById('calcTotals');
	tds = obj.parentNode.getElementsByTagName('td');
	price = 0;
	for(i=0;i<tds.length;i++) if(tds[i].className=='price') {price = parseFloat(tds[i].innerHTML); break;}
	if(obj.className=='selected0') {
		obj.className='selected1';
		if(price > 0) {
			if(parseFloat(tot.innerHTML) > 0)
				tot.innerHTML = (parseFloat(tot.innerHTML) + price).toFixed(2);
			else tot.innerHTML = price.toFixed(2);
		}
	} else {
		obj.className='selected0';
		if(price > 0) {
			if(parseFloat(tot.innerHTML) > 0)
				tot.innerHTML = (parseFloat(tot.innerHTML) - price).toFixed(2);
			else tot.innerHTML = (0).toFixed(2);
		}
	}
}

function calcSubmit() {
	var form = document.getElementById('calc');
	var prods = form.getElementsByTagName('input');
	for(i=0;i<prods.length;i++) {
		if(prods[i].name == 'products[]') {
			if(prods[i].parentNode.className == 'selected0') prods[i].disabled = true;
		}
	}
	form.submit();
}
