function IEPngFix(pngimg, gifimg, width, height)
{
	var code = '<img src="'+ gifimg +'" width="' + width + '" height="' + height + '" border="0" style="background:url('+pngimg+') no-repeat 0px 0px;"/>';
	if( navigator.userAgent.indexOf("Opera") > 1 ) document.write(code);
	else
		if( navigator.userAgent.indexOf("MSIE 6") > 1 ) document.write('<img src="'+gifimg+'" width="' + width + '" height="' + height + '" border="0" style="filter: progid:DXImageTransform.Microsoft.AlphaImageLoader (src=' + pngimg + ' , sizingMethod=crop );"/>');
		else
			if(navigator.userAgent.indexOf("MSIE 5") != -1) document.write(code);
			else document.write(code);
}

function show_div(id)
{
	var div;
	div = document.getElementById(id);
	if ( div.style.display == "none" ) div.style.display = "block";
		else div.style.display = "none";
}


function gotolink(link){
	document.location=link;
}


function clicks()
{
	$('#article_next').click(
		function(){
			slide = $(this).attr('q_slide');
			$.ajax({
				url: "/inc/refresh_articles.php?q_num="+slide,
				cache: false,
				success: refresh_articles_block
			});
			return false;
		}
	);

	$('#article_prev').click(
		function(){
			slide = $(this).attr('q_slide');
			$.ajax({
				url: "/inc/refresh_articles.php?q_num="+slide,
				cache: false,
				success: refresh_articles_block
			});
			return false;
		}
	);
}


function refresh_articles_block(data)
{
	$("#articles_block").html(data);
	clicks();
}



$(document).ready(function(){
	$('#service-nav li').pngFix( );
	$('.serv').pngFix( );
	
	
	$('img').hover(
		function()
		{
			if( (!$(this).hasClass('act')) && ($(this).attr('hover')) )
			{
				tmp = $(this).attr('src');
				$(this).attr('src', $(this).attr('hover'));
			}
		},
		function()
		{
			if( (!$(this).hasClass('act')) && ($(this).attr('hover')) )
			{
				$(this).attr('src', tmp);
			}
		}
	);

	$('img').each(function(){
		if( ($(this).hasClass('act')) && ($(this).attr('hover')) )
		{
			$(this).attr('src', $(this).attr('hover'));
		}
	});



	$('.b_order').click(
		function(){
			$('.popup-form').fadeIn(200);
			return false;
		});

	$('#popup-close').click(
		function(){
			$('.popup-form').fadeOut(200);
		});		

	clicks();


});


