
function init()
{

		//menu
		if($("menuCont"))
		{

			$$(".menuLink").each(function(el)
			{

				var parent = el.getParent(".linkCont");
				var submenu = parent.getElement(".submenu");
				var showedSub = $$(".showSub");


				var initOpacity = 1;
				if(el.hasClass("active") && !el.hasClass("noEffect"))
				{
					initOpacity = 0.6;
					el.setStyle("opacity", 0.6);
				}


				el.addEvent("mouseover", function(){
											//el.fade(0.6);
											el.setStyle("opacity", 0.6);
										});
				el.addEvent("mouseout", function(){
											el.fade(initOpacity);
											//el.setStyle("opacity", 1);
						});




				parent.addEvent("click", function()
				{
					var href = el.getProperty("href");
					window.location = href;

				});

				if(!el.hasClass("active"))
				{


						parent.addEvent('mouseenter', function()
						{
							parent.removeClass("off");
							parent.addClass("on");




							// submenu
							if(submenu)
							if(!submenu.hasClass("showSub"))
							{

								// hide showsub
								if(showedSub)
								{
									showedSub.setStyle("display", "none");
								}

								//submenu.setStyle("width", 0);
								submenu.setStyle("display", "block");
								submenu.setStyle("z-index", 12);
								//var fx = new Fx.Tween(submenu, { 'duration':390, 'link':'chain'} );
								//fx.start("width", 950);


							} // submenu
							//-----------------

						});

						parent.addEvent('mouseleave', function()
						{
							parent.removeClass("on");
							parent.addClass("off");


							MM_swapImgRestore();

							//submenu
							if(submenu)
							if(!submenu.hasClass("showSub"))
							{

								// hide showsub
								if(showedSub)
								{
									showedSub.setStyle("display", "block");
								}


								submenu.setStyle("z-index", 5);
								//var fx = new Fx.Tween(submenu, { 'duration':390, 'link':'chain'} );
								//fx.start("width", 0).chain(function() { submenu.setStyle("display", "none"); });
								submenu.setStyle("display", "none");
							}
							// ---------------


						});

				} //-- has class active





			});


		}



		//scroller
		var pom = $("scroller1");
		if(pom)
		{

			var scr2 = new ScrollBar('scroller1', 'scroller1b', {
												'arrows': false,
												'hScroll': false
											});
		}

		/*// overlay
		overlay = new Element("div", {id: "overlay"} ).inject($(document.body)).setStyle("display", "block");
		overlay.setStyles({top: window.getScrollTop(), height: window.getHeight()});
		fx = {
			overlay: new Fx.Tween(overlay, {property: "opacity", duration: 500}).set(0)
		};
		fx.overlay.start(0.8).chain(function() {
											 overlay.set( 'styles', {'clip':' rect(200px 600px 600px 200px)'} );
											 }

											 );*/





		// gall
if($("thumbsPanel"))
{


	function hideGalleryImgHolder(hide)
	{
		if(hide)
		{

			var fxOver = new Fx.Tween($('galleryImgHolder'), { 'duration':290} );
			fxOver.start('opacity',0).chain(  function() {  //begin fxOver


			hideGalleryNextPrev(true);
			$('galleryImgHolder').setStyle("display", "none");
			//$('flvPlayer').setStyle("display", "none");



			// remove all elements
			$('galleryImgHolder').getElements("div").each(function(ed){
																if(!ed.hasClass("bigArrowItem") && !ed.hasClass("loader") ) ed.destroy();
																//myElement.getElements('div:not(bigArrowItem)').destroy();
													});
			$("flvPlayer").empty();



			  }  ); // end fxOver

		}
		else
		{
				$('galleryImgHolder').setStyle("opacity", 1);
				$('galleryImgHolder').setStyle("display", "block");
		}
	}

	function hideGalleryNextPrev(hide)
	{
		if(hide)
		{
			//$$(".bigArrowItem").each(function(eba) { eba.setStyle("display", "none");  });
			$("bigArrowLeft").setStyle("display", "none");
			$("bigArrowRight").setStyle("display", "none");
			$("bigArrowClose").setStyle("display", "none");
		}
		else
		{
			//$$(".bigArrowItem").each(function(eba) { eba.setStyle("display", "block");  });
			$("bigArrowLeft").setStyle("display", "block");
			$("bigArrowRight").setStyle("display", "block");
			$("bigArrowClose").setStyle("display", "block");
		}
	}

	var _images = [];
	var _prev = null;
	var _next = null;
	var _current = null;

	var firstGalleryItem = -1;


		var handles8_more = $$('#handles8_more span');
		var nS8 = new noobSlide({
			box: $('box8'),
			items: $$('#box8 h3'),
			size: 982,
			handles: $$('#handles8 span'),
			addButtons: {previous: $('prev8'), next: $('next8') },
			onWalk: function(currentItem,currentHandle){
				//style for handles
				$$(this.handles).removeClass('active');
				$$(currentHandle).addClass('active');

			}
		});

		//nS8.addActionButtons('previous',$$('#box8 .prev'));
		//nS8.addActionButtons('next',$$('#box8 .next'));



		// img tween
		var container = $('galleryImgHolder');			// large image container
		///container.addEvent("click", function() { container.setStyle("display", "none"); });

		var loadingCont = new Element('div', {
									  	'styles' : {'position':'absolute','left':'0px','top':'0px','z-index':'1000','padding-top':'320px','width':'100%', 'font-size':'16px', 'font-family':'Arial', 'display':'none'},
										'class' : 'loader',
										'html' : '<b>LOADING</b>'
											}).inject(container);


		var currentImage = null;
		var indexnew = 1;


		$$('.galleryThumbnail').each(function(el){
											  el.addEvent('mouseover', function(){
																				var fxOver = new Fx.Tween(el, { 'duration':290} );
																				fxOver.start('opacity',0.9).chain(  function() { fxOver.start('opacity', 1);  }  );
																		});
											  } );




		$$('.galleryThumbnailLink').each(function(item, _index){



	  	var bgW = new Element('div', { 'html' : '&nbsp;', 'styles': { 'position':'absolute', 'left':'7px', 'top':'0px', 'width':'150px', 'height':'150px', 'background-color':'#ffffff', 'z-index':'-2'  }  }).inject(item);

			item.addEvent('click', function(e) {
				e = new Event(e).stop();

					hideGalleryImgHolder(false);

					var pom_Arr =  $$('.galleryThumbnailLink');

					if(_index == 0) _prev = null;
					else _prev = pom_Arr[_index-1];
					if(_index  == (pom_Arr.length -1)) _next = null;
					else _next = pom_Arr[_index+1];
					_current = item;





					loadingCont.set('styles', {'display':'block'} );

					//var newImage = new Element('img', {  'src': item.href, 'styles':{ 'position':'absolute', 'left':'0px', 'top':'0px', 'z-index':indexnew++ }   }); // create large image
					var newImage = Asset.image(item.href, {  /*styles:{ 'position':'absolute', 'left':'0px', 'top':'0px', 'z-index':indexnew++ },*/ onload: function(e){

															//e.setStyles({ 'position':'absolute', 'left':'0px', 'top':'0px', 'z-index':indexnew++ });

															newImage.setStyles({'border':'0px solid #ffffff', 'z-index':'9929'});

															var fxLrg = new Fx.Morph(e, {duration: 300, transition: Fx.Transitions.Sine.easeOut});



															fxLrg.start({
																'opacity' : 0
															}).chain(function(){

																loadingCont.set('styles', {'display':'none'} ); // hide "loading"


																//show next prev
																//hideGalleryImgHolder(false);


															   var pomDiv2 = new Element('div', { 'html' : '', 'styles': { 'position':'absolute', 'left':'0px', 'top':'0px', 'width':'100%', 'height':'100%', 'z-index':indexnew++   }  });

															  // pomDiv2.set( 'html', '<table width="100%"  border="0" cellspacing="0" cellpadding="0" height="100%"><tr><td align="center" valign="middle">'+e.inject()+'</td></tr><table>' );


															   e.inject(pomDiv2);
															   pomDiv2.inject(container);
																//e.inject(container); // insert new image

																fxLrg.start({'opacity': 1}).chain(function(){
																										  // currentImage = e.clone(false, false);
																										   //currentImage.inject(container); !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
																										  // e.destroy();


																										   var pomDiv = new Element('div', { 'html' : '', 'styles': { 'position':'absolute', 'left':'0px', 'top':'0px', 'width':'100%', 'height':'100%', 'z-index':indexnew++   }  });
																										 //  currentImage.inject(pomDiv); !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
																										   pomDiv.inject(container);




																										   // add flash player
																											if(item.getProperty("videoFile") != "no")
																											{

																													/*var flashvars = {};
																													flashvars.file = item.getProperty("videoFile");
																													flashvars.width = "340";
																													flashvars.height = "260";


																													swfobject.embedSWF("flvplayer.swf", "flvPlayer", "340", "260", "8.0.0", "expressInstall.swf", flashvars);
																													*/

																													var flvStr = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="850" height="498"><param name="movie" value="flvplayer.swf" /><param name="allowfullscreen" value="true" /><param name="FlashVars" value="file=' + item.getProperty("videoFile") + '&width=850&height=498&autostart=true&allowfullscreen=true&displayclick=fullscreen" /><param name="quality" value="high" /><embed src="flvplayer.swf" FlashVars="file=' + item.getProperty("videoFile") + '&width=850&height=498&autostart=true&displayclick=fullscreen"  allowfullscreen="true" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="850" height="498"></embed></object>';
																													var flvDiv = new Element("div", {'html' : flvStr});
																													$("flvPlayer").set("html", flvStr);
																											}


                                                                                                                                                                                                                        // add Vimeo player
																											if(item.getProperty("vimeoID") != "no")
																											{

																													/*var flashvars = {};
																													flashvars.file = item.getProperty("videoFile");
																													flashvars.width = "340";
																													flashvars.height = "260";


																													swfobject.embedSWF("flvplayer.swf", "flvPlayer", "340", "260", "8.0.0", "expressInstall.swf", flashvars);
																													*/

																													//var flvStr = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="850" height="498"><param name="movie" value="flvplayer.swf" /><param name="allowfullscreen" value="true" /><param name="FlashVars" value="file=' + item.getProperty("videoFile") + '&width=850&height=498&autostart=true&allowfullscreen=true&displayclick=fullscreen" /><param name="quality" value="high" /><embed src="flvplayer.swf" FlashVars="file=' + item.getProperty("videoFile") + '&width=850&height=498&autostart=true&displayclick=fullscreen"  allowfullscreen="true" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="850" height="498"></embed></object>';
																													var flvStr = '<iframe src="http://player.vimeo.com/video/' + item.getProperty("vimeoID") + '?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff&amp;autoplay=1" width="850" height="478" frameborder="0"></iframe>';
                                                                                                                                                                                                                                        var flvDiv = new Element("div", {'html' : flvStr});
																													$("flvPlayer").set("html", flvStr);
																											}




																										   // show next prev
																										   hideGalleryNextPrev(false);

																											if(_prev == null) $("bigArrowLeft").setStyle("display", "none");
																											else $("bigArrowLeft").setStyle("display", "block");

																											if(_next == null) $("bigArrowRight").setStyle("display", "none");
																											else $("bigArrowRight").setStyle("display", "block");


																										   });
															});


																																								 	}  });




					/*var fxLrg = new Fx.Morph(newImage, {duration: 300, transition: Fx.Transitions.Sine.easeOut});

					newImage.onload = function(){
						fxLrg.start({
							'opacity' : 0
						}).chain(function(){

							loadingCont.set('styles', {'display':'none'} ); // hide "loading"

							newImage.inject(container); // insert new image

							fxLrg.start({'opacity': 1}).chain(function(){
																	   currentImage = newImage.clone(false, false);
																	   currentImage.inject(container);
																	   newImage.destroy();

																	   });
						});
					};*/





			});


			if(firstGalleryItem == -1) firstGalleryItem = item;

		});




	var myLarr = $$('.galleryThumbnailLink');
	//if(myLarr.length!=0) myLarr[0].fireEvent("click", myLarr[0]);


	$("bigArrowLeft").addEvent("click", function(){
		if(_prev != null) _prev.fireEvent("click", _prev);
	});
	$("bigArrowRight").addEvent("click", function(){
		if(_next != null) _next.fireEvent("click", _next);
	});
	$("bigArrowClose").addEvent("click", function(){
		hideGalleryImgHolder(true);
	});

	/*$("bigArrowLeft").addEvent("mouseover", function(){this.getElement("p").setStyle("visibility", "visible");});
	$("bigArrowLeft").addEvent("mouseout", function(){this.getElement("p").setStyle("visibility", "hidden");});

	$("bigArrowRight").addEvent("mouseover", function(){this.getElement("p").setStyle("visibility", "visible");});
	$("bigArrowRight").addEvent("mouseout", function(){this.getElement("p").setStyle("visibility", "hidden");});
	*/

	//$("bigArrowLeft").setStyle("display", "none");
	//$("bigArrowRight").setStyle("display", "none");


} // --


}




window.addEvent('domready', function(){init()});  // domready, load









