//type: 1- normali zvaigzdute, 2- maza zvaigzdute
//optional - jai daina, albumas,.. yra kelis kartus puslapyje(pvz albumu isvedime), tai kad ju id skirtus 
//ALBUM
function favorite_album_a(id,type,optional) {
	if (typeof optional == "undefined") {
	    optional = "";
	}
	if(link = document.getElementById('favorite_album_link'+id+optional)){
		link.href = "javascript:rate()";
	}
	jQuery.ajax({
		url: 'ajax.php?users;favorite_album.'+id,
		success: 
			function(t) {
				if(t.responseText!=''){
					if(type ==2){
						tp = "_small";
					}else{
						tp='';
					}
					if(img = document.getElementById('favorite_album_img'+id+optional)){
						img.src = "/images/d/image_star_yellow"+tp+".gif";
					}
					if(count = document.getElementById('favorite_album_count'+id+optional)){
						count.innerHTML = t.responseText;
					}
					if(link = document.getElementById('favorite_album_link'+id+optional)){
						if(optional!=''){
							var opt = ",\'"+optional+"\'";
						}else{
							var opt ='';
						}
						link.href = "javascript:favorite_album_r("+id+","+type+opt+")";
					}
				}
			}
		}
	);	
}
function favorite_album_r(id,type,optional) {
	if (typeof optional == "undefined") {
	    optional = "";
	}
	if(link = document.getElementById('favorite_album_link'+id+optional)){
		link.href = "javascript:rate()";
	}
	jQuery.ajax({
		url: 'ajax.php?users;favorite_album_r.'+id,
		success: 
			function(t) {
				if(t.responseText!=''){
					if(type ==2){
						tp = "_small";
					}else{
						tp='';
					}
					if(img = document.getElementById('favorite_album_img'+id+optional)){
						img.src = "/images/d/image_star_empty"+tp+".gif";
					}
					if(count = document.getElementById('favorite_album_count'+id+optional)){
						count.innerHTML = t.responseText;
					}
					if(link = document.getElementById('favorite_album_link'+id+optional)){
						if(optional!=''){
							var opt = ",\'"+optional+"\'";
						}else{
							var opt ='';
						}
						link.href = "javascript:favorite_album_a("+id+","+type+opt+")";
					}
				}
			}
		}
	);	
}
//GROUP
function favorite_group_a(id,type,optional) {
	if (typeof optional == "undefined") {
	    optional = "";
	}
	if(link = document.getElementById('favorite_group_link'+id+optional)){
		link.href = "javascript:rate()";
	}
	jQuery.ajax({
		url: 'ajax.php?users;favorite_group.'+id,
		success: 
			function(t) {
				if(t.responseText!=''){
					if(type ==2){
						tp = "_small";
					}else{
						tp='';
					}
					if(img = document.getElementById('favorite_group_img'+id+optional)){
						img.src = "/images/d/image_star_yellow"+tp+".gif";
					}
					if(count = document.getElementById('favorite_group_count'+id+optional)){
						count.innerHTML = t.responseText;
					}
					if(link = document.getElementById('favorite_group_link'+id+optional)){
						if(optional!=''){
							var opt = ",\'"+optional+"\'";
						}else{
							var opt ='';
						}
						link.href = "javascript:favorite_group_r("+id+","+type+opt+")";
					}
				}
			}
		}
	);	
}
function favorite_group_r(id,type,optional) {
	if (typeof optional == "undefined") {
	    optional = "";
	}
	if(link = document.getElementById('favorite_group_link'+id+optional)){
		link.href = "javascript:rate()";
	}
	jQuery.ajax({
		url: 'ajax.php?users;favorite_group_r.'+id,
		success: 
			function(t) {
				if(t.responseText!=''){
					if(type ==2){
						tp = "_small";
					}else{
						tp='';
					}
					if(img = document.getElementById('favorite_group_img'+id+optional)){
						img.src = "/images/d/image_star_empty"+tp+".gif";
					}
					if(count = document.getElementById('favorite_group_count'+id+optional)){
						count.innerHTML = t.responseText;
					}
					if(link = document.getElementById('favorite_group_link'+id+optional)){
						if(optional!=''){
							var opt = ",\'"+optional+"\'";
						}else{
							var opt ='';
						}
						link.href = "javascript:favorite_group_a("+id+","+type+opt+")";
					}
				}
			}
		}
	);	
}
//SONG
function favorite_song_a(id,type,optional) {
	if (typeof optional == "undefined") {
	    optional = "";
	}
	if(link = document.getElementById('favorite_song_link'+id+optional)){
		link.href = "javascript:rate()";
	}
	jQuery.ajax({
		url: 'ajax.php?users;favorite_song.'+id,
		success: 
			function(t) {
				if(t.responseText!=''){
					if(type ==2){
						tp = "_small";
					}else{
						tp='';
					}
					if(img = document.getElementById('favorite_song_img'+id+optional)){
						img.src = "/images/d/image_star_yellow"+tp+".gif";
					}
					if(count = document.getElementById('favorite_song_count'+id+optional)){
						count.innerHTML = t.responseText;
					}
					if(link = document.getElementById('favorite_song_link'+id+optional)){
						if(optional!=''){
							var opt = ",\'"+optional+"\'";
						}else{
							var opt ='';
						}
						link.href = "javascript:favorite_song_r("+id+","+type+opt+")";
					}
				}
			}
		}
	);	
}
function favorite_song_r(id,type,optional) {
	if (typeof optional == "undefined") {
	    optional = "";
	}
	if(link = document.getElementById('favorite_song_link'+id+optional)){
		link.href = "javascript:rate()";
	}
	jQuery.ajax({
		url: 'ajax.php?users;favorite_song_r.'+id,
		success: 
			function(t) {
				if(t.responseText!=''){
					if(type ==2){
						tp = "_small";
					}else{
						tp='';
					}
					if(img = document.getElementById('favorite_song_img'+id+optional)){
						img.src = "/images/d/image_star_empty"+tp+".gif";
					}
					if(count = document.getElementById('favorite_song_count'+id+optional)){
						count.innerHTML = t.responseText;
					}
					if(link = document.getElementById('favorite_song_link'+id+optional)){
						if(optional!=''){
							var opt = ",\'"+optional+"\'";
						}else{
							var opt ='';
						}
						link.href = "javascript:favorite_song_a("+id+","+type+opt+")";
					}
				}
			}
		}
	);	
}
//STYLE
function favorite_style_a(id,type,optional) {
	if (typeof optional == "undefined") {
	    optional = "";
	}
	if(link = document.getElementById('favorite_style_link'+id+optional)){
		link.href = "javascript:rate()";
	}
	jQuery.ajax({
		url: 'ajax.php?users;favorite_style.'+id,
		success: 
			function(t) {
				if(t.responseText!=''){
					if(type ==2){
						tp = "_small";
					}else{
						tp='';
					}
					if(img = document.getElementById('favorite_style_img'+id+optional)){
						img.src = "/images/d/image_star_yellow"+tp+".gif";
					}
					if(count = document.getElementById('favorite_style_count'+id+optional)){
						count.innerHTML = t.responseText;
					}
					if(link = document.getElementById('favorite_style_link'+id+optional)){
						if(optional!=''){
							var opt = ",\'"+optional+"\'";
						}else{
							var opt ='';
						}
						link.href = "javascript:favorite_style_r("+id+","+type+opt+")";
					}
				}
			}
		}
	);	
}
function favorite_style_r(id,type,optional) {
	if (typeof optional == "undefined") {
	    optional = "";
	}
	if(link = document.getElementById('favorite_style_link'+id+optional)){
		link.href = "javascript:rate()"; // jai ilgai uztrunka ajax uzklausa
	}
	jQuery.ajax({
		url: 'ajax.php?users;favorite_style_r.'+id,
		success: 
			function(t) {
				if(t.responseText!=''){
					if(type ==2){
						tp = "_small";
					}else{
						tp='';
					}
					if(img = document.getElementById('favorite_style_img'+id+optional)){
						img.src = "/images/d/image_star_empty"+tp+".gif";
					}
					if(count = document.getElementById('favorite_style_count'+id+optional)){
						count.innerHTML = t.responseText;
					}
					if(link = document.getElementById('favorite_style_link'+id+optional)){
						if(optional!=''){
							var opt = ",\'"+optional+"\'";
						}else{
							var opt ='';
						}
						link.href = "javascript:favorite_style_a("+id+","+type+opt+")";
					}
				}
			}
		}
	);	
}
//USER
function favorite_user_a(id,type,optional) {
	if (typeof optional == "undefined") {
	    optional = "";
	}
	if(link = document.getElementById('favorite_user_link'+id+optional)){
		link.href = "javascript:rate()";
	}
	jQuery.ajax({
		url: 'ajax.php?users;favorite_user.'+id,
		success: 
			function(t) {
				if(t.responseText!=''){
					if(type ==2){
						tp = "_small";
					}else{
						tp='';
					}
					if(img = document.getElementById('favorite_user_img'+id+optional)){
						img.src = "/images/d/image_star_yellow"+tp+".gif";
					}
					if(count = document.getElementById('favorite_user_count'+id+optional)){
						count.innerHTML = t.responseText;
					}
					if(link = document.getElementById('favorite_user_link'+id+optional)){
						if(optional!=''){
							var opt = ",\'"+optional+"\'";
						}else{
							var opt ='';
						}
						link.href = "javascript:favorite_user_r("+id+","+type+opt+")";
					}
				}
			}
		}
	);	
}
function favorite_user_r(id,type,optional) {
	if (typeof optional == "undefined") {
	    optional = "";
	}
	if(link = document.getElementById('favorite_user_link'+id+optional)){
		link.href = "javascript:rate()"; // jai ilgai uztrunka ajax uzklausa
	}
	jQuery.ajax({
		url: 'ajax.php?users;favorite_user_r.'+id,
		success: 
			function(t) {
				if(t.responseText!=''){
					if(type ==2){
						tp = "_small";
					}else{
						tp='';
					}
					if(img = document.getElementById('favorite_user_img'+id+optional)){
						img.src = "/images/d/image_star_empty"+tp+".gif";
					}
					if(count = document.getElementById('favorite_user_count'+id+optional)){
						count.innerHTML = t.responseText;
					}
					if(link = document.getElementById('favorite_user_link'+id+optional)){
						if(optional!=''){
							var opt = ",\'"+optional+"\'";
						}else{
							var opt ='';
						}
						link.href = "javascript:favorite_user_a("+id+","+type+opt+")";
					}
				}
			}
		}
	);	
}

