function ddSlide(navigation_id, pad_out, pad_in, time)
{
	// creates the target paths
	var list_elements = navigation_id + " li.sliding-element";

	// creates the hover-slide effect for all link elements 		
	jQuery(list_elements).each(function(i)
	{
		jQuery(this).hover(
		function()
		{
			jQuery(this).addClass('active-item');
			/*$( 'a:first', this).animate({ paddingLeft: pad_out }, time);*/
			jQuery('ul.submenu', this).css('display', 'block');
		},		
		function()
		{
			/*$( 'a:first', this).animate({ paddingLeft: pad_in }, time);*/
			jQuery('ul.submenu', this).css('display', 'none');
			jQuery(this).removeClass('active-item');
		});
	});
}

function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};


jQuery(document).ready(function() {
    ddSlide("#main-menu", 15, 0, 150);
    if (jQuery.browser.msie && jQuery.browser.version == 6) {
        jQuery('#ie6-warning').show();
        jQuery('#fix').hide();
        jQuery('#founded-list a.gold-button').addClass('fix-ie6-link');
    }

    jQuery('a[rel="cbox"]').colorbox();
    
    jQuery('#foto-carousel a').colorbox();
    
    jQuery('#special-offers').jcarousel({
        auto: 5,
        scroll: 3,
        wrap: 'circular',
        initCallback: mycarousel_initCallback
    });
    
    jQuery('#foto-carousel').jcarousel({   
        scroll: 3,
        wrap: 'circular'
    });

    jQuery('#select-all').click(function(){
       $('input:checkbox').attr("checked","checked"); 
       $('#chb-all').attr("checked","checked"); 
    });
    
    jQuery('input[name="remark"]').click(function(){
       alert($(this).val()); 
    });
    
    //Set default open/close settings
    jQuery('.acc_container').hide(); //Hide/close all containers
    jQuery('.active_triger').next().show(); //Add "active" class to first trigger, then show/open the immediate next container
    //On Click
    jQuery('.acc_trigger').click(function(){
    	if( jQuery(this).next().is(':hidden') ) { //If immediate next container is closed...
    		jQuery('.acc_trigger').removeClass('active').next().slideUp(); //Remove all "active" state and slide up the immediate next container
    		jQuery(this).toggleClass('active').next().slideDown(); //Add "active" state to clicked trigger and slide down the immediate next container
        }
    	return false; //Prevent the browser jump to the link anchor
    });
    
});

jQuery(document).ready(function() {
jQuery('.review-link').click (function() {
	// alert(jQuery(this).next('p').is(':visible'));
if (!jQuery(this).prev('p').is(':visible'))
{
	jQuery(this).prev('p').slideDown();
	jQuery(this).text('Скрыть');
}
else
{
	jQuery(this).prev('p').slideUp();
	jQuery(this).text('Читать');
}
return false;
})

});

var $j = jQuery.noConflict();

function jqsocial(url,title) {
	var folder = 'images/social/';
	document.write('<div class="jsb-wrap"><div class="jsb-title"><span title="Кликните для переключения" id="tabhead"></span></div><ul class="jsb-list">');
	function so(url,title) {
		for (i=0; i< s.length; i=i+2) document.write(
			'<li><a style="background: url('+folder+s[i]+'.ico) no-repeat; background-position: 0 50%" href="http://'+s[i]+'/'+s[i+1].replace('{u}',url).replace('{t}',title)+'">'+s[i]+'</a></li>'
		);
	}
	var s=new Array(
		'100zakladok.ru','save/?bmurl='+url+'&bmtitle='+title,
		'delicious.com','post?url='+url+'&title='+title,
		'google.com','bookmarks/mark?op=edit&bkmk='+url+'&title='+title,
		'bobrdobr.ru','add.html?url='+url+'&title='+title,
		'links.i.ua','mark/?url='+url+'&ename='+title,
		'memori.ru','link/?sm=1&u_data[url]='+url+'&u_data[name]='+title,
		'moemesto.ru','post.php?url='+url+'&title='+title,
		'mister-wong.ru','add_url/?bm_url='+url+'&bm_description='+title,
		'linkstore.ru','servlet/LinkStore?a=add&url='+url+'&title='+title,
		'lopas.ru','add_story.php?story_url='+url,
		'myscoop.ru','add/?title='+title+'&URL='+url,
		'ruspace.ru','index.php?link=bookmark&action=bookmarkNew&bm=1&url='+url+'&title='+title,
		'vaau.ru','submit/?action=step2&url='+url
	);
	so (url,title);
	document.write('</ul></div>');
}

$j(document).ready(function() {
	var is_toogled = false;
	$j('.jsb-wrap a').attr({target: '_blank'});
	$j('.jsb-wrap').hover(
		function() {
			$j(this).addClass('jsb-current');
			$j('.jsb-current ul').css({opacity: 0}).hide();
			$j('.jsb-current .jsb-list').animate({opacity: 1}, 300).show();
			$j('.jsb-current .jsb-title').addClass('jsb-s');
		},
		function() {
			if( is_toogled == true ) { $j('.jsb-title').click(); }
			$j('.jsb-current ul').hide();
			$j('.jsb-current .jsb-title').removeClass('jsb-s');
			$j('.jsb-current .jsb-title span').text('');
			$j('.jsb-wrap').removeClass('jsb-current');
		}
	);
	$j('.jsb-title').toggle(
		function() {
			$j('.jsb-current .jsb-list').css({opacity: 0}).hide();
			$j('.jsb-current .jsb-title').removeClass('jsb-s');
			$j('.jsb-current .jsb-title span').text('');
			is_toogled = true;
		},
		function() {
			$j('.jsb-current .jsb-list').css({opacity: 0}).hide();
			$j('.jsb-current .jsb-list').animate({opacity: 1}, 300).show();
			$j('.jsb-current .jsb-title').addClass('jsb-s');
			$j('.jsb-current .jsb-title span').text('');
			is_toogled = false;
		}
	);
})
