	pngFix_msie = false;
	
	jQuery.preloadImages = function()
	{
	  for(var i = 0; i<arguments.length; i++)
	  {
	    jQuery("<img>").attr("src", arguments[i]);
	  }
	}

 $(document).ready(function(){

	/* init */

	if(cmsBrowser.ie6){

		DD_belatedPNG.fix('.logo img, .mark_selector img.mslogo, .mark_selector .bg, .mark_selector .thumb, .art_logo, .photo_link img, #photogallery, .png, td.content #product_info img');


		$('.thumb:not(.null) img').attr('src','/images/free.gif');

		$('.mark_selector img').css({'margin-left':'20px'});

		$('.mark_selector li').hover(function(){
			$('.mark_selector li').removeClass('hhover');
			$(this).addClass('hhover');
		},
		function(){
			$(this).removeClass('hhover');
		});

	}

	if ($('body').hasClass('index') && (cmsBrowser.ie7 || $('html').hasClass('explorer7'))){
		DD_belatedPNG.fix('.mark_selector img.mslogo, .art_logo');
	}
	
	
	/* end of init */

	if($('body').hasClass('index'))
		$(window).resize(function(){
			$('.mark_selector')
							.css({'width':'20%', 'position':'absolute', 'top':$(document).height()/2+'px'});
		});



	/* start show */


	$('.mark_selector img:not(.shadow)')
						.css({'position' : 'relative', 'top' : '20px', 'opacity':'0', 'display': 'inline'})

						.animate(
									{ 'top':'0px', 'opacity':'1' }, 
									750,
									function(){

										$(this).css({'position' : 'static'});

									});


	if (cmsBrowser.ie7) {
		$('.mark_selector').css({'left':'10%'});
  
  }

		/* mark_selector positioning */
	

	$('.mark_selector')
						.css({'width':'20%', 'position':'absolute', 'top':$(document).height()/2+'px'});
	if(cmsBrowser.ie6 || $('html').hasClass('explorer7'))
		$('.mark_selector').each(function(i){
			if($(this).width() < document.body.clientWidth/4)
				$(this).width(document.body.clientWidth/4)
			$(this).css({'left':i*25+'%'}); //.children('img').css({'display':'block'});
		});
		
	/* end of start show */
	
	
	
	
	/* warning */
	/*
	if ($('html').hasClass('firefox1') || $('html').hasClass('explorer6') || $('html').hasClass('opera8')) {
  	$('#warning').show();
  }
	
	$('.warning_close').click(function(){
		$('#warning').hide();
	});
	*/
	/* end of warning */
	
	
	
	/* services */
	
	$('#services').hover(
										function(){
											$(this).addClass('services_hover');

											$('#services ul').slideDown('fast');

										},
										function(){
											
											$(this).removeClass('services_hover');
											
											$('#services ul').slideUp('fast');
											
										}
	);
	
	/* end of services */
	
	
	/* company */
	
	$('#company').hover(
					function(){
						$(this).addClass('services_hover');

						$('#company ul').slideDown('fast');

					},
					function(){
						
						$('#company ul').slideUp('fast', function(){ $('#company').removeClass('services_hover'); });
						
						
					}
	);
	
	/* end of company */
	
	
	/* credits */

	$('.credit').hover(
				function(){
					$(this).addClass('credits_hover');

					$('.credit ul').slideDown('fast');

				},
				function(){
					
					$(this).removeClass('credits_hover');
					
					$('.credit ul').slideUp('fast');
					
				}
	);
	

	$('.credit_faq a').click(function(){
	
		if (!$(this).hasClass('selected')) {
			$(this).parent().parent().find('div').slideUp();
			$(this).parent().parent().find('a').removeClass("selected");
			$(this).siblings('div').slideToggle();
			$(this).addClass('selected');
		} else {
			$(this).parent().parent().find('div').slideUp();
			$(this).removeClass('selected');
		}
		
		return false;
	});


	/* end of credits */



	/* mark selector */	
	
	$('.mark_selector').click(
				function(){
					var _this = $(this); 
					$('.mark_selector .shadow').hide();
					
					if(!_this.hasClass('act')){

						$('.mark_selector.act')
							.stop()
							.removeClass('act')
							.animate({ 'top': (parseInt($(document).height())/2)+'px' }, 'normal')
							.children('ul')
								.slideUp('normal');
						
						_this.addClass('act');
						
						
						
						$('.head:not(.logo), .footer').css({'visibility':'hidden'}).parent('tr').addClass('hideme');
						
						
						$('.index #stopper tr.hideme').bind('click', function(){
			
							$('.mark_selector').removeClass('act');
							
							$('.head, .footer').css({'visibility':'visible'});
								
							pos = $(document).height();
	
					  	$('.mark_selector').animate({ 'top': (pos/2)+'px' }, 'normal');
								
							if (!cmsBrowser.ie6) {
						  	$('.mark_selector').children('ul').slideUp('normal');
						  } else
						  	$('.mark_selector').children('ul').hide();
							
							$('body').css({'background':'url(/images/bg.gif) top left repeat-x'});
			
						});
						
 
						
						pos = _this.position();
						
						blockheight = _this.children('ul').height() + 110;
						
						respos = pos.top - (blockheight /2);
						
						if (_this.queue().length == 0) {
							
							_this.animate({ 'top': respos+'px' }, 'normal');
	
	
							if (!cmsBrowser.ie6) {
						  	_this.children('ul').slideDown('normal');
						  } else
						  	_this.children('ul').show();
	
						}
					} else {
						
						_this.removeClass('act');
						
						if (_this.queue().length > 0) 
							_this.stop();
							
						
						$('.index #stopper tr.hideme').unbind('click');
						$('.head, .footer').css({'visibility':'visible'}).parent('tr').removeClass('hideme');
							
						pos = $(document).height();

				  	_this.animate({ 'top': (pos/2)+'px' }, 'normal');
							
						if (!cmsBrowser.ie6) {
					  	_this.children('ul').slideUp('normal');
					  } else
					  	_this.children('ul').hide();
						
						$('body').css({'background':'url(/images/bg.gif) top left repeat-x'});
					}

			
				}); 
	

	$('.head.logo').click(function(){
		$('.mark_selector').removeClass('act');
							
				$('.head, .footer').css({'visibility':'visible'});
					
				pos = $(document).height();

		  	$('.mark_selector').animate({ 'top': (pos/2)+'px' }, 'normal');
					
				if (!cmsBrowser.ie6) {
			  	$('.mark_selector').children('ul').slideUp('normal');
			  } else
			  	$('.mark_selector').children('ul').hide();
				
				$('body').css({'background':'url(/images/bg.gif) top left repeat-x'});
	});




	if($('html').hasClass('explorer')){
		
		$('.mark_selector').hover(function(){
			
			if(!$('.mark_selector').hasClass('act'))

				$(this).children('center').children('.shadow').show();
			
		},
		function(){
			
			$(this).children('center').children('.shadow').hide();
			
		});
		
	} else {

		$('.mark_selector').hover(function(){
				
				if(!$('.mark_selector').hasClass('act'))
					$(this).children('center').children('.shadow').show();
				
		 		var ind_img = $(this).children('center').children('img:not(.shadow)');
				ind_img.width(parseInt(ind_img.width()+15)+'px');
				
			},
			function(){
				
		 		var ind_img = $(this).children('center').children('img:not(.shadow)');
				ind_img.width(parseInt(ind_img.width()-15)+'px');
				
				$(this).children('center').children('.shadow').hide();
				
		});

	}



	
	
	
	
	$('.mark_selector li').hover(
							function(){
								
								getparentclass = $.trim($(this).parents('div').attr('class'));
								getparentclass = getparentclass.split(' ');
								
								getclass = $.trim($(this).attr('class'));
								getclass = getclass.split(' ');
								
								if(getclass.length > 1 && getclass[1] == 'nobg')
									$('body').css({'background':'url(/images/bg.gif) top left repeat-x'});
								else {
									
									$('#stopper').css({'background':$('body').css('background')});
									
									pic = jQuery("<img>");
									pic.attr("src", '/files/'+ $.trim(getparentclass[1]) +'/'+ $.trim(getclass[0]) +'/bg.jpg?'+Math.random());
									pic.load(function(){
										
										if($('.mark_selector').hasClass('act')){
											
											$('body').css({'background':'url(/files/'+ $.trim(getparentclass[1]) +'/'+ $.trim(getclass[0]) +'/bg.jpg) 50% 50% no-repeat'});
											
											
										} else {
											$('body').css({'background':'url(/images/bg.gif) top left repeat-x'});
										}

											$('#stopper').css({'background':'none'});
	
									});
									
								}
																
							},
							function(){
								
							}
	);
	
	
	
	/* end of mark selector */
	
	
	
	
	/* photogallery */
	
	$('.photo_link a, #photo_link').click(function(){

		window.scrollTo(0,0);
		
		$('#photogallery').css({'height':$(document).height()}).show();//.fadeIn('fast');
		$.history.add('photo');
	});
	
	$('#gallery_close').hover(
					function(){
						$('#gallery_close img').attr('src','/images/gallery_close_act.gif');
					},
					function(){
						$('#gallery_close img').attr('src','/images/gallery_close.gif');
					});
	
	$('#gallery_close, #photogallery td:empty, .closeme').click(function(){
		$('#photogallery').hide();
	});
	
	
	$('.thumb').hover(
			function(){
				$(this).children('a').children('img').attr('src','/images/free.gif');
			},
			function(){
				if(!$(this).children('a').hasClass('act') && !cmsBrowser.ie6)
					$(this).children('a').children('img').attr('src','/images/photo_cover.png');
			}
	)
	
	$('.thumb a').click(function(){
		if(!$(this).hasClass('act')){
			$('.thumb a').removeClass('act');
			if (!cmsBrowser.ie6)
	  		$('.thumb:not(.null) img').attr('src', '/images/photo_cover.png');
	  	
			$(".image img").css('visibility','hidden');
			$(".image img").attr("src", $(this).attr('href')).load(function(){
				$(".image img").css('visibility','visible');
			});
			
			$('.image img').attr('src',$(this).attr('href'));
			$(this).addClass('act').children('img').attr('src','/images/free.gif');
			$('.photo_info').html($(this).children('img').attr('alt'));
			
			
			var photo_addr = $(this).attr('href').split('/');
			photo_addr = photo_addr[photo_addr.length-1];

			
			var anc = document.location.toString();
			root = anc.split('#')[0];
			document.location = root+'#photo/'+photo_addr;
			$.history.add(root+'#photo/'+photo_addr);
		}
		
	}); 
	
	
	
	/* end of photogallery */
	
	
	
	
 });
 
	function gotoanc(){
		var anc = document.location.toString();

		if (anc.match('#')) {

			photo = anc.split('#')[1];
			
			if(!photo)
				$('#gallery_close').trigger('click');
			else {
				current_photo = photo.split('/')[1];
	
				photo = photo.split('/')[0];



				if(photo == 'photo'){
	
					$('.photo_link a').trigger("click");
					
					if(current_photo)
	
						$('a[href$='+current_photo+']').trigger("click");
	
				}
			}

		} else {
			$('#photogallery').hide();
		}
		
	}