var buttonPath = '/images/buttons/'; 
var images = new Array();

$(document).ready(function(){
	var CurHeight = $(window).height();
	if(CurHeight < 700) { 
		$('.main_size').css({'height' : '700px'});
		$('.page_1 .top').css({'margin-top' : '200px'}); 
		$('.page_1 .shoe').css({'margin-top' : '200px'}); 
		$('.page_3 .shoe').css({'margin-top' : '269px'}); 
		$('.page_2 .top').css({'margin-top' : '565px'}); 
	}

	if(CurHeight > 700) {
		$('.main_size').css({'height' : CurHeight+'px'});
		$('.page_1 .top').css({'margin-top' : CurHeight/2-200+'px'}); 
		$('.page_1 .shoe').css({'margin-top' : CurHeight/2-200+'px'}); 
		$('.page_3 .shoe').css({'margin-top' : CurHeight-431+'px'});
		$('.page_3 .top').css({'margin-top' : CurHeight/2-100+'px'});
		$('.page_2 .top').css({'margin-top' : CurHeight-120+'px'}); 
		$('.page_2 .top_2').css({'margin-top' : CurHeight/2-200+'px'}); 
	}
	
	$('#page1').css('display', 'block');
	$.scrollTo('#page2');
	
	var duration = 1000;
	
	$('#button_down_page1')	.click(function(){
		$.scrollTo('#page2', duration);
		return false;
	}); 
	
	$('#button_down_page2')	.click(function(){
		$.scrollTo('#page3', duration);
		return false;
	}); 
	
	$('#button_up_page2')	.click(function(){
		$.scrollTo('#page1', duration);
		return false;
	}); 
	
	$('#button_up_page3')	.click(function(){
		$.scrollTo('#page2', duration);
		return false;
	}); 
	
	$("#but a").click(function(){
		$('#sl_instruct').slideUp("normal");
		sendExternalInterface();
		return false;
	});
	
	
	$("#but_2 a").click(function(){
			$('#sl_instruct_2').slideUp("normal");
			sendExternalInterface2();
			return false;
	});
	
	//предзагрузка кнопок
	$('.gbutton').each(function(){
		var img = $(this).children('img');
		var image = new Image();
		
		image.src = buttonPath + img.attr('class') + '_hover.png'; 
		images[images.length] = image; 
	});
	
	//кнопка [x]
	var image = new Image();
	image.src = buttonPath + 'close_hover.png'; 
	images[images.length] = image;
	$('.clos_but').mouseover(function() {
		var img = $(this).find('img');
		img.attr('src', buttonPath + 'close_hover.png');
	}).mouseout(function() {
		var img = $(this).find('img');
		img.attr('src', buttonPath + 'close.jpg');
	});

	
	
	//подсветка  кнопок
	$('.gbutton').mouseover(function() {
		var img = $(this).children('img');
		
		img.attr('src', buttonPath + img.attr('class') + '_hover.png');
	
	}).mouseout(function() {
		var img = $(this).children('img');
		img.attr('src', buttonPath + img.attr('class') + '.png');
	});

	var so = new SWFObject("/swf/DryPreload.swf", "bnr", "535", "510"); 
  //var so = new SWFObject("/DoctorDry.swf", "bnr", "535", "510"); 
	so.addParam("wmode", "transparent");

	so.addVariable('culture', culture);
	so.write("flashcontent_1");
	

});

function showhowto() {
	$('#sl_instruct').slideDown("slow");
	$('#sl_instruct_2').slideUp("slow");
}

function showhintinside() {
	$('#sl_instruct').slideUp("slow");
	$('#sl_instruct_2').slideDown("slow");
}



function getMovie() {
	var M$ =  navigator.appName.indexOf("Microsoft")!=-1
	return (M$ ? window : document)["bnr"]
}
 

function sendExternalInterface() {
	var movie = getMovie();
	movie.FlashFunction();
}

function sendExternalInterface2() {
	var movie = getMovie();
	movie.FlashFunctioninside(null);
}

function closeHint(str)
{
	switch (str) {
		case 'instruction':
			$('#sl_instruct').slideUp("slow"); 
			break;
		case 'inside':
			$('#sl_instruct_2').slideUp("slow");
			break;
		default:
			break;
	}
		
}

