window.addEvent('domready', function() {
	
	if($('email_address')) {
		$('email_address').set('html', '<a href="mailto:alina3eb@hotmail.com">alina3eb@hotmail.com</a>');
	}


	if($$('.adminimgwrap')) {
		$$('.adminimgwrap select').addEvent('change', function() {
			this.getParent().submit();
		});
		$$('.adminimgwrap button').addEvent('click', function(e) {
			e.stop();
			if(prompt('Type "delete" to confirm this deletion')) {
				var hiddenprocess = this.getParent().getChildren();
				hiddenprocess = hiddenprocess[0];
				hiddenprocess.set('value', 'delete');
				this.getParent().submit();
			}
		});

		var affx = new Fx.Morph($('add_item_form'), {
			wait: false,
			duration: 700,
			transition: Fx.Transitions.Sine.easeOut
		});
		var aifx = new Fx.Morph($('adminimg'), {
			wait: false,
			duration: 700,
			transition: Fx.Transitions.Sine.easeOut
		});

		if($('add_item_button')) {
			$('add_item_button').addEvent('click', function() {
				if($('add_item_form').getStyle('height') == '60px') {
					this.set('html', '+ Add a portfolio item');
					affx.start({
						'height': '0',
						'padding': '0'
					});
					aifx.start({'height': '360px'});
				} else {
					this.set('html', '- Add a portfolio item');
					affx.start({
						'height': '60px',
						'padding': '10px 0'
					});
					aifx.start({'height': '280px'});
				}
			});
		}
	}
});

