jQuery(function() {
	jQuery('.dialog-trigger').click(function() {		var h = jQuery('html').height(), w = jQuery('html').width();
		var overlay = jQuery('#overlay');
		if (overlay.length == 0) overlay = jQuery('<div id="overlay" class="hidden"/>').appendTo('body');
		overlay.height(h).width(w).show();
		var form = jQuery(jQuery(this).attr('rel'));
		form.css({ top: parseInt((h - form.outerHeight())/2)+'px',
				   left: parseInt((w - form.outerWidth())/2)+'px' }).animate({ opacity: 'show' }, 400);
		var close = form.find('.close-trigger').click(function() {
			form.animate({ opacity: 'hide' }, 200);
			overlay.hide();
			return!1;
		});
		form.find('.submit').click(function() {
			close.trigger('click');
		});
		return!1;
	});
	jQuery(window).resize(function() {		setTimeout(function() {
			var w = parseInt(jQuery('html').width()/2) - 500;
			jQuery('#diamond-in-row').width(285 + (w>0?w:0));
            jQuery('#diamond-in-side').width(183 + (w>0?w:0));
		}, 100);
	}).triggerHandler('resize');
});
