$(document).ready(
	function(){
				
		/* rounded corners for news (ie) */
		if($.browser.msie){
			var bg_color = "#eee";
			var dumb = "<v:roundrect strokecolor='" + bg_color + "' strokeweight='1px' fillcolor='" + bg_color + "' arcsize='0.5'></v:roundrect>";
			$("div.quote > blockquote").each(
				function()
				{
					$(this).addClass("rounded");
					this.innerHTML = dumb + "<div>" + this.innerHTML + "</div>" + dumb;
				}
			);
		}

		/* gallery */
		if( $("#gallery_links") ){

			// global path to gallery images
//			var gallery_path = 'i/_tmp_files/gallery/';
			var gallery_path = '/images';

			function getPath(link)
			{
				 return link = (link.indexOf('http://') > -1) ? jQuery.trim(link) : gallery_path + jQuery.trim(link);
			}

			$("#gallery_nav > a").each(
				function(index)
				{
					if(index){
						$tmpArray = this.name.split(',', 3);
						$("#gallery_links").append("<a href='" + getPath($tmpArray[1]) + "' title='" + 	$tmpArray[2] + "' class='thickbox' rel='gallery-pic' style='background:url(" + getPath($tmpArray[0]) + ")'></a>");
					}
				}
			);

			$("#gallery_nav > a").click(
				function()
				{
					$("#gallery_nav > a").each(function(){	this.className = ''; });
					$("#gallery_links > a").empty();
					var $tmpArray = $(this).attr("name").split(',', 3);
					$("#gallery_links > a.current").removeClass("current");
					$("#gallery_links > a").each(
						function()
						{
							if( this.href.indexOf(getPath($tmpArray[1])) > -1 ){
								$(this).addClass("current");
							}
						}
					);
					$(this).addClass("active");
					$(this).blur();
				}
			);

			tb_init('a.thickbox, area.thickbox, input.thickbox');
			imgLoader = new Image();
			imgLoader.src = tb_pathToImage;
		}


		/* hidden blocks */
		if( $("div.hidden_blocks") ){
			$("div.hidden_blocks > div > h6 > a").click(
				function(event){
					event.preventDefault();
					$(this).blur();
					var targetEl = $(this.parentNode.parentNode).find("div");
					if (targetEl.css("display") == 'block') {
						targetEl.fadeOut("fast");
					} else {
						targetEl.fadeIn("slow");
					}
				}
			);
		}

	}
);



