$(document).ready(function(){
	$(".roll_btn").click(function(){
		$(this).next("#roller").slideToggle("slow");
		$(this).toggleClass("roll_on");
		});
	$(".roll_arrow").click(function(){
		$(this).prev("#roller").toggleClass("roll_on");
		$(this).toggleClass("roll_on");
//		$(this).prev("#roller").slideToggle("slow");
		});
	});

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 gotolink(link){
	document.location=link;
}

var need_hide = true;
var now_sm_opened = "";


function hiding_pop()
{
	if(need_hide)
	{
		$('.model_sm').fadeOut(1);
	}
}



$(document).ready(function(){

	/*jQuery(window).bind("load", function() {
		jQuery("div#slider1").codaSlider()
	
	});*/
	


	$('.ccol a').each(function(){
		link = $(this).attr('href');
		if( ($(this).attr("target")) && ( (link.indexOf('.jpg') > 0) || (link.indexOf('.JPG') > 0) ) ) $(this).lightbox();
		if( ($(this).attr("target")) && ( (link.indexOf('.png') > 0) || (link.indexOf('.PNG') > 0) ) ) $(this).lightbox();
//		if( ($(this).attr("target")) && (link.indexOf('.jpg') > 0) ) $(this).fancybox();
		//if( ($(this).attr("target")) && ( (link.indexOf('.jpg') > 0) || (link.indexOf('.JPG') > 0) ) ) $(this).fancybox();
	});


	$('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'));
		}
	});


	$('.menu a').hover(
		function()
		{
			need_hide = false;
			sm = $(this).attr('sm_name');
			if(sm)
			{
				if(sm != now_sm_opened)
				{
					if(now_sm_opened!="")$('.'+now_sm_opened).fadeOut(1);
					now_sm_opened = sm;
				}
				if($('.'+sm))
				{
					$('#page_h').fadeOut(1);
					$('#logoya').fadeOut(1);
					$('.'+sm).fadeIn(1);
				}
			}
		},
		function()
		{
			need_hide = true;
			setTimeout( 'hiding_pop();', 100);
		}
	);
	
	$('.sm').hover(
		function()
		{
			need_hide = false;
		},
		function()
		{
			need_hide = true;
			setTimeout( 'hiding_pop();', 100);
		}
	);


	$('.gallery_picker').click(
		function()
		{
			$('.gallery_picker').each(function()
			{
				$(this).removeClass('clicked');
			});
			$(this).addClass('clicked');
			$('#gallery_block').attr('src', $(this).attr('link') );
		});

	
	$('.tabs2 td').click(
		function()
		{
			$('.tabs2 td').each(function()
			{
				$(this).removeClass('clicked');
			});
			$('.tab_cont').each(function()
			{
				$(this).hide();
			});
			$(this).addClass('clicked');
			$('#'+$(this).attr('show')).show();
		});

	$('.tabs3 td').click(
		function()
		{
			$('.tabs3 td').each(function()
			{
				$(this).removeClass('clicked');
			});
			$('.tab3_cont').each(function()
			{
				$(this).hide();
			});
			$(this).addClass('clicked');
			$('#'+$(this).attr('show')).show();
		});	




});




