﻿jQuery(function rdbb()
{
    jQuery(".radiobtn li").bind('click', function() 
	{
		try
		{
			var rdb = jQuery(this);
			if(rdb.hasClass('rdb-off'))
			{
				rdb.parent().children().removeClass('rdb-on');
				rdb.parent().children().addClass('rdb-off');
				rdb.parent().find('input').removeAttr('checked');
				rdb.removeClass('rdb-off');
				rdb.addClass('rdb-on');
				jQuery(this).find('input').attr("checked", "checked");
			}
			else
			{
				rdb.removeClass('rdb-on');
				rdb.addClass('rdb-off');
				jQuery(this).find('input').removeAttr('checked');
				
			}
		}
		catch(error){}
		return false;
	});
	
	jQuery("#js-hit-button input").bind('click', function()
	{
		jQuery(".hit-tnk").show();
		window.scrollTo(0, 11500);
		return false;
	});	
})

jQuery(function best()
{
	jQuery(".za").bind('click', function()
	{
		var za = jQuery(this);
		if( za.find(".best-radio span").hasClass('best-checked') ) {
			za.find('.best-radio span').removeClass('best-checked');
			za.parents(".best-artists-block").removeClass('best-good');
			za.find('input').removeAttr("checked");
		} else {
			
			jQuery('.best-good').find('.za span.best-checked').removeClass('best-checked');
			jQuery(".best-artists-block").removeClass('best-good');
			
			za.parents(".best-artists-block").removeClass('best-bad');
			za.find('.best-radio span').addClass('best-checked');
			za.next().find('.best-radio span').removeClass('best-checked');
			
			za.parents(".best-artists-block").addClass('best-good');
			za.find('input').attr("checked","checked");
			
		}
	});
	jQuery(".protiv").bind('click', function()
	{
		var protiv = jQuery(this);
		if( protiv.find(".best-radio span").hasClass('best-checked') ) {
			protiv.find('.best-radio span').removeClass('best-checked');
			protiv.parents(".best-artists-block").removeClass('best-bad');
			protiv.find('input').removeAttr("checked");
		} else {
			
			jQuery('.best-bad').find('.protiv span.best-checked').removeClass('best-checked');
			jQuery(".best-artists-block").removeClass('best-bad');
			
			protiv.parents(".best-artists-block").removeClass('best-good');
			protiv.find('.best-radio span').addClass('best-checked');
			protiv.prev().find('.best-radio span').removeClass('best-checked');
			
			protiv.parents(".best-artists-block").addClass('best-bad');
			protiv.find('input').attr("checked","checked");
			
		}
	});
})

jQuery(function clothes()
{
	jQuery(".best-clothes").bind('click', function() {
		var rdb = jQuery(this);
		if( rdb.hasClass('best-clothes-checked') ) {
			rdb.removeClass('best-clothes-checked');
			rdb.find('input').removeAttr('checked');
		} else {
			jQuery(".best-clothes").find('input').removeAttr('checked');
			jQuery(".best-clothes").removeClass('best-clothes-checked');
			rdb.addClass('best-clothes-checked');
			rdb.find('input').attr("checked", "checked");
		}
		return false;
	});
})

jQuery(function hit()
{
	jQuery("#js-hitlist li").bind('click', function(event)
	{
		var hitl = jQuery(this);
		if( hitl.hasClass('selected') ) {
			hitl.removeClass('selected');
			hitl.addClass('ie6-png');
			hitl.find('input').removeAttr('checked');
		} else {
			jQuery("#js-hitlist li").removeClass('selected');
			jQuery("#js-hitlist li").addClass('ie6-png');
			jQuery("#js-hitlist li").find('input').removeAttr('checked');
			hitl.removeClass('ie6-png');
			hitl.addClass('selected');
			hitl.find('input').attr('checked','checked');
		}
		return false;
	});
})

jQuery(function()
{
    jQuery(".js-login").tValue({val: "имя пользователя"});
	jQuery(".js-pass").tValue({val: "пароль"});
	jQuery(".js-search").tValue({val: "найти на сайте"});
})

jQuery(function media()
{
	jQuery("#js-media a").hover(
	      function () {
			jQuery(this).addClass('hovered');
	      }, 
	      function () {
	        jQuery(this).removeClass('hovered');
	      }
	 );
})

jQuery(function gid()
{
	jQuery("#js-close").bind('click', function(event) {
		var cl = jQuery(this);
		if( cl.hasClass('show') ) {
			cl.next().show();
			cl.parent().removeClass('gid-hidden');
			cl.removeClass('show');
		} else {
			cl.next().hide();
			cl.parent().addClass('gid-hidden');
			cl.addClass('show');
		}
		return false;
	});
})

jQuery(function cl()
{
	jQuery(".close-mes").bind('click', function(event)
	{
			jQuery(this).parent().fadeOut();
	});
	setTimeout(function(event){jQuery(".close-mes").parent().fadeOut();}, 5000);
})

jQuery(window).bind('load', function(event)
{
	jQuery("#js-hitlist li:odd").addClass("hit-even");
	jQuery("#js-online").tMask({radius: '175'});
	jQuery("#js-online-inner").tMask({radius: '100'});
	jQuery("#js-gallery img").tMask({radius: '95'});
	jQuery(".js-news").tMask({radius: '50'});
	jQuery(".round_b img").tMask({radius: '95'});
	jQuery(".best-artists-pic img").tMask({radius: '50'});
	if(!jQuery.fontAvailable('HeliosThinRegular'))
	{
		Cufon.replace('.info h1, .song-block span, .nav-link, .survey-title, .edit-profile h4, .best-container h2, .best-container h3');
	}
	try
	{
		jQuery("#js-hit-field").quicksearch("#js-hitlist li");
	}
	catch(error){}
})

function getMovie(movieName)
{
	if (navigator.appName.indexOf("Microsoft") != -1)
		return window[movieName];
	else
		return document[movieName];
}

function loadFrame(swf, frame)
{}

function jsProxy(arg)
{
	jQuery("#accordion").accordion('activate', parseInt(arg));
}
