/** phyp.project ** apps.shizen.js.script ** 20091214 **/

if (!p) var p = { };

p.shizen = {

    'init': function() {
	var input = h.tag('input');
	if (input) input.focus().select();
	return true;
    },

    'price': function(e) {
	e.value = max(1, parseInt(e.value) || 0);
	var span = h.id('sz-amount');
	var amount = '' + (e.value * 370);
	amount = amount.sub(0, -2) + ',' + amount.sub(-2);
	span.html(amount);
    },

    'free': function() {
	var input = h.id('sz-price');
	var amount = parseFloat(input.value().replace(',', '.'));
	amount = '' + max(100, amount * 100);
	amount = amount.sub(0, -2) + ',' + amount.sub(-2);
	input.e.value = amount;
	return true;
    },

    'toggle': function(e) {
	dom(e).parent().next().toggle('none');
	return false;
    }

};
