function video_navigation(target) {
	target = "#"+target;
	$("#video_content > div").addClass('hidden');
	$("#video_navigation li a.active").removeClass('active');
	$(target).toggleClass('hidden');
}
//
function get_related_content (ID, d_zodiac_sign, d_technique, d_style, d_school, countryid, city) {
	$.get("RelatedContent.php", {ID:ID, d_zodiac_sign:d_zodiac_sign, d_technique:d_technique, d_style:d_style, d_school:d_school, countryid:countryid, city:city}, function(data){
		$('#video_related').append(data);
	});
}
function clear_field_content (field) {
	$('#'+field).val('');
	$('#'+field).removeClass('no_value');
}
function no_value_field_content (field, value) {
	if($('#'+field).val() == '') {
        $('#'+field).val(value);
        $('#'+field).addClass('no_value');
		$('#'+field).attr('onfocus', 'clear_field_content("'+field+'");');
	}
}
function send_comment (dancerID) {
	name = $('#name').val();
	email = $('#email').val();
	message = $('#comment').val();
	//
	if (name != "" && email != "" && message != "") {
		$("#comment_form").submit();
	} else {
		alert("The form is not fully completed. Please fill all the mandatory fields.");		
	};
}
function send_message_to_dancer () {
	name = $('#message_name').val();
	email = $('#message_email').val();
	message = $('#message_comment').val();
	//
	if (name != "" && email != "" && message != "") {
		$("#message_form").submit();
	} else {
		alert("The form is not fully completed. Please fill all the mandatory fields.");		
	};
	/*
	$.get("SendMessage.php", {ID:dancerID, name:name, email:email, message:message, visitor_guess:visitor_guess}, function(data){
		//alert(data);
		if (data == "1") {
			$('#video_mail form').remove();
			$('#video_mail').append('<strong>Message sent</strong>');
		} else if (data == "0") {
			alert("An error occur while sending the email. Please try again later");
		} else {
			alert("The confirmation code introduced is not correct. Please refill it.");
		};
	});
	*/
}
function preview_play(target, total, current) {
	$('#'+target+' img').css('border-color', 'yellow');
	if (current >= Number(total)) {
		next = 1;
	} else {
		next = Number(current) + 1;
	}
	switch_img(target, total, next);	
	t = setTimeout("preview_play('"+target+"', '"+total+"', '"+next+"');",200);
}
function switch_img(target, total, next) {
	var now = $('#'+target+' img').attr('src');
	var pos_start = now.lastIndexOf('_') + 1;
	var path = now.substring(0, pos_start);
	var new_path = path + next + '.jpg';
	$('#'+target+' img').attr('src', new_path);
}
function preview_stop(target) {
	clearTimeout(t);
	$('#'+target+' img').css('border-color', '#666666');	
}

