function scrollX() {
	var de = document.documentElement;
	return self.pageXOffset || (de && de.scrollLeft) || document.body.scrollLeft;
}
function scrollY() {
	var de = document.documentElement;
	return self.pageYOffset || (de && de.scrollTop) || document.body.scrollTop;
}
function windowHeight() {
	var de = document.documentElement;
	return self.innerHeight ||( de && de.clientHeight ) || document.body.clientHeight;
}
function windowWidth() {
	var de = document.documentElement;
	return self.innerWidth ||( de && de.clientWidth ) || document.body.clientWidth;
}
function showBigPic($Img,BigPicSrc,widthImg,heightImg) {
    $('.enlargedImg').remove();
	var $enlargedImg = $('<img />').addClass('enlargedImg').appendTo('body');
	var $closeImg = $('<span />').addClass('closeImg').appendTo('body');
    $enlargedImg.attr({
      'src':BigPicSrc
    }).css({
      'position':'absolute',
      'z-index':'10',
	  'left':scrollX() + (windowWidth()/2) - (widthImg/2),
	  'top':scrollY() + (windowHeight()/2) - (heightImg/2),
	  'display':'none'
    }).fadeIn(1000);
	$closeImg.css({
		'position':'absolute',
		'z-index':'11',
		'right':scrollX() + (windowWidth()/2) - (widthImg/2),
  		'top':scrollY() + (windowHeight()/2) - (heightImg/2),
		'background':'#fff',
		'opacity':'0.9',
		'color':'#000',
		'font-weight':'bold',
		'padding':'5px',
		'cursor':'pointer'
	}).text('закрыть');
	if ($enlargedImg.complete) {
		$enlargedImg.fideIn(500);
	}
    $('.closeImg').bind('click',function(){
      $(this).remove();
	  $('.enlargedImg').fadeOut(1000).remove();
    });
}

function ShowFlash(src, width, height) {
  	document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\""+width+"\" height=\""+height+"\" title=\"\">");
  	document.write("<param name=\"movie\" value=\""+src+"\">");
  	document.write("<param name=\"quality\" value=\"high\">");
  	document.write("<param name=\"wmode\" value=\"transparent\">");
  	document.write("<param name=\"align\" value=\"left\">");
  	document.write("<param name=\"salign\" value=\"l\">");
  	document.write("<embed src=\""+src+"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\""+width+"\" height=\""+height+"\" wmode=\"transparent\" align=\"left\" salign=\"l\">");
  	document.write("</embed></object>");
}
var ChangeImages = function () {
	$("ind").remove();
	$('#flash img').each(function(){
		$(this).css('display','block');
	});
	$('#footer img').each(function(){
		$(this).css('display','block');
	});
	rotateImg();
	rotateImg2();
}
var rotateImg = function() {
	$('#footer img:last').fadeOut(2000,function(){
	$(this).prependTo('#footer');
	});
	$('#footer img').removeAttr('style');
	t = setTimeout(rotateImg,5000);
}
var rotateImg2 = function() {
	$('#flash img:last').fadeOut(2000,function(){
	$(this).prependTo('#flash');
	});
	$('#flash img').removeAttr('style');
	t = setTimeout(rotateImg2,5000);
}
$(document).ready(function(){
	$('#menuOnMain2').css({
		'opacity':0.3
	});
	$('#menuOnMain div.whiteLine').css({
		'opacity':0.3
	});
	//
	img1 = $('<img />').attr({
		'src': '/images/004.jpg',
		'style':'display:none'
	}).appendTo('#flash');
	img2 = $('<img />').attr({
		'src': '/images/003.jpg',
		'style':'display:none'
	}).appendTo('#flash');
	img3 = $('<img />').attr({
		'src': '/images/002.jpg',
		'style':'display:none'
	}).appendTo('#flash');
	img4 = $('<img />').attr({
		'src': '/images/001.jpg',
		'style':'display:none'
	}).appendTo('#flash');
	//
	img1b = $('<img />').attr({
		'src': '/images/footer_winter.jpg',
		'style':'display:none'
	}).appendTo('#footer');
	img2b = $('<img />').attr({
		'src': '/images/footer_outumn.jpg',
		'style':'display:none'
	}).appendTo('#footer');
	img3b = $('<img />').attr({
		'src': '/images/footer_summer.jpg',
		'style':'display:none'
	}).appendTo('#footer');
	img4b = $('<img />').attr({
		'src': '/images/footer_spring.jpg',
		'style':'display:none'
	}).appendTo('#footer');
	
	// print
	$('.printButton').click(printPage);
	
	//price table
	$('.pricePage table')
		.removeAttr('style')
		.removeAttr('width')
		.removeAttr('height')
		.removeAttr('align')
	.find('td')
		.removeAttr('style')
		.removeAttr('width')
		.removeAttr('height');
});
window.onload = function() {
	ChangeImages();
}


var printPage = function() {
	if (typeof(window.print) != 'undefined') {
	window.print();
	}
}


