//#########################################################################
//###################  Main Menu animation options  #######################
//#########################################################################
var transitionDuration = '1000';	//How long menu will slide out (appear)//
var dissapearTimeout = '1000';		//How long menu will stay after mouseOut/
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
window.addEvent('domready', function () {
var status = {
  'true': 'open',
  'false': 'close'
};
	pointer = 'off';
	myHorizontalSlide = new Fx.Slide('subMenuFull', {mode: 'horizontal', duration: transitionDuration});


  $('subMenuContainer').addEvent('mouseenter', function(e){
    e.stop();
		myHorizontalSlide.cancel();
		myHorizontalSlide.slideIn();
		pointer = 'on';
  });

  $('subMenuContainer').addEvent('mouseleave', function(e){
    e.stop();
		setTimeout("checkOn()", dissapearTimeout);
		pointer = 'off';
  });

	myHorizontalSlide.addEvent('complete', function() {
		if (pointer == 'on') myHorizontalSlide.slideIn();
	});

  myHorizontalSlide.hide();

} );

function checkOn() {if (pointer != 'on') myHorizontalSlide.slideOut();}

function PreviewImg(img){
  foto1= new Image();
  foto1.src=(img);
  ImgCheck(img);
}
function ImgCheck(img){
  if((foto1.width!=0)&&(foto1.height!=0)){
    viewImg(img);
  }
  else{
    funzione="ImgCheck('"+img+"')";
    intervallo=setTimeout(funzione,20);
  }
}
function viewImg(img){
  imgWidth=foto1.width+20;
  imgHeight=foto1.height+20;
  stringa="width="+imgWidth+",height="+imgHeight;
  PreviewWindow=window.open("","",stringa);
  PreviewWindow.document.write("<body style='background: #E8D299'><a href='javascript:self.close()' target='_self' title='Нажмите в любом месте чтобы закрыть окно' ><img style='border:1px solid #FCF8EF;' border='1' src='"+img+"'></a></div>");
}