
$(function() {
$.nyroModalSettings({width:740});$.nyroModalSettings({height:700});

	$('.home-button').hover(function() {
	$(this).addClass('home-button-hover');
	}, function() {
	$(this).removeClass('home-button-hover');
	});

 	$(document).ready(function(){
		$('div.toggler-1').toggleElements( );
		$('div.toggler-2').toggleElements( { className:'toggler2' } );
	});
 
 $(document).pngFix();
 $('#equipment-images a').lightBox();
	if($('#admin-panel').length) ap();
});


///////////////////////////////////////////////////////
function ap(){
 var _width=$(document.body).width()-50;
 $('#admin-panel').css({width:_width});
	
	$(window).resize(function(){
	 var _width=$(document.body).width()-50;
		$('#admin-panel').css({width:_width});
	});
}
var popups=[];
function adminpopup(id,a,_h){
	var obj=$('#'+id),_w=$(document.body).width()-250,_h=Math.round($(window).height()*0.5);

	if(popups.length>0 && popups[0]!=id){
		$('#'+popups[0]).hide();
		popups=[];
	}
	if(obj.is(':hidden')){
		obj.css({width:_w,height:_h,left:($(document.body).width()-_w)/2,top:($(window).height()-_h)/2+$(window).scrollTop()}).fadeIn(350);
		popups=[id,a];
	}else{
		$('#'+popups[0]).hide();
		popups=[];
	}

	$(window).scroll(function(){
		if(popups.length>0){
			if($('#'+popups[0]).length)
				$('#'+popups[0]).stop().animate({top:($(window).height()-$('#'+popups[0]).height())/2+$(window).scrollTop()},500);
		}
	});
	return false;
}
