window.addEvent('domready', function(){ 
	var duration = 1000;
	var drive = 1;
	var signinhght=24;
	
	if ($('signin-h') != null){
		document.getElementById('signin-h').value=document.getElementById('signin-f').offsetHeight;
		
		var topFx = new Fx.Tween($('signin-f'), { 'duration': duration }); 
		topFx.start('height', 24+'px');
		
		$('signin-s').addEvent('click', function() {	
			if (signinhght==24){signinhght=document.getElementById('signin-h').value;}else{signinhght=24;}
			var topFx = new Fx.Tween($('signin-f'), { 'duration': duration, 'transition': Fx.Transitions.Bounce.easeOut }); 
			topFx.start('height', signinhght+'px'); 
		});	
	};
	
	var list = $$('.preview');
	list.each(function(element) {
		var fx = new Fx.Tween(element, { 'duration': duration });
		fx.start('opacity', '0.0', '1.0'); 
		var h = element.offsetHeight;
		var fx = new Fx.Tween(element, { 'duration': duration });
		fx.start('height', '0px', h+'px'); 
	});
	
	if ($('slider') != null){
		$('slide').addEvent('click', function() {	
			var slFx = new Fx.Tween($('slide'), { 'duration': duration*5}); 
			var qwer = document.getElementById('slide').style.left;
			if(qwer == '0px'){
			slFx.start('left', '0px', '-961px'); 
			}else{
			slFx.start('left', '-961px', '0px'); 
			}
		});	
	};
	
	$each($$('.shortcut'), function(item) {
        // событие при наведении
        item.addEvent('mouseover', function(e) {
            e.stop(); // останавдиваем событие наведения
            //var sfx = new Fx.Tween(item, { 'duration': 250 });
			//sfx.start('height', '18px', '22px');
			var pfx = new Fx.Tween(item, { 'duration': 400 });
			pfx.start('padding-top', '5px', '9px'); 
			
			var bullet = item.getElement('.blue-bullet');
			bullet.set('class', 'red-bullet');
        });
		
        // все точно так же
        item.addEvent('mouseout', function(e) {
            e.stop();
            //var sfx = new Fx.Tween(item, { 'duration': 250 });
			//sfx.start('height', '22px', '18px');
			var pfx = new Fx.Tween(item, { 'duration': 400 });
			pfx.start('padding-top', '9px', '5px'); 
			
			var bullet = item.getElement('.red-bullet');
			bullet.set('class', 'blue-bullet');
        });
    });
	
	$each($$('.top-button'), function(item) {
        // событие при наведении
        item.addEvent('mouseover', function(e) {
            e.stop(); // останавдиваем событие наведения
			var pfx = new Fx.Morph(item, { 'duration': 250 });
			pfx.start({
				'opacity': [0.5, 1.0],
				'margin-left': [-2, 15],
				'margin-right': [-2, 15]
			}); 
        });
		
        // все точно так же
        item.addEvent('mouseout', function(e) {
            e.stop(); // останавдиваем событие наведения
			var pfx = new Fx.Morph(item, { 'duration': 250 });
			pfx.start({
				'opacity': [1.0, 0.5],
				'margin-left': [15, -2],
				'margin-right': [15, -2]
			}); 
        });
    });
	
	$('dwldprice').addEvent('click', function() {	
		
		$('modal-frame').set('styles', {display: 'block'});
		
		/* Определяем ширину */
		var cw = getClientWidth();
		cw = Math.round(cw / 2);
		
		var frameOp = new Fx.Tween($('modal-frame'), { 'duration': duration * drive }); 
		frameOp.start('opacity', '0.0', '1.0');
		
		var frameFx = new Fx.Morph($('modal-frame'), { 'duration': duration * drive }); 
		frameFx.start({
			'left': [-100, cw-300],
			'top': [-100, 160],
			'width': [100, 600],
			'height': [100, 270]
		});
		
		var frameGBorder = $$('.g-border-frame');
		frameGBorder.each(function(element) {
			var gfx = new Fx.Tween(element, { 'duration': duration * drive });
			gfx.start('width', '100', '600'); 
		});
		
		var frameVBorder = $$('.v-border-frame');
		frameVBorder.each(function(element) {
			var vfx = new Fx.Tween(element, { 'duration': duration * drive });
			vfx.start('height', '50', '220'); 
		});	
		
		var frameinnerFx = new Fx.Morph($('modal-frame-inner'), { 'duration': duration * drive }); 
		frameinnerFx.start({
			'width': [50, 550],
			'height': [50, 220]
		});
	
	});	
	
	$('close-price').addEvent('click', function() {	
		var frameFx = new Fx.Tween($('modal-frame'), { 'duration': duration * drive }); 
		frameFx.start('opacity', '1.0', '0.0');
		/*var frameFx = new Fx.Morph($('modal-frame'), { 'duration': duration * drive }); 
		frameFx.start({
			'left': [400, -100],
			'top': [160, -100],
			'width': [600, 100],
			'height': [270, 100]
		});
		
		var frameGBorder = $$('.g-border-frame');
		frameGBorder.each(function(element) {
			var gfx = new Fx.Tween(element, { 'duration': duration * drive });
			gfx.start('width', '600', '100'); 
		});
		
		var frameVBorder = $$('.v-border-frame');
		frameVBorder.each(function(element) {
			var vfx = new Fx.Tween(element, { 'duration': duration * drive });
			vfx.start('height', '220', '50'); 
		});	
		
		var frameinnerFx = new Fx.Morph($('modal-frame-inner'), { 'duration': duration * drive }); 
		frameinnerFx.start({
			'width': [550, 50],
			'height': [220, 50]
		});*/
		
		/*$('modal-frame').set('styles', {display: 'none'});*/
	
	});	

});
