$(document).ready(function () {
	$("a[rel^='prettyPhoto']").prettyPhoto();
});

//-----------------------initialization of lists
var dropDownStates=new Array();

function listsInit()
{
	$(".dropdownText").each(
		function (i) 
		{
			//$(this).wrap("<div class='dropdownText' id='ddText_"+i+"'></div>");		
			$(this).html("<div class='dropdownText' id='ddText_"+i+"'>"+$(this).html()+"</div>");
			$("#ddText_"+i).hide();
		}
	);
	
	
	$(".dropdownCaption").each(
		function (i) 
		{
			dropDownStates[i]=0;
			$(this).attr("id","ddCaption_"+i);
			$(this).click(function(){
				hlDropDown(i, "ddCaption_"+i, "ddText_"+i)
			});			
		}
	);	
}
	
function hlDropDown(i, id, textId)
{
	if(dropDownStates[i])
	{
		//$("#"+textId).hide();		
		//$("#"+textId).slideUp("slow");
		//$("#"+textId).fadeOut("slow");
		$("#"+id).attr("class", "dropdownCaption");
	}
	else
	{
		//$("#"+textId).show();
		//$("#"+textId).slideDown("slow");
		//$("#"+textId).fadeIn("slow");	
		$("#"+id).attr("class", "dropdownCaptionActive");		
	}
	$("#"+textId).slideToggle("slow");	
	dropDownStates[i]=1-dropDownStates[i];
}



	
//----------------PNG FIX---------------------
function bgFixPng() {
	if(is_ie6)
	{			
		$("div").each(function () {
			obgFixPng($(this));
		});		
	}
}

function obgFixPng(obj)
{		
	obj=$("#"+obj);	
	if(is_ie6)
	{
		var bg  = obj.css("background-image");				
		if(bg)
		{		
			if(bg.length)
			{
				var src = bg.substring(5, bg.length-2);
				var sizingMethod = (obj.css("background-repeat") == "no-repeat") ? "crop" : "scale";
				obj.css("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + sizingMethod + "')");
				obj.css("background-image","url("+base_url+"public/css/pngfix.gif)");	
			}
		}		
	}	
	
}
//----------------------------------------	
	
//Функция подсветки пунктов меню
function mainmenu_hl(id, state, color)
{
	if($("#"+id).attr("class")!="active_menu_link")
	{
		if(state)
		{
			$("#"+id).css("color","#"+color);
		}
		else
		{
			$("#"+id).css("color","#97a0ae");
		}
	}
}