//CHORD
function favorite_chord_a(id,type,optional) {
	if (typeof optional == "undefined") {
		optional = "";
	}
	if(link = document.getElementById('favorite_chord_link'+id+optional)){
		link.href = "javascript:rate()";
	}
	jQuery.ajax({
		url: 'ajax.php?users;favorite_chord.'+id,
		success: 
			function(t) {
				if(t.responseText!=''){
					if(type ==2){
						tp = ''; 
					}else{
						tp='';
					}
					if(img = document.getElementById('favorite_chord_img'+id+optional)){
						img.src = "/images/d/guitar_full"+tp+".gif";
					}
					if(count = document.getElementById('favorite_chord_count'+id+optional)){
						count.innerHTML = t.responseText;
					}
					if(link = document.getElementById('favorite_chord_link'+id+optional)){
						if(optional!=''){
							var opt = ",\'"+optional+"\'";
						}else{
							var opt ='';
						}
						link.href = "javascript:favorite_chord_r("+id+","+type+opt+")";
					}
				}
			}
		}
	);	
}
function favorite_chord_r(id,type,optional) {
	if (typeof optional == "undefined") {
		optional = "";
	}
	if(link = document.getElementById('favorite_chord_link'+id+optional)){
		link.href = "javascript:rate()";
	}
	jQuery.ajax({
		url: 'ajax.php?users;favorite_chord_r.'+id,
		success: 
			function(t) {
				if(t.responseText!=''){
					if(type ==2){
						tp = '';
					}else{
						tp='';
					}
					if(img = document.getElementById('favorite_chord_img'+id+optional)){
						img.src = "/images/d/guitar_empty"+tp+".gif";
					}
					if(count = document.getElementById('favorite_chord_count'+id+optional)){
						count.innerHTML = t.responseText;
					}
					if(link = document.getElementById('favorite_chord_link'+id+optional)){
						if(optional!=''){
							var opt = ",\'"+optional+"\'";
						}else{
							var opt ='';
						}
						link.href = "javascript:favorite_chord_a("+id+","+type+opt+")";
					}
				}
			}
		}
	);	
}
//VIDEO
function favorite_video_a(id,type,optional) {
	if (typeof optional == "undefined") {
		optional = "";
	}
	if(link = document.getElementById('favorite_video_link'+id+optional)){
		link.href = "javascript:rate()";
	}
	jQuery.ajax({
		url: 'ajax.php?users;favorite_video.'+id,
		success: 
			function(t) {
				if(t.responseText!=''){
					if(type ==2){
						tp = "_small";
					}else{
						tp='';
					}
					if(img = document.getElementById('favorite_video_img'+id+optional)){
						img.src = "/images/d/image_star_yellow"+tp+".gif";
					}
					if(count = document.getElementById('favorite_video_count'+id+optional)){
						count.innerHTML = t.responseText;
					}
					if(link = document.getElementById('favorite_video_link'+id+optional)){
						if(optional!=''){
							var opt = ",\'"+optional+"\'";
						}else{
							var opt ='';
						}
						link.href = "javascript:favorite_video_r("+id+","+type+opt+")";
					}
				}
			}
		}
	);	
}
function favorite_video_r(id,type,optional) {
	if (typeof optional == "undefined") {
		optional = "";
	}
	if(link = document.getElementById('favorite_video_link'+id+optional)){
		link.href = "javascript:rate()";
	}
	jQuery.ajax({
		url: 'ajax.php?users;favorite_video_r.'+id,
		success: 
			function(t) {
				if(t.responseText!=''){
					if(type ==2){
						tp = "_small";
					}else{
						tp='';
					}
					if(img = document.getElementById('favorite_video_img'+id+optional)){
						img.src = "/images/d/image_star_empty"+tp+".gif";
					}
					if(count = document.getElementById('favorite_video_count'+id+optional)){
						count.innerHTML = t.responseText;
					}
					if(link = document.getElementById('favorite_video_link'+id+optional)){
						if(optional!=''){
							var opt = ",\'"+optional+"\'";
						}else{
							var opt ='';
						}
						link.href = "javascript:favorite_video_a("+id+","+type+opt+")";
					}
				}
			}
		}
	);	
}
//TRANSLATE
function favorite_translate_a(id,type,optional) {
	if (typeof optional == "undefined") {
		optional = "";
	}
	if(link = document.getElementById('favorite_translate_link'+id+optional)){
		link.href = "javascript:rate()";
	}
	jQuery.ajax({
		url: 'ajax.php?users;favorite_translate.'+id,
		success: 
			function(t) {
				if(t.responseText!=''){
					if(type ==2){
						tp = "_small";
					}else{
						tp='';
					}
					if(img = document.getElementById('favorite_translate_img'+id+optional)){
						img.src = "/images/d/image_star_yellow"+tp+".gif";
					}
					if(count = document.getElementById('favorite_translate_count'+id+optional)){
						count.innerHTML = t.responseText;
					}
					if(link = document.getElementById('favorite_translate_link'+id+optional)){
						if(optional!=''){
							var opt = ",\'"+optional+"\'";
						}else{
							var opt ='';
						}
						link.href = "javascript:favorite_translate_r("+id+","+type+opt+")";
					}
				}
			}
		}
	);	
}
function favorite_translate_r(id,type,optional) {
	if (typeof optional == "undefined") {
		optional = "";
	}
	if(link = document.getElementById('favorite_translate_link'+id+optional)){
		link.href = "javascript:rate()";
	}
	jQuery.ajax({
		url: 'ajax.php?users;favorite_translate_r.'+id,
		success: 
			function(t) {
				if(t.responseText!=''){
					if(type ==2){
						tp = "_small";
					}else{
						tp='';
					}
					if(img = document.getElementById('favorite_translate_img'+id+optional)){
						img.src = "/images/d/image_star_empty"+tp+".gif";
					}
					if(count = document.getElementById('favorite_translate_count'+id+optional)){
						count.innerHTML = t.responseText;
					}
					if(link = document.getElementById('favorite_translate_link'+id+optional)){
						if(optional!=''){
							var opt = ",\'"+optional+"\'";
						}else{
							var opt ='';
						}
						link.href = "javascript:favorite_translate_a("+id+","+type+opt+")";
					}
				}
			}
		}
	);	
}
//EXPLAIN
function favorite_explain_a(id,type,optional) {
	if (typeof optional == "undefined") {
	    optional = "";
	}
	if(link = document.getElementById('favorite_explain_link'+id+optional)){
		link.href = "javascript:rate()";
	}
	jQuery.ajax({
		url: 'ajax.php?users;favorite_explain.'+id,
		success: 
			function(t) {
				if(t.responseText!=''){
					if(type ==2){
						tp = "_small";
					}else{
						tp='';
					}
					if(img = document.getElementById('favorite_explain_img'+id+optional)){
						img.src = "/images/d/image_star_yellow"+tp+".gif";
					}
					if(count = document.getElementById('favorite_explain_count'+id+optional)){
						count.innerHTML = t.responseText;
					}
					if(link = document.getElementById('favorite_explain_link'+id+optional)){
						if(optional!=''){
							var opt = ",\'"+optional+"\'";
						}else{
							var opt ='';
						}
						link.href = "javascript:favorite_explain_r("+id+","+type+opt+")";
					}
				}
			}
		}
	);	
}
function favorite_explain_r(id,type,optional) {
	if (typeof optional == "undefined") {
	    optional = "";
	}
	if(link = document.getElementById('favorite_explain_link'+id+optional)){
		link.href = "javascript:rate()";
	}
	jQuery.ajax({
		url: 'ajax.php?users;favorite_explain_r.'+id,
		success: 
			function(t) {
				if(t.responseText!=''){
					if(type ==2){
						tp = "_small";
					}else{
						tp='';
					}
					if(img = document.getElementById('favorite_explain_img'+id+optional)){
						img.src = "/images/d/image_star_empty"+tp+".gif";
					}
					if(count = document.getElementById('favorite_explain_count'+id+optional)){
						count.innerHTML = t.responseText;
					}
					if(link = document.getElementById('favorite_explain_link'+id+optional)){
						if(optional!=''){
							var opt = ",\'"+optional+"\'";
						}else{
							var opt ='';
						}
						link.href = "javascript:favorite_explain_a("+id+","+type+opt+")";
					}
				}
			}
		}
	);	
}
function rate(){
	var a;
}
