// JavaScript Document
//------------------------------------------------
$(document).ready(function() {
	$("#policy").fancybox();
	$("#send_mail").removeAttr('disabled');
	//--------------------------------------------
	$("#send_mail_c").removeAttr('disabled');
	//--------------------------------------------
	$("#contact_name").val('* name');
	$("#contact_email").val('* e-mail');
	$("#contact_question").val('* your question');
	$("#contact_captcha").val('* captcha');
	//--------------------------------------------
	$("#contact_name_c").val('* name');
	$("#contact_email_c").val('* e-mail');
	$("#contact_question_c").val('* your question');
	$("#contact_captcha_c").val('* captcha');
	//--------------------------------------------
	$("#newsletter_name").val('name');
	$("#newsletter_email").val('* e-mail');
	$('input[name=newsletter_policy]').attr('checked', false);
	//--------------------------------------------
	$('#captcha').attr('src', '../modules/captcha.php');
	//--------------------------------------------
	$('#captcha_c').attr('src', '../modules/captcha.php');
	//--------------------------------------------
	$("#send_mail").click(function(){

		var hasError 	= false;
		var emailReg 	= /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;

		var emailVal 	= $("#contact_email").val();
		var nameVal 	= $("#contact_name").val();
		var questionVal = $("#contact_question").val();
		var captchaVal 	= $("#contact_captcha").val();

		var md5CaptchaVal = $.md5(captchaVal);

		if((nameVal == '') || (nameVal == '* name')) {
			$(".contact_error").text('*** Enter the name ***');
			hasError = true;
		}
		else if((emailVal == '') || (emailVal == '* e-mail')) {
			$(".contact_error").text('*** Enter the email ***');
			hasError = true;
		} else if(!emailReg.test(emailVal)) {	
			$(".contact_error").text('*** Enter a valid email ***');
			hasError = true;
		}
		else if((questionVal == '') || (questionVal == '* your question')) {
			$(".contact_error").text('*** Enter the question ***');
			hasError = true;
		}
		else if(
					(captchaVal == '') || 
					(captchaVal == '* captcha')
			) {
			$(".contact_error").text('*** Enter the captcha ***');
			hasError = true;
		}
		else if(md5CaptchaVal != $("#session_contact").text()) {
			$(".contact_error").text('*** Enter the right captcha ***');
			hasError = true;
		}
		
		if(hasError == false) {
			$(".contact_error").text('');
			var datastr ='name=' + nameVal + '&email=' + emailVal + '&question=' + questionVal;
			$(".contact_msg").html("Sending message.... ");
			setTimeout("sendMail('" + datastr + "')", 2000);
		}
		return false;
	});						   
	//--------------------------------------------
	$("#send_mail_c").click(function(){

		var hasError 	= false;
		var emailReg 	= /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;

		var emailVal 	= $("#contact_email_c").val();
		var nameVal 	= $("#contact_name_c").val();
		var questionVal = $("#contact_question_c").val();
		var captchaVal 	= $("#contact_captcha_c").val();

		var md5CaptchaVal = $.md5(captchaVal);

		if((nameVal == '') || (nameVal == '* name')) {
			$(".contact_error_c").text('*** Enter the name ***');
			hasError = true;
		}
		else if((emailVal == '') || (emailVal == '* e-mail')) {
			$(".contact_error_c").text('*** Enter the email ***');
			hasError = true;
		} else if(!emailReg.test(emailVal)) {	
			$(".contact_error_c").text('*** Enter a valid email ***');
			hasError = true;
		}
		else if((questionVal == '') || (questionVal == '* your question')) {
			$(".contact_error_c").text('*** Enter the question ***');
			hasError = true;
		}
		else if(
					(captchaVal == '') || 
					(captchaVal == '* captcha')
			) {
			$(".contact_error_c").text('*** Enter the captcha ***');
			hasError = true;
		}
		else if(md5CaptchaVal != $("#session_contact_c").text()) {
			$(".contact_error_c").text('*** Enter the right captcha ***');
			hasError = true;
		}
		
		if(hasError == false) {
			$(".contact_error_c").text('');
			var datastr ='name=' + nameVal + '&email=' + emailVal + '&question=' + questionVal;
			$(".contact_msg_c").html("Sending message.... ");
			setTimeout("sendMail_c('" + datastr + "')", 2000);
		}
		return false;
	});						   
	//--------------------------------------------
	$('input[name=newsletter_policy]').change(function(){
		if ($('input[name=newsletter_policy]').attr('checked')) {
			$(".newsletter_contact_error").text('');
			$(".newsletter_contact_msg").text('');
		}
	});
	//--------------------------------------------
/*	$('input[name=newsletter_policy]').change(function(){
		if ($('input[name=newsletter_policy]').attr('checked')) {
			$("#newsletter_subscribe").removeClass('disabled');
			$("#newsletter_subscribe").attr('disabled', false);
			$("#newsletter_unsubscribe").removeClass('disabled');
			$("#newsletter_unsubscribe").attr('disabled', false);
		}
		else {
			$("#newsletter_subscribe").addClass('disabled');
			$("#newsletter_subscribe").attr('disabled', true);
			$("#newsletter_unsubscribe").addClass('disabled');
			$("#newsletter_unsubscribe").attr('disabled', true);
		}
	});*/
	//--------------------------------------------
	$("#newsletter_subscribe").click(function(){

		$(".newsletter_contact_error").text('');
		$(".newsletter_contact_msg").text('');

		var hasError 	= false;
		var emailReg 	= /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;

		var tokenVal 	= $("#newsletter_token").val();
		var nameVal 	= $("#newsletter_name").val();
		var emailVal 	= $("#newsletter_email").val();
		var policyVal 	= $("input:checked").length;
		
		if((emailVal == '') || (emailVal == '* e-mail')) {
			$(".newsletter_contact_error").text('*** Enter the email ***');
			hasError = true;
		} else if(!emailReg.test(emailVal)) {	
			$(".newsletter_contact_error").text('*** Enter a valid email ***');
			hasError = true;
		}
		else if(policyVal == 0) {
			$(".newsletter_contact_error").text('*** Check Policy ***');
			hasError = true;
		}
		
		if(hasError == false) {
			//--------------------------------------
			//--- DISABLE --------------------------
			//--------------------------------------
			$("#newsletter_subscribe").attr('disabled', true);
			//$("#newsletter_unsubscribe").attr('disabled', true);
			$("#newsletter_name").attr('disabled', true);
			$("#newsletter_email").attr('disabled', true);
			$("#newsletter_policy").attr('disabled', true);
			//--------------------------------------
			if((nameVal == '') || (nameVal == 'name')) {
				$("#newsletter_name").val('');
				nameVal = $("#newsletter_name").val();
			}
			$(".newsletter_contact_error").text('');
			var datastr ='name=' + (nameVal == 'name' ? '' : nameVal) + '&email=' + emailVal + '&policy=' + policyVal + '&token=' + tokenVal;
			$(".newsletter_contact_msg").html("Registering.... ");
			setTimeout("registerNewsletter('" + datastr + "')", 2000);
		}
		return false;
	});						   
	//--------------------------------------------
/*	$("#newsletter_unsubscribe").click(function(){

		$(".newsletter_contact_error").text('');
		$(".newsletter_contact_msg").text('');

		var hasError 	= false;
		var emailReg 	= /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;

		var nameVal 	= $("#newsletter_name").val();
		var emailVal 	= $("#newsletter_email").val();
		var policyVal 	= $("input:checked").length;

		if((emailVal == '') || (emailVal == '* e-mail')) {
			$(".newsletter_contact_error").text('*** Enter the email ***');
			hasError = true;
		} else if(!emailReg.test(emailVal)) {	
			$(".newsletter_contact_error").text('*** Enter a valid email ***');
			hasError = true;
		}
		else if(policyVal == 0) {
			$(".newsletter_contact_error").text('*** Check Policy ***');
			hasError = true;
		}
		
		if(hasError == false) {
			if((nameVal == '') || (nameVal == 'name')) {
				$("#newsletter_name").val('');
				nameVal = $("#newsletter_name").val();
			}
			$(".newsletter_contact_error").text('');
			var datastr ='name=' + (nameVal == 'name' ? '' : nameVal) + '&email=' + emailVal + '&policy=' + policyVal;
			$(".newsletter_contact_msg").html("Unregistering.... ");
			if (!confirm('Sure to unregister?'))
				return false;
			setTimeout("unregisterNewsletter('" + datastr + "')", 2000);
		}
		return false;
	});*/
	//--------------------------------------------
	$("#div_contact").hide();
	//--------------------------------------------
	$("#link_contact").bind("click",function (event) {
		if ($('#div_contact').css('display') == "none") {
			refreshCaptcha();
			$("#contact_name").val('* name');
			$("#contact_email").val('* e-mail');
			$("#contact_question").val('* your question');
			$("#contact_captcha").val('* captcha');
			$('#div_contact').fadeIn(2000);
		}
		else {
			$('#div_contact').fadeOut(1000);
		}
		return false;
	});
	//--------------------------------------------
//	infobox = 0;
//	if ($(".right_sidebar_info").length > 0)
//		infobox = $(".right_sidebar_info").height() + 54 + 45;
	//--------------------------------------------
/*
	var $tot_genres_artists	= $("#id_genres").height() + 20;
	var $tot_horizontalthumb 	= 0
	for ($w = 0; $w < $(".right_sidebar_horizontalthumb").length; $w++){
		$tot_horizontalthumb 	+= $("#id_horizontalthumb"+$w).height() + 35;
	}
	var $tot_slideview 		= 0
	for ($w = 0; $w < $(".right_sidebar_slideview").length; $w++){
		$tot_slideview 		+= $("#id_slideview"+$w).height() + 35;
	}
	var $tot_verticalthumb 	= 0
	for ($w = 0; $w < $(".right_sidebar_verticalthumb").length; $w++){
		$tot_verticalthumb 	+= $("#id_verticalthumb"+$w).height() + 35;
	}
	max0	 				= $tot_genres_artists + $tot_horizontalthumb + $tot_slideview + $tot_verticalthumb + infobox;
	max1 					= $tot_genres_artists + $tot_horizontalthumb + $tot_slideview + $tot_verticalthumb + infobox;

	var page 				= String(window.location.pathname);
	var $tot_content = 0;
	for ($w = 0; $w < $(".content_titolo_about_violet").length; $w++){
		$tot_content 		+= $(".content_titolo_about_violet").height() + 20;
	}
	for ($w = 0; $w < $(".content_titolo_about_black").length; $w++){
		$tot_content 		+= $(".content_titolo_about_black").height() + 20;
	}
	for ($w = 0; $w < $(".content_testo_about").length; $w++){
		$tot_content 		+= $(".content_testo_about").height();
	}
	if (page == "/about.php")
		max1 = (max1 > $tot_content ? max1 : $tot_content);

	max1					= (max1 < 700 ? 700 : max1);
*/
	//--------------------------------------------
	// Search form
	//--------------------------------------------
	$("#search-form").click(function(){
		if(!$(this).hasClass("active")){
			var input=$(this).find("input.text");
			$(this).removeClass("frozen");
			$(this).addClass("active");
			input.stop().animate({width:122}, 500).focus().attr("placeholder","");
			if(input.val()=="search"){input.val("")}
			return false
		}
	});
	//--------------------------------------------
	$("#search-form").submit(function(){
		$(this).data("submitted",true);
		return true
	});
	//--------------------------------------------
	$("#search-form input.text").focus(function(){$("#search-form").data("submitted",false)});
	//--------------------------------------------
	$("#search-form input.text").blur(function(){
		var self=this;
		setTimeout(function(){
			if(!$("#search-form").data("submitted")){
				$("#search-form").removeClass("active");
				if(!$(self).val()){
					$("#search-form input.text").val("search").stop().animate({width:45}, 500)
				}
				else{
					$("#search-form").addClass("frozen")
				}
			}
		},500)
	});
	//--------------------------------------------
	//--------------------------------------------
	$('ul.main-photo-gallery li a').hover(
		function() {
			$(this).find('.all_photo_gallery').animate(
			{
				display:'block',
				opacity: 0.65,
				filter: 'alpha(opacity=65)'
			}, 300);
			$(this).find('.thumbnail_video').animate(
			{
				display:'block',
				opacity: 0.65,
				filter: 'alpha(opacity=65)'
			}, 300);
	},
		function() {
			$(this).find('.all_photo_gallery').animate(
			{
				filter: 'alpha(opacity=25)',
				opacity: 0.25
			}, 300);
			$(this).find('.thumbnail_video').animate(
			{
				filter: 'alpha(opacity=100)',
				opacity: 1
			}, 300);
	});





	$('ul.slides li a').hover(
		function() {
			$(this).find('.feature-title').animate(
			{
				opacity: 0.70,
				filter: 'alpha(opacity=70)'
			}, 300);
			$(this).animate(
			{
				opacity: 0.70,
				filter: 'alpha(opacity=70)'
			}, 300);
			$(this).parent().animate(
			{
				backgroundColor: '#000000'
			}, 300);
			$(this).find('.video').animate(
			{
				display:'block',
				opacity: 0.65,
				filter: 'alpha(opacity=65)'
			}, 300);
	},
		function() {
			$(this).find('.feature-title').animate(
			{
				opacity: 1,
				filter: 'alpha(opacity=100)'
			}, 300);
			$(this).animate(
			{
				opacity: 1,
				filter: 'alpha(opacity=100)'
			}, 300);
			$(this).parent().animate(
			{
				backgroundColor: '#000000'
			}, 300);
			$(this).find('.video').animate(
			{
				filter: 'alpha(opacity=0)',
				opacity: 0
			}, 300);
	});
	//--------------------------------------------
	$('ul.all-video li a').hover(
		function() {
			$(this).find('.thumbnail_video_background').animate(
			{
				backgroundColor:'#6a1497'
			}, 300);
			$(this).find('.thumbnail_video').animate(
			{
				opacity: 0.65,
				filter: 'alpha(opacity=65)'
			}, 300);
			$(this).find('.all_link').animate(
			{
				display:'block',
				opacity: 1,
				filter: 'alpha(opacity=100)'
			}, 300);
			$(this).find('.all_photo_gallery').animate(
			{
				display:'block',
				opacity: 1,
				filter: 'alpha(opacity=100)'
			}, 300);
			$(this).find('.all_link').animate(
			{
				display:'block',
				opacity: 1,
				filter: 'alpha(opacity=100)'
			}, 300);
			$(this).find('.all_photo_gallery').animate(
			{
				display:'block',
				opacity: 1,
				filter: 'alpha(opacity=100)'
			}, 300);
			$(this).find('.all_video_play').animate(
			{
				display:'block',
				opacity: 1,
				filter: 'alpha(opacity=100)'
			}, 300);
			$(this).parent().find('.thumbnail_video_artista').animate(
			{
				backgroundColor: '#caacda'
			}, 300);
			$(this).parent().find('.thumbnail_video_titolo').animate(
			{
				backgroundColor: '#caacda'
			}, 300);
	},
		function() {
			$(this).find('.thumbnail_video_background').animate(
			{
				backgroundColor:'#eeebe6'
			}, 300);
			$(this).find('.thumbnail_video').animate(
			{
				opacity: 1,
				filter: 'alpha(opacity=100)'
			}, 300);
			$(this).find('.all_link').animate(
			{
				filter: 'alpha(opacity=25)',
				opacity: 0.25
			}, 300);
			$(this).find('.all_photo_gallery').animate(
			{
				filter: 'alpha(opacity=25)',
				opacity: 0.25
			}, 300);
			$(this).find('.all_video_play').animate(
			{
				filter: 'alpha(opacity=0)',
				opacity: 0
			}, 300);
			$(this).parent().find('.thumbnail_video_artista').animate(
			{
				backgroundColor: '#eeebe6'
			}, 300);
			$(this).parent().find('.thumbnail_video_titolo').animate(
			{
				backgroundColor: '#eeebe6'
			}, 300);
	});
	//--------------------------------------------
	$('ul.horizontalthumb-video li a').hover(
		function() {
			$(this).find('.thumbnail_video_background').animate(
			{
				backgroundColor:'#c6c3be'
			}, 300);
			$(this).find('.thumbnail_video').animate(
			{
				opacity: 0.65,
				filter: 'alpha(opacity=65)'
			}, 300);
			$(this).find('.horizontal_link').animate(
			{
				display:'block',
				opacity: 0.90,
				filter: 'alpha(opacity=90)'
			}, 300);
			$(this).find('.horizontal_photo_gallery').animate(
			{
				display:'block',
				opacity: 0.90,
				filter: 'alpha(opacity=90)'
			}, 300);
			$(this).find('.horizontal_video_play').animate(
			{
				display:'block',
				opacity: 0.90,
				filter: 'alpha(opacity=90)'
			}, 300);
			$(this).parent().find('.thumbnail_video_artista').animate(
			{
				backgroundColor: '#D5D2CB'
			}, 300);
			$(this).parent().find('.thumbnail_video_titolo').animate(
			{
				backgroundColor: '#D5D2CB'
			}, 300);
		},
		function() {
			$(this).find('.thumbnail_video_background').animate(
			{
				backgroundColor:'#c6c3be'
			}, 300);
			$(this).find('.thumbnail_video').animate(
			{
				opacity: 1,
				filter: 'alpha(opacity=100)'
			}, 300);
			$(this).find('.horizontal_link').animate(
			{
				filter: 'alpha(opacity=25)',
				opacity: 0.25
			}, 300);
			$(this).find('.horizontal_photo_gallery').animate(
			{
				filter: 'alpha(opacity=25)',
				opacity: 0.25
			}, 300);
			$(this).find('.horizontal_video_play').animate(
			{
				filter: 'alpha(opacity=25)',
				opacity: 0.25
			}, 300);
			$(this).parent().find('.thumbnail_video_artista').animate(
			{
				backgroundColor: '#c6c3be'
			}, 300);
			$(this).parent().find('.thumbnail_video_titolo').animate(
			{
				backgroundColor: '#c6c3be'
			}, 300);
	});
	//--------------------------------------------
	$('ul.verticalthumb-video li a').hover(
		function() {
			$(this).find('.thumbnail_video_background').animate(
			{
				backgroundColor:'#c6c3be'
			}, 300);
			$(this).find('.interno').animate(
			{
				opacity: 0.65,
				filter: 'alpha(opacity=65)'
			}, 300);
			$(this).find('.laterale').animate(
			{
				backgroundColor:'#D5D2CB'
			}, 300);
			$(this).find('.vertical_link').animate(
			{
				display:'block',
				opacity: 0.90,
				filter: 'alpha(opacity=90)'
			}, 300);
			$(this).find('.vertical_photo_gallery').animate(
			{
				display:'block',
				opacity: 0.90,
				filter: 'alpha(opacity=90)'
			}, 300);
			$(this).find('.vertical_video_play').animate(
			{
				display:'block',
				opacity: 0.90,
				filter: 'alpha(opacity=90)'
			}, 300);
		},
		function() {
			$(this).find('.thumbnail_video_background').animate(
			{
				backgroundColor:'#c6c3be'
			}, 300);
			$(this).find('.interno').animate(
			{
				opacity: 1,
				filter: 'alpha(opacity=100)'
			}, 300);
			$(this).find('.laterale').animate(
			{
				backgroundColor:'#c6c3be'
			}, 300);
			$(this).find('.vertical_link').animate(
			{
				filter: 'alpha(opacity=25)',
				opacity: 0.25
			}, 300);
			$(this).find('.vertical_photo_gallery').animate(
			{
				filter: 'alpha(opacity=25)',
				opacity: 0.25
			}, 300);
			$(this).find('.vertical_video_play').animate(
			{
				filter: 'alpha(opacity=25)',
				opacity: 0.25
			}, 300);
	});
	//--------------------------------------------
	$('ul li a div#id_slideview').hover(
		function() {
			$(this).animate(
			{
				opacity: 0.65,
				filter: 'alpha(opacity=65)'
			}, 300);
			$(this).find('.slideview_93_link').animate(
			{
				display:'block',
				opacity: 0.90,
				filter: 'alpha(opacity=90)'
			}, 300);
			$(this).find('.slideview_93_photo_gallery').animate(
			{
				display:'block',
				opacity: 0.90,
				filter: 'alpha(opacity=90)'
			}, 300);
			$(this).find('.slideview_93_video_play').animate(
			{
				display:'block',
				opacity: 0.90,
				filter: 'alpha(opacity=90)'
			}, 300);
			$(this).find('.slideview_167_link').animate(
			{
				display:'block',
				opacity: 0.90,
				filter: 'alpha(opacity=90)'
			}, 300);
			$(this).find('.slideview_167_photo_gallery').animate(
			{
				display:'block',
				opacity: 0.90,
				filter: 'alpha(opacity=90)'
			}, 300);
			$(this).find('.slideview_167_video_play').animate(
			{
				display:'block',
				opacity: 0.90,
				filter: 'alpha(opacity=90)'
			}, 300);
			$(this).find('.slideview_244_link').animate(
			{
				display:'block',
				opacity: 0.90,
				filter: 'alpha(opacity=90)'
			}, 300);
			$(this).find('.slideview_244_photo_gallery').animate(
			{
				display:'block',
				opacity: 0.90,
				filter: 'alpha(opacity=90)'
			}, 300);
			$(this).find('.slideview_244_video_play').animate(
			{
				display:'block',
				opacity: 0.90,
				filter: 'alpha(opacity=90)'
			}, 300);
		},
		function() {
			$(this).animate(
			{
				opacity: 1,
				filter: 'alpha(opacity=100)'
			}, 300);
			$(this).find('.slideview_93_link').animate(
			{
				filter: 'alpha(opacity=25)',
				opacity: 0.25
			}, 300);
			$(this).find('.slideview_93_photo_gallery').animate(
			{
				filter: 'alpha(opacity=25)',
				opacity: 0.25
			}, 300);
			$(this).find('.slideview_93_video_play').animate(
			{
				filter: 'alpha(opacity=25)',
				opacity: 0.25
			}, 300);
			$(this).find('.slideview_167_link').animate(
			{
				filter: 'alpha(opacity=25)',
				opacity: 0.25
			}, 300);
			$(this).find('.slideview_167_photo_gallery').animate(
			{
				filter: 'alpha(opacity=25)',
				opacity: 0.25
			}, 300);
			$(this).find('.slideview_167_video_play').animate(
			{
				filter: 'alpha(opacity=25)',
				opacity: 0.25
			}, 300);
			$(this).find('.slideview_244_link').animate(
			{
				filter: 'alpha(opacity=25)',
				opacity: 0.25
			}, 300);
			$(this).find('.slideview_244_photo_gallery').animate(
			{
				filter: 'alpha(opacity=25)',
				opacity: 0.25
			}, 300);
			$(this).find('.slideview_244_video_play').animate(
			{
				filter: 'alpha(opacity=25)',
				opacity: 0.25
			}, 300);
	});
	//--------------------------------------------
	//--------------------------------------------

	//--------------------------------------------
	//var $in_genres 	= false;
	//var $in_artists = false;
	//--------------------------------------------
//	height0		 	= max1;
	//alert("B."+max0+" - "+max1+" - "+height0);


/*
	//--------------------------------------------
	$('.container_main1').animate(	{height: 	height0 + 30}, 0);
	//--------------------------------------------
	$('.xspacer1').animate(			{height: 	height0 + 30}, 0);
	$('.xspacer2').animate(			{height: 	height0 + 30}, 0);
	//--------------------------------------------
	$('.container_main2').animate(	{height:	height0 + 30}, 0);
	//--------------------------------------------
	$('.content').animate(			{height: 	height0 +  5}, 0);
	//--------------------------------------------
	$('.right_sidebar').animate(	{height:	height0 +  5}, 0);
	//--------------------------------------------
*/


	$('.view-all-genres a').toggle(
		function() {
		//alert(1);
			$('#id_genres span.genres-toggle').toggle( 'blind', {}, 1000 );
			$('.view-all-genres a').text('hide');
/*			//--------------------------------------------
			if (!in_artists) {
				//alert("C."+max0+" - "+max1+" - "+height0);
				//--------------------------------------------
				height0 = ($('#id_genres span.genres-toggle').height() + max0) > 700 
						? 
							$('#id_genres span.genres-toggle').height() + max0
						: 
							700;
				//alert("1."+height0+" - "+$('#id_genres span.genres-toggle').height()+" - "+max0);

				//--------------------------------------------
				$('.container_main1').animate(	{height:height0 + 30}, 0);
				//--------------------------------------------
				$('.xspacer1').animate(			{height:height0 + 30}, 0);
				$('.xspacer2').animate(			{height:height0 + 30}, 0);
				//--------------------------------------------
				$('.container_main2').animate(	{height:height0 + 30}, 0);
				//--------------------------------------------
				$('.content').animate(			{height:height0 +  5}, 0);
				//--------------------------------------------
				$('.right_sidebar').animate(	{height:height0 +  5}, 0);
				//--------------------------------------------

			}
			else {
				//--------------------------------------------
				height0 = (Math.max($('#id_genres span.genres-toggle').height(), $('#id_artists span.artists-toggle').height()) + max0) > 700 
						? 
							Math.max($('#id_genres span.genres-toggle').height(), $('#id_artists span.artists-toggle').height()) + max0
						: 
							700;
				//alert("2."+height0+" - "+$('#id_genres span.genres-toggle').height()+" - "+max0);

				//--------------------------------------------
				$('.container_main1').animate(	{height:height0 + 30}, 0);
				//--------------------------------------------
				$('.xspacer1').animate(			{height:height0 + 30}, 0);
				$('.xspacer2').animate(			{height:height0 + 30}, 0);
				//--------------------------------------------
				$('.container_main2').animate(	{height:height0 + 30}, 0);
				//--------------------------------------------
				$('.content').animate(			{height:height0 +  5}, 0);
				//--------------------------------------------
				$('.right_sidebar').animate(	{height:height0 +  5}, 0);
				//--------------------------------------------

			}
			in_genres = true;
*/		},
		function() {
		//alert(2);
			$('#id_genres span.genres-toggle').toggle( 'blind', {}, 1000 );
			$('.view-all-genres a').text('view all');
			//--------------------------------------------
/*			if (!in_artists) {
				//--------------------------------------------
				height0 = max1;
				//alert("3."+height0+" - "+$('#id_genres span.genres-toggle').height()+" - "+max0);

				//--------------------------------------------
				$('.container_main1').animate(	{height:height0 + 30}, 0);
				//--------------------------------------------
				$('.xspacer1').animate(			{height:height0 + 30}, 0);
				$('.xspacer2').animate(			{height:height0 + 30}, 0);
				//--------------------------------------------
				$('.container_main2').animate(	{height:height0 + 30}, 0);
				//--------------------------------------------
				$('.content').animate(			{height:height0 +  5}, 0);
				//--------------------------------------------
				$('.right_sidebar').animate(	{height:height0 +  5}, 0);
				//--------------------------------------------

			}
			else {
				//--------------------------------------------
				height0 = ($('#id_artists span.artists-toggle').height() + max0) > 700
						? 
							$('#id_artists span.artists-toggle').height() + max0 
						: 
							700;
				//alert("4."+height0+" - "+$('#id_genres span.genres-toggle').height()+" - "+max0);

				//--------------------------------------------
				$('.container_main1').animate(	{height:height0 + 30}, 0);
				//--------------------------------------------
				$('.xspacer1').animate(			{height:height0 + 30}, 0);
				$('.xspacer2').animate(			{height:height0 + 30}, 0);
				//--------------------------------------------
				$('.container_main2').animate(	{height:height0 + 30}, 0);
				//--------------------------------------------
				$('.content').animate(			{height:height0 +  5}, 0);
				//--------------------------------------------
				$('.right_sidebar').animate(	{height:height0 +  5}, 0);
				//--------------------------------------------

			}
			in_genres = false;
*/		}
	);
	$('.view-all-artists a').toggle(
		function() {
			$('#id_artists span.artists-toggle').toggle( 'blind', {}, 1000 );
			$('.view-all-artists a').text('hide');
			//--------------------------------------------
/*			if (!in_genres) {
				//--------------------------------------------
				height0 = ($('#id_artists span.artists-toggle').height() + max0) > 700 
						? 
							$('#id_artists span.artists-toggle').height() + max0
						: 
							700;
				//alert("5."+height0);

				//--------------------------------------------
				$('.container_main1').animate(	{height:height0 + 30}, 0);
				//--------------------------------------------
				$('.xspacer1').animate(			{height:height0 + 30}, 0);
				$('.xspacer2').animate(			{height:height0 + 30}, 0);
				//--------------------------------------------
				$('.container_main2').animate(	{height:height0 + 30}, 0);
				//--------------------------------------------
				$('.content').animate(			{height:height0 +  5}, 0);
				//--------------------------------------------
				$('.right_sidebar').animate(	{height:height0 +  5}, 0);
				//--------------------------------------------

			}
			else {
				//--------------------------------------------
				height0 = (Math.max($('#id_genres span.genres-toggle').height(), $('#id_artists span.artists-toggle').height()) + max0) > 700 
						? 
							Math.max($('#id_genres span.genres-toggle').height(), $('#id_artists span.artists-toggle').height()) + max0
						: 
							700;
				//alert("6."+height0);
/*
				//--------------------------------------------
				$('.container_main1').animate(	{height:height0 + 30}, 0);
				//--------------------------------------------
				$('.xspacer1').animate(			{height:height0 + 30}, 0);
				$('.xspacer2').animate(			{height:height0 + 30}, 0);
				//--------------------------------------------
				$('.container_main2').animate(	{height:height0 + 30}, 0);
				//--------------------------------------------
				$('.content').animate(			{height:height0 +  5}, 0);
				//--------------------------------------------
				$('.right_sidebar').animate(	{height:height0 +  5}, 0);
				//--------------------------------------------

			}
			in_artists = true;
*/		},
		function() {
			$('#id_artists span.artists-toggle').toggle( 'blind', {}, 1000 );
			$('.view-all-artists a').text('view all');
			//--------------------------------------------
/*			if (!in_genres) {
				//--------------------------------------------
				height0 = max1;
				//alert("7."+height0);

				//--------------------------------------------
				$('.container_main1').animate(	{height:height0 + 30}, 0);
				//--------------------------------------------
				$('.xspacer1').animate(			{height:height0 + 30}, 0);
				$('.xspacer2').animate(			{height:height0 + 30}, 0);
				//--------------------------------------------
				$('.container_main2').animate(	{height:height0 + 30}, 0);
				//--------------------------------------------
				$('.content').animate(			{height:height0 +  5}, 0);
				//--------------------------------------------
				$('.right_sidebar').animate(	{height:height0 +  5}, 0);
				//--------------------------------------------

			}
			else {
				//--------------------------------------------
				height0 = ($('#id_genres span.genres-toggle').height() + max0) > 700
						? 
							$('#id_genres span.genres-toggle').height() + max0 
						: 
							700;
				//alert("8."+height0);

				//--------------------------------------------
				$('.container_main1').animate(	{height:height0 + 30}, 0);
				//--------------------------------------------
				$('.xspacer1').animate(			{height:height0 + 30}, 0);
				$('.xspacer2').animate(			{height:height0 + 30}, 0);
				//--------------------------------------------
				$('.container_main2').animate(	{height:height0 + 30}, 0);
				//--------------------------------------------
				$('.content').animate(			{height:height0 +  5}, 0);
				//--------------------------------------------
				$('.right_sidebar').animate(	{height:height0 +  5}, 0);
				//--------------------------------------------

			}
			in_artists = false;
*/		}
	);
	//--------------------------------------------
	//--------------------------------------------
	$('#session_contact').load('../modules/session_contact.php');
	//--------------------------------------------
	$('#session_contact_c').load('../modules/session_contact.php');
});
//------------------------------------------------
function clearTextbox(box) {
	if ($(box).attr("name") == "newsletter_name") {
		if ($(box).val() == "name") {
			$(box).val("");
		}
		$(".newsletter_contact_error").text('');
		$(".newsletter_contact_msg").text('');
	}
	else if ($(box).attr("name") == "newsletter_email") {
		if ($(box).val() == "* e-mail") {
			$(box).val("");
		}
		$(".newsletter_contact_error").text('');
		$(".newsletter_contact_msg").text('');
	}
	else if ($(box).attr("name") == "contact_name") {
		if ($(box).val() == "* name") {
			$(box).val("");
		}
	}
	else if ($(box).attr("name") == "contact_name_c") {
		if ($(box).val() == "* name") {
			$(box).val("");
		}
	}
	else if ($(box).attr("name") == "contact_email") {
		if ($(box).val() == "* e-mail") {
			$(box).val("");
		}
	}
	else if ($(box).attr("name") == "contact_email_c") {
		if ($(box).val() == "* e-mail") {
			$(box).val("");
		}
	}
	else if ($(box).attr("name") == "contact_captcha") {
		if ($(box).val() == "* captcha") {
			$(box).val("");
		}
	}
	else if ($(box).attr("name") == "contact_captcha_c") {
		if ($(box).val() == "* captcha") {
			$(box).val("");
		}
	}
}
//------------------------------------------------
function resetTextbox(box) {
	if ($(box).val() == "") {
		if ($(box).attr("name") == "newsletter_name") {
			$(box).val("name");
			$(".newsletter_contact_error").text('');
			$(".newsletter_contact_msg").text('');
		}
		else if ($(box).attr("name") == "newsletter_email") {
			$(box).val("* e-mail");
			$(".newsletter_contact_error").text('');
			$(".newsletter_contact_msg").text('');
		}
		else if ($(box).attr("name") == "contact_name") {
			$(box).val("* name");
		}
		else if ($(box).attr("name") == "contact_name_c") {
			$(box).val("* name");
		}
		else if ($(box).attr("name") == "contact_email") {
			$(box).val("* e-mail");
		}
		else if ($(box).attr("name") == "contact_email_c") {
			$(box).val("* e-mail");
		}
		else if ($(box).attr("name") == "contact_captcha") {
			$(box).val("* captcha");
		}
		else if ($(box).attr("name") == "contact_captcha_c") {
			$(box).val("* captcha");
		}
	}
}
//------------------------------------------------
function clearTextarea(box) {
	if ($(box).attr("name") == "contact_question") {
		if ($(box).text() == "* your question") {
			$(box).text("");
			$(box).val("");
		}
	}
	else if ($(box).attr("name") == "contact_question_c") {
		if ($(box).text() == "* your question") {
			$(box).text("");
			$(box).val("");
		}
	}
}
//------------------------------------------------
function resetTextarea(box) {
	if ($(box).val() == "") {
		if ($(box).attr("name") == "contact_question") {
			$(box).text("* your question");
			$(box).val("* your question");
		}
		else if ($(box).attr("name") == "contact_question_c") {
			$(box).text("* your question");
			$(box).val("* your question");
		}
	}
}
//------------------------------------------------
function refreshCaptcha() {
	$('#captcha').attr('src', '../modules/captcha.php'+'?'+Math.random());
	$('#session_contact').load('../modules/session_contact.php');
}
//------------------------------------------------
function refreshCaptcha_c() {
	$('#captcha_c').attr('src', '../modules/captcha.php'+'?'+Math.random());
	$('#session_contact').load('../modules/session_contact.php');
}
//------------------------------------------------
function sendMail(datastr){
	$.ajax({
		type: "POST",
		url: "../modules/sendmail.php",
		data: datastr,
		cache: false,
		success: function(html){
			$(".contact_msg").html(html);
			$("#send_mail").attr('disabled', 'disabled');
		}
	});
}
//------------------------------------------------
function sendMail_c(datastr){
	$.ajax({
		type: "POST",
		url: "../modules/sendmail.php",
		data: datastr,
		cache: false,
		success: function(html){
			$(".contact_msg_c").html(html);
			$("#send_mail_c").attr('disabled', 'disabled');
		}
	});
}
//------------------------------------------------
function registerNewsletter(datastr){
	$.ajax({
		type: "POST",
		url: "../modules/newsletter_register.php",
		data: datastr,
		cache: false,
		success: function(html){
			$(".newsletter_contact_msg").html(html);
		}
	});
	//--------------------------------------
	//--- ENABLE ---------------------------
	//--------------------------------------
	$("#newsletter_subscribe").removeAttr('disabled');
	//$("#newsletter_unsubscribe").removeAttr('disabled');
	$("#newsletter_name").removeAttr('disabled');
	$("#newsletter_email").removeAttr('disabled');
	$("#newsletter_policy").removeAttr('disabled');
	//--------------------------------------
}
//------------------------------------------------
function unregisterNewsletter(datastr){
	$.ajax({
		type: "POST",
		url: "../modules/newsletter_unregister.php",
		data: datastr,
		cache: false,
		success: function(html){
			$(".newsletter_contact_msg").html(html);
		}
	});
}

