Behaviour.register({
	
	'div.twinkling_star': function (el) {
		Event.observe(el, 'click', function() {
				
			if ($(el).hasClassName('staron')) {
				$(el).removeClassName('staron');
			} else {
				$(el).addClassName('staron');
			}
				
			$(el).nextSiblings().each( function(sib) {
				sib.removeClassName('staron');
				});	
			$(el).previousSiblings().each( function(sib) {
				sib.addClassName('staron');
				});	
		
		});
	},
	'div.sv_rat_ok': function (el) {
		Event.observe(el, 'click', function() {
			var stars=$(el).parentNode.getElementsByClassName('staron').length;

				new Ajax.Request('/front/callcatcher/cinel/studio/studioviewer/rate',
					{
						method: 'post',
						parameters: { workId: rating_work_id ,workType: rating_work_type , userId: rating_user_id,rating: stars,  _ajax: 1},
						onComplete: function(req) {
						var info = eval('(' + req.responseText + ')');
						
						$('sv_rating').update(info.content+'<div id="sv_rat_header" class="sv_rat_head_rated">').show();
						$('sv_rat_header').removeClassName('sv_rat_head');
						$('sv_rat_header').addClassName('sv_rat_head_rated');
				}
			}
		);

			
		});
	},
	'div.sv_complaint_button': function (el) {
		Event.observe(el, 'click', function() {
				var newWin = window.open("/front/studio/klacht/?ID="+this.id, "popup" + Math.round(Math.random() * 1000),'height=526, width=350, menubar=no, scrollbars=yes, location=no, resizable=no, status=no, titlebar=yes'); //menubar en status en location stonden uit
				newWin.focus();
				});
	},
	'div.sv_to_gallery_button': function (el) {
		Event.observe(el, 'click', function() {
        top.location.href="/p/cinekidstudio/searchresults?maker="+this.id;
				});
	},
	'div.sv_to_show_button': function (el) {
		Event.observe(el, 'click', function() {
		top.location.href="/p/cinekidstudio/studioviewer?UserId="+this.id+"showplayer";
				});
	}



});

