// idea & code by RGdesign.org - 2008

/* image corners */
/* i use this only on some images, the big ones, because the script generates many objects to render rounded corners, so, the best to use this is to use the less  posible - the effect apply to a p and inside it the image*/
jQuery(document).ready(function() {
	$('.imageCorner').corner("6px");
	
});

/* calendar carrousel */
function mycarousel_initCallback(carousel) {
    jQuery('#mycarousel3-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#mycarousel3-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

jQuery(document).ready(function() {
	jQuery('#mycarousel').jcarousel({
        vertical: true,
        scroll: 3
    });
    jQuery('#mycarousel2').jcarousel({
        vertical: true,
        scroll: 2
    });
	jQuery('#mycarousel3').jcarousel({
        vertical: true,
		initCallback: mycarousel_initCallback,
        scroll: 3
    });
	
	/* for the mp3 player */
	jQuery('#mycarousel3 li').each(function(){
		if($(this).attr('id') == 'actived'){
			var mp3 = $(this).find('.playBt').attr('href');
			var title = $(this).find('.title').text();
			var artist = $(this).find('.artist a').text();
			var date = $(this).find('.date').text();
			var passedtitle = title + " // " + artist + " // " + date;
			insertPlayer(mp3, passedtitle);
		}
		$(this).find('.playBt').click(
				function(){
					var mp3 = $(this).attr('href');
					
					var title = $(this).parents('li').find('.title').text();
					var artist = $(this).parents('li').find('.artist a').text();
					var date = $(this).parents('li').find('.date').text();
					var passedtitle = title + " // " + artist + " // " + date;
					
					insertPlayer(mp3, passedtitle);
					
					$('#mycarousel3 #actived .playBt img').attr('src', 'images/bt_play.gif');
					$('#mycarousel3 #actived .playBt img').attr('alt', 'PLAY NOW');
					$('#mycarousel3 #actived').attr('id', '');
					
					$(this).parents('li').attr('id', 'actived');
					$('#mycarousel3 #actived .playBt img').attr('src', 'images/trackPlaying.gif');
					$('#mycarousel3 #actived .playBt img').attr('alt', 'PLAYING');
					
					return false;
				}
			);
		})
		/* for the mp3 player */
});
/* form */
jQuery(document).ready(function() {
	$('.enableForm').click(function(){
		$("input[type='text']:first", document.forms[1]).focus();
	});

	$('input[type="text"], textarea').focus(function() {
		if (this.value == this.defaultValue){ 
			this.value = '';
		}
		if(this.value != this.defaultValue){
			this.select();
		}
	});
	$('input[type="text"], textarea').blur(function() {
		if ($.trim(this.value) == ''){
			this.value = (this.defaultValue ? this.defaultValue : '');
		}
		
	});
});	
/* fades */
jQuery(document).ready(function() {
	jQuery.fn.fadeLink = function(start,end){
		return this.each(function() {			
			$(this).hover(
				function(){$(this).animate({"opacity":end}, 250);},
				function(){$(this).animate({"opacity":start}, 250);}
			);
			if(!$(this).parent('li').hasClass("sel")){
				}
			$(this).css({"opacity":start});
		});
	}
});
jQuery(document).ready(function() {
	jQuery.fn.fadeLinkTo = function(start,end,obj){
		return this.each(function() {			
			$(this).hover(
				function(){$(obj).animate({"opacity":end}, 250);},
				function(){$(obj).animate({"opacity":start}, 250);}
			);
			$(obj).css({"opacity":start});
		});
	}
});
/* fades css assigns */
$(function() {
	$('.mycarouselRG li').fadeLink(0.7,1);
	$('.mycarouselRG2 li a').fadeLink(0.7,1);
	$('.mycarouselRG3 .button a').fadeLink(0.7,1);
	//$('.mycarouselRG3 .fade').fadeLink(0.7,1);
	
	$('#bt_subscribe').fadeLink(0.7,1);
	$('.thumbs_page li img').fadeLink(0.5,1);
	$('.bt_fullBIO').fadeLink(0.7,1);
	$('.buttons a img').fadeLink(0.7,1);
	$('.button_buy a img').fadeLink(0.7,1);
	
	/* calendar */
	$('div.calendar_box').fadeLink(0.8,1);
	$('div.calendar_box .moreinfo a').fadeLink(0.7,1);
	$('#calendar_event .thumb').fadeLink(0.7,1);
	$('div.djs_box').fadeLink(0.8,1);
	/* calendar */
	
	/* gallery */
	$('#ws_gallery .box').fadeLink(0.8,1);
	$('#ws_gallery .box .moreinfo a').fadeLink(0.7,1);
	
	$('#galleryThumbs .thumb').fadeLink(0.7,1);
	/* gallery */

	/* merchandise */
	$('#ws_merchandise .box').fadeLink(0.8,1);
	$('#ws_merchandise .box .moreinfo a').fadeLink(0.7,1);
	
	/* merchandise */
	
	/* ws_merchandise_product */
	$('#ws_merchandise_product .thumb').fadeLink(0.7,1);
	$('#ws_merchandise_product .cafepress').fadeLink(0.7,1);
	/* ws_merchandise_product */
	
	/* record label */
	$('ul.filterListBy li span').css({"opacity":0.7});
	$('#ws_recordLabel .beatport').fadeLink(0.7,1);
	$("ul.filterListBy li a").each(function(){
		if(!$(this).parent('li').hasClass("sel")){
					$(this).fadeLink(0.7,1);			
			}

		 })
	
	/* record label */
	
	/* cart */
	$('.cartBt').fadeLink(0.7,1);
	/* cart */



	$('.imageCorner').fadeLink(0.8,1);

	$('ul.djlist li a').fadeLink(0.7,1);
	$('ul.dj_links li a').fadeLink(0.7,1);
	
	$('#form button').fadeLink(0.7,1);
	
	$('#nyroModalFull a#closeBut').fadeLink(1,0.8);
	
	$('ul.calendarEventsList .active').fadeLink(0.7,1);
	
	/* main menu */
	$("#mainMenu a").each(function(){
		if(!$(this).parent('li').hasClass("sel")){
					$(this).fadeLink(0.5,1);			
			}

		 })
	/* main menu */
	
	/* home boxes */	
	$('#hbox_1').fadeLinkTo(0.7,1,'#moreinfoBt1');
	$('#hbox_2').fadeLinkTo(0.7,1,'#moreinfoBt2');
	$('#hbox_3').fadeLinkTo(0.7,1,'#moreinfoBt3');
	/* home boxes */
});

/* imageBox */

$(document).ready(function(){
	$.fn.colorbox.settings.transition = "fade";
	$.fn.colorbox.settings.bgOpacity = "0.97";
	$.fn.colorbox.settings.contentCurrent = "image {current} of {total}";
	$.fn.colorbox.settings.initialWidth = 200;
	$.fn.colorbox.settings.initialHeight = 200;
	
	$(".cpModal").colorbox();
	
	/* this way i use the href on the .cpModalFlash css links and take only the v parameter to include it on the flash.php */
	$(".cpModalFlash").each(function(){
		url = $(this).attr("href");
		v = url.slice(url.indexOf('watch?v=') + 8, url.length)
		$(this).colorbox({contentAjax:"colorbox/flash.php?id=" +v});
	});
	
});



    
//-->