$(document).ready(function()
{

var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

if ((version >= 5.5) && (document.body.filters)) 
{
   for(var i=0; i<document.images.length; i++)
   {
      var img = document.images[i]
      var imgName = img.src.toUpperCase()
      if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
      {
         var imgID = (img.id) ? "id='" + img.id + "' " : ""
         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
         var imgStyle = "display:inline-block;" + img.style.cssText 
         if (img.align == "left") imgStyle = "float:left;" + imgStyle
         if (img.align == "right") imgStyle = "float:right;" + imgStyle
         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
         var strNewHTML = "<span " + imgID + imgClass + imgTitle
         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
         img.outerHTML = strNewHTML
         i = i-1
      }
   }
}


if( $.browser.msie && (jQuery.browser.version < 7.0000) ) 
	{
    
    }
    
if($("#cart").length)
	{
	$('#carousel-mz').jcarousel({scroll: 1});
	$('#carousel-dvd').jcarousel({scroll: 1});
	$('#cart').load('/shop/cart');	
	if (gotoform)
		{window.scrollTo(0, $('#anchor').offset().top)}
	}

if ($('.coloredmenu'))
	{
	menus = $('.coloredmenu');
	for (var x = 0; x <menus.length; x++)
		{
		if($(menus[x]).hasClass('colapse'))
			{$('ul:not(:has(a.curent))', menus[x]).hide();}		
		$('li:has(ul)[class^=color] > a', menus[x]).click(function()
			{
			$('#'+this.id.replace('a','u')).slideToggle('slow');
			return false;
			}
		);
		}	 
	}    

if ($('#smallsrollcoverprev'))
	{
	$('#smallsrollcoverprev').click(function()
		{
		targ = this.href.split('#')[1];
		if (targ == 'na')
			{return false;}
		$('#smallscrollcovertd').attr("align", 'right');
		$('#smallscrollcover2').hide('slow', function()
			{
			var html = $.ajax({type: "GET", data: "id="+targ, url: "/archive/ajaxcover", async: false}).responseText;			
			pars = html.split('%%');
			$('#smallscrollcover2').attr('src',pars[1]);
			$('#smallsrollcoverprev').attr('href','#'+pars[3]);
			$('#smallsrollcovernext').attr('href','#'+pars[4]);
			$('#covernamespan').html(pars[2]);
			$('#smallscrollcoverlink').attr('href',pars[0]);
			
			$('#smallscrollcovertd').attr("align", 'left');
			$('#smallscrollcover2').show('slow', function (){$('#smallscrollcovertd').attr("align", 'center');});
			});
		return false;
		});

	$('#smallsrollcovernext').click(function()
		{
		targ = this.href.split('#')[1];
		if (targ == 'na')
			{return false;}		
		$('#smallscrollcovertd').attr("align", 'left');
		$('#smallscrollcover2').hide('slow', function()
			{
			var html = $.ajax({type: "GET", data: "id="+targ, url: "/archive/ajaxcover", async: false}).responseText;			
			pars = html.split('%%');
			$('#smallscrollcover2').attr('src',pars[1]);
			$('#smallsrollcoverprev').attr('href','#'+pars[3]);
			$('#smallsrollcovernext').attr('href','#'+pars[4]);
			$('#covernamespan').html(pars[2]);
			$('#smallscrollcoverlink').attr('href',pars[0]);
						
			$('#smallscrollcovertd').attr("align", 'right');
			$('#smallscrollcover2').show('slow', function (){$('#smallscrollcovertd').attr("align", 'center');});
			});
		return false;
		});
	}		
});


function addpic()
{
	a = $(".pic:last").attr("name");
	newnum = parseFloat(a.substring(3))+1;
	$(".pic:last").after("<br /><input type=\"file\" name=\"pic" + newnum + "\" class=\"pic\"");

}

function quote(cid)
{
	quot = $("#" + cid).text();
	oldtext = $("#text").text();
	$("#text").text(oldtext + '<blockquote>' + quot + "</blockquote>\n");
}
function quotename(name)
{
	oldtext = $("#text").text();
	$("#text").text(oldtext + name + ':');
}
