function calc() {
	var total_double = document.getElementById('total_double');
	var total = document.getElementById('total');
	var inputs = document.getElementsByTagName('input');
	
	var total_amount = 0;
	for (var i = 0; i < inputs.length; i++) {
		if (inputs[i].className.indexOf('calc') != -1) {
			if (inputs[i].value > 0) {
				var amount = inputs[i].className.replace(/calc /, '') / 1;
				total_amount = total_amount + (inputs[i].value * amount);
			}
		}
	}
	
	total.innerHTML = total_amount;
}

function init() {
	if ( document.getElementById('wrap') || document.getElementById('home') || document.getElementById('ta') ) {
		
		var wrap;
		if (document.getElementById('wrap')) {
			wrap = document.getElementById('wrap');
		} else if (document.getElementById('home')) {
			wrap = document.getElementById('home');
		} else if (document.getElementById('ta')) {
				wrap = document.getElementById('ta');
			}
		
		ns = (document.all)? false : true;
		winH = (ns)? window.innerHeight : document.body.clientHeight;
		winW = (ns)? window.innerWidth : document.body.clientWidth;
		
		if (winW < 748) {
			wrap.style.left = '0px';
		} else {
			div = (winW - 748) / 2;
			wrap.style.left = div + 'px';
		}
		
		if (winH < 531) {
			wrap.style.top = '0px';
		} else {
			div = (winH - 531) / 2;
			wrap.style.top = div + 'px';
		}
	}
}

window.onload = init;
window.onresize = init;
