
function init()
{
	
		//menu
		if($("menuCont"))
		{	

			$$(".menuLink").each(function(el)
			{

				var parent = el.getParent(".linkCont");
				var submenu = parent.getElement(".submenu");
				var showedSub = $$(".showSub");


				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"))
{
	
	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: 1016,
			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					 
		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'},
										'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':'112px', 'height':'68px', 'background-color':'#ffffff', 'z-index':'-2'  }  }).inject(item);
  
			item.addEvent('click', function(e) { 
				e = new Event(e).stop();
				
					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;

				
					if(_prev == null) $("bigArrowLeft").setStyle("display", "none");
					else $("bigArrowLeft").setStyle("display", "block");
					
					if(_next == null) $("bigArrowRight").setStyle("display", "none");
					else $("bigArrowRight").setStyle("display", "block");					
				
				
					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':'1px 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"
																
																																
															   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="640" height="480"><param name="movie" value="flvplayer.swf" /><param name="FlashVars" value="file=' + item.getProperty("videoFile") + '&width=640&height=480" /><param name="quality" value="high" /><embed src="flvplayer.swf" FlashVars="file=' + item.getProperty("videoFile") + '&width=640&height=480" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="640" height="480"></embed></object>';
																													var flvDiv = new Element("div", {'html' : flvStr});
																													$("flvPlayer").set("html", flvStr);
																											}
																											

																										   
																										   
																										   
																										   
																										   
																										   });
															});
																																								 
																																								 
																																								 	}  });
					
					
					
					
					/*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);
	});
	
	$("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");});


} // --
		
		
}




window.addEvent('domready', function(){init()});  // domready, load









