(function($) {
    $(function() {
		// pause autoscrolling of providers carousel if the user moves with the cursor over the clip
		function mycarousel_initCallback(carousel)
		{
			carousel.clip.hover(function() {
				carousel.stopAuto();
			}, function() {
				carousel.startAuto();
			});
		};

		// slider on index page
		$("#featured > ul").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 5000, true);

		// providers carousel
		jQuery('#providers-carousel').jcarousel({
			auto: 1,
			wrap: 'circular',
			animation: 5000,
			easing:'linear',
			scroll:1,
			buttonNextHTML:null,
			buttonPrevHTML:null,
			initCallback: mycarousel_initCallback
		});

		// main menu
		 $('ul.sf-menu').superfish({
			delay:1000,
			pathLevels:1,
			animation: {height: 'show'},
			speed:0,
			autoArrows:false,
			dropShadows:true
		});

		 $('.image-with-opacity').each(
			function() {
				$(this).css('opacity', '0.4');
		});
		$('.image-with-opacity').hover(
			function() {
				$(this).stop().animate({'opacity': '1'}, 'slow');
			},
			function() {
				$(this).stop().animate({'opacity': '0.4'}, 'slow');
		});
		
		// contact form
		$('.placeholder').example(function() {
			return jQuery(this).attr('placeholder');
		});

		$('#contact-form').validate();

		$( "ul.information-for" ).accordion({
				event: "mouseover",
				autoHeight: false,
				navigation: true
		});
		
		//remove width and margin where there is not thumbnail
		$(".blog-list-info td.author-img a").each(
			function(){
				if($(this).html() == ''){
					$(this).parents(':first').css({width:0, padding: 0});
				}
			}
		);
		
		//VPS store
		$('#store-but-submit').click(function(){
			/*if($('a.store-but').attr('id') == 'store-but-log-pass'){
				$('.store-form.first-step input[type=password]').each(function(){
					$(this).val(hex_md5($(this).val()));
				});
			}*/

			$('input.store-submit').trigger('click');
			return false;
		});

                $('.billing-text').one('click', function(){
                    this.value = '';
                });
                $('.billing-text-short').one('click', function(){
                    this.value = '';
                });
    });
})(jQuery);

