window.addEvent('domready', function(){

	ajaxBridge = 'http://shirtdesigner.t-shirt-total.de/ajaxBridge.php';
	imageOutput = 'http://shirtdesigner.t-shirt-total.de/image.php';
	pictureBase = 'http://shirtdesigner.t-shirt-total.de/_images/';
	pictures_products = 'http://shirtdesigner.t-shirt-total.de/_images/products/';
	productArea = $('product');
	productImage = $('product-image');
	product_colors = $('product-colors');
	product_sizes = $('product-sizes');
	print_area = $('print-area');
	motivList = $('motiv_list');
	if(!$defined('motive')) { motive = $('motive'); }
	if(!$defined('motiv_list')) { motive = $('motiv_list'); }
	motiv_size = {'x': 32, 'y': 32};

//	$$('div#product-selector select').addEvent('change', function() { changeProduct(this.get('value')); });
	$('upload-form').addEvent('submit', function() {
		return AIM.submit(this, {'onStart' : function(){}, 'onComplete' : addCustomMotiv});
	});
	$$('div#motiv_category select').addEvent('change', function() { getMotivListe(this.get('value')); });

	$('size_smaller_5').addEvent('click', function() { setMotivParam(getActiveMotiv().get('id'), 'size', 'down'); });
	$('size_smaller_50').addEvent('click', function() { setMotivParam(getActiveMotiv().get('id'), 'size', 'moredown'); });
	$('size_bigger_50').addEvent('click', function() { setMotivParam(getActiveMotiv().get('id'), 'size', 'moreup'); });
	$('size_bigger_5').addEvent('click', function() { setMotivParam(getActiveMotiv().get('id'), 'size', 'up'); });
//	$('level_down').addEvent('click', function() { setMotivParam(getActiveMotiv().get('id'), 'level', 'down'); });
//	$('level_up').addEvent('click', function() { setMotivParam(getActiveMotiv().get('id'), 'level', 'up'); });
	$('rotate_left_5').addEvent('click', function() { setMotivParam(getActiveMotiv().get('id'), 'rotation', -5); });
	$('rotate_left_45').addEvent('click', function() { setMotivParam(getActiveMotiv().get('id'), 'rotation', -45); });
	$('rotate_right_5').addEvent('click', function() { setMotivParam(getActiveMotiv().get('id'), 'rotation', +5); });
	$('rotate_right_45').addEvent('click', function() { setMotivParam(getActiveMotiv().get('id'), 'rotation', +45); });

//	$('fontselect').addEvent('change',function(){setMotivParam(getActiveMotiv().get('id'), 'font', this.value);});

    $$('.font-color').addEvent('click', function() { setTextColor(this.id) });

    $('productSize').addEvent('change', function() { setProductSize(this.value) });


	getMotivListe($('motivcategoryselector').value);
	changeProduct(0);
	addMotivColorEvents();
    //myTips = new Tips('.motiv',{className: 'tooltip'});
    //myTips2 = new Tips('.products_tn',{className: 'tooltip'});
    

    if(typeof(postloadiepngfix) == 'undefined') {
    	postloadiepngfix = function(){}
    }
    
    myMenu = new UvumiDropdown("dropdown-menu",{
        duration:250,
        delay:0,
        clickToOpen:true
    });

});

