//
// EX hm.js
//
var trans=[];
var snart=[];
for(var i=0x410;i<=0x44F;i++)
{
    trans[i]=i-0x350;
    snart[i-0x350] = i;
}
trans[0x401]= 0xA8;
trans[0x451]= 0xB8;
snart[0xA8]    = 0x401;
snart[0xB8]    = 0x451;

window.urlencode = function(str)
{
    var ret=[];
    for(var i=0;i<str.length;i++)
    {
        var n=str.charCodeAt(i);
        if(typeof trans[n]!='undefined')
            n = trans[n];
        if (n <= 0xFF)
            ret.push(n);
    }
    
    return window.escape(String.fromCharCode.apply(null,ret));
}

window.urldecode = function(str)
{
    var ret=[];
    str = unescape(str);
    for(var i=0;i<str.length;i++)
    {
        var n=str.charCodeAt(i);
        if(typeof snart[n]!='undefined')
            n = snart[n];
        ret.push(n);
    }
    
    return String.fromCharCode.apply(null,ret);
}
	
	jsHover = function() {
		var hEls = document.getElementById("nav").getElementsByTagName("LI");
		for (var i=0, len=hEls.length; i<len; i++) {
			hEls[i].onmouseover=function() { this.className+=" jshover"; }
			hEls[i].onmouseout=function() { this.className=this.className.replace(" jshover", ""); }
		}
	}
	if (window.attachEvent && navigator.userAgent.indexOf("Opera")==-1) window.attachEvent("onload", jsHover);
	
	function CheckSearch()
	{ 
       var searchdata;
	   searchdata = document.getElementById("searchfiels").value;
	   location.href = "/search/~search="+urlencode(searchdata);
	}
	
	function Zoom(xlink,x,y){
		x1=x+20;
		y1=y+100;
		window.open(xlink,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,height="+y1+",width="+x1);
	}
	
jQuery(function(){
    //Гармошка брендов справочника
    $(".allbrandsbutt").click(function(e){

        //e.preventDefault();
        //this.blur();

        var sh = $(".allbrands");
        if (sh.is(":hidden")) {
            sh.show('fast');
        } else {
            sh.hide('fast');
        }
    });
});

//
// EX block_albums.js
//
function SwitchList(lst)
	{
		switch(lst)
		{
				case 1:
				if (document.getElementById("new_tracks_alb")!=null)
					document.getElementById("new_tracks_alb").style.display="none";	
				if (document.getElementById("ownalbs")!=null)
					document.getElementById("ownalbs").style.display="inline";
				if (document.getElementById("mixalbs")!=null)
					document.getElementById("mixalbs").style.display="none";
				if (document.getElementById("othalbs")!=null)
					document.getElementById("othalbs").style.display="none";
				
				if (document.getElementById("aswtch")!=null)
					document.getElementById("aswtch").className = 'active';
				if (document.getElementById("cswtch")!=null)
					document.getElementById("cswtch").className = 'inactive';
				if (document.getElementById("oswtch")!=null)
					document.getElementById("oswtch").className = 'inactive';
				if (document.getElementById("ntswtch")!=null)
					document.getElementById("ntswtch").className = 'inactive';
				
				break;
			case 2:
				if (document.getElementById("new_tracks_alb")!=null)
					document.getElementById("new_tracks_alb").style.display="none";	
				if (document.getElementById("ownalbs")!=null)
					document.getElementById("ownalbs").style.display="none";
				if (document.getElementById("mixalbs")!=null)
					document.getElementById("mixalbs").style.display="inline";
				if (document.getElementById("othalbs")!=null)
					document.getElementById("othalbs").style.display="none";
				
				if (document.getElementById("aswtch")!=null)
					document.getElementById("aswtch").className = 'inactive';
				if (document.getElementById("cswtch")!=null)
					document.getElementById("cswtch").className = 'active';
				if (document.getElementById("oswtch")!=null)
					document.getElementById("oswtch").className = 'inactive';
				if (document.getElementById("ntswtch")!=null)
					document.getElementById("ntswtch").className = 'inactive';
				break;
			case 3:
				if (document.getElementById("albsS")!=null)
					document.getElementById("albsS").style.display="inline";	
				if (document.getElementById("albsB")!=null)
					document.getElementById("albsB").style.display="none";
				if (document.getElementById("albsA")!=null)
					document.getElementById("albsA").style.display="none";
				if (document.getElementById("albsK")!=null)
					document.getElementById("albsK").style.display="none";
					
				if (document.getElementById("swtchS")!=null)
					document.getElementById("swtchS").className = 'active';
				if (document.getElementById("swtchB")!=null)
					document.getElementById("swtchB").className = 'inactive';
				if (document.getElementById("swtchA")!=null)
					document.getElementById("swtchA").className = 'inactive';
				if (document.getElementById("swtchK")!=null)
					document.getElementById("swtchK").className = 'inactive';
				break;
			case 4:
				if (document.getElementById("albsS")!=null)
					document.getElementById("albsS").style.display="none";	
				if (document.getElementById("albsB")!=null)
					document.getElementById("albsB").style.display="inline";
				if (document.getElementById("albsA")!=null)
					document.getElementById("albsA").style.display="none";
				if (document.getElementById("albsK")!=null)
					document.getElementById("albsK").style.display="none";
					
				if (document.getElementById("swtchS")!=null)
					document.getElementById("swtchS").className = 'inactive';
				if (document.getElementById("swtchB")!=null)
					document.getElementById("swtchB").className = 'active';
				if (document.getElementById("swtchA")!=null)
					document.getElementById("swtchA").className = 'inactive';
				if (document.getElementById("swtchK")!=null)
					document.getElementById("swtchK").className = 'inactive';
				break;
			case 5:
				if (document.getElementById("albsS")!=null)
					document.getElementById("albsS").style.display="none";	
				if (document.getElementById("albsB")!=null)
					document.getElementById("albsB").style.display="none";
				if (document.getElementById("albsA")!=null)
					document.getElementById("albsA").style.display="inline";
				if (document.getElementById("albsK")!=null)
					document.getElementById("albsK").style.display="none";
					
				if (document.getElementById("swtchS")!=null)
					document.getElementById("swtchS").className = 'inactive';
				if (document.getElementById("swtchB")!=null)
					document.getElementById("swtchB").className = 'inactive';
				if (document.getElementById("swtchA")!=null)
					document.getElementById("swtchA").className = 'active';
				if (document.getElementById("swtchK")!=null)
					document.getElementById("swtchK").className = 'inactive';
				break;
			case 6:
				if (document.getElementById("albsS")!=null)
					document.getElementById("albsS").style.display="none";	
				if (document.getElementById("albsB")!=null)
					document.getElementById("albsB").style.display="none";
				if (document.getElementById("albsA")!=null)
					document.getElementById("albsA").style.display="none";
				if (document.getElementById("albsK")!=null)
					document.getElementById("albsK").style.display="inline";
					
				if (document.getElementById("swtchS")!=null)
					document.getElementById("swtchS").className = 'inactive';
				if (document.getElementById("swtchB")!=null)
					document.getElementById("swtchB").className = 'inactive';
				if (document.getElementById("swtchA")!=null)
					document.getElementById("swtchA").className = 'inactive';
				if (document.getElementById("swtchK")!=null)
					document.getElementById("swtchK").className = 'active';
				break;
		}
	}

// Social Buttons
function social_btns(f,u,t){if(!u)u=location.href;if(!t)t=document.title;u=encodeURIComponent(u);t=encodeURIComponent(t);var s=new Array('"http://www.facebook.com/sharer.php?u='+u+'&t='+t+'" title="Поделиться в Facebook"','"#" onclick="window.open(\'http://vkontakte.ru/share.php?url='+u+'\', \'_blank\', \'scrollbars=0, resizable=1, menubar=0, left=200, top=200, width=554, height=421, toolbar=0, status=0\');return false" title="Поделиться В Контакте"','"http://www.odnoklassniki.ru/dk?st.cmd=addShare&st._surl='+u+'&title='+t+'" title="Добавить в Одноклассники"');for(i=0;i<s.length;i++)document.write('<a rel="nofollow" style="display:inline-block;width:16px;height:16px;background:url(http://maxi-exkavator.ru/images/social_buttons.png) -'+16*i+'px 0" href='+s[i]+' target="_blank"></a>')}
