function add_rate_photo(srv) 
{
	  var user_id = document.forms["rate_on_photo"].user_id.value;	
	  var user_name = document.forms["rate_on_photo"].user_name.value;		  
      var module_name = document.forms["rate_on_photo"].module_name.value;
      var photo_id = document.forms["rate_on_photo"].photo_id.value;	  
      var score = document.forms["rate_on_photo"].score.value;	  
      len = document.forms["rate_on_photo"].score.length 
	 	        for (i = 0; i <len; i++) { 
	 	                if (document.forms["rate_on_photo"].score[i].checked) { 
	 	                        chosen = document.forms["rate_on_photo"].score[i].value 
	 	                } 
} 

		get_page(srv+'modules/mod_photo_party_gallery/mod_photo_party_gallery_rate_on_photo.php?user_id='+user_id+'&user_name='+user_name+'&module_name='+module_name+'&score='+chosen+'&photo_id='+photo_id+'', function() { add_rate_window(); });	
}


function add_rate_window()
{
	if (xmlhttp.readyState==4)
	{
	var window1 = document.getElementById("rate_on_gallery_vriew");
	var window2 = document.getElementById("rate_on_gallery_vriew_txt");
    window1.style.display = 'block';
    window2.innerHTML =  xmlhttp.responseText;
	}	
}

function comments(srv)
{
	var user_id = document.forms["comment"].user_id.value;	  
	var module_name = document.forms["comment"].module_name.value;
	var photo_id = document.forms["comment"].photo_id.value;
	var mooeditable = $("comment_txt").mooEditable();
	var window1 = $("mod_photo_gallery_comment");	
	var window2 = $("mod_photo_gallery_comment_txt");				
	mooeditable.saveContent();
	var req = new Request({
		url: srv+'modules/mod_photo_party_gallery/mod_photo_party_gallery_comment.php?module_name='+module_name+'&photo_id='+photo_id,
		data: $('comment'),
		method: 'post',
		async: true,
		onRequest: function() { $(window2).innerHTML = "<img src='images/loading.gif' />"; },    
		onFailure: function() { $(window2).set('text', 'The request failed.') },	
		onSuccess: function(response) {	
			  window1.style.display = 'block';		
			$(window2).set('html', response);  
			mooeditable.setContent('');
			var onderwerp = document.forms['comment'].onderwerp.value = "" ;			
			get_comment(srv,1,module_name,1,user_id,0,photo_id);
		}
	}).send();		
}

function mod_photo_party_gallery_comments_reload_update()
{
	if (xmlhttp.readyState==4) 
	{  	
	var window1 = document.getElementById("comment_reload"); 
	window1.innerHTML = xmlhttp.responseText;
	window1.style.display = 'block';
	}	

	window.addEvent('domready', function() {
	$$('div.form_window_0').each(function(element) {
	var effect = new Fx.Slide(element).hide();
	element.style.display = 'block';
	});
});
}


/*
function comment_window()
{
	var window1 = document.getElementById("mod_photo_gallery_comment");
    window1.style.display = 'block';
    window1.innerHTML =  xmlhttp.responseText;
}
*/

function comment_succes_hinde()
{
	var window1 = document.getElementById("mod_photo_gallery_comment");
    window1.style.display = 'none';
}


/* photo tags */

function photo_tags() {
	var photo_tag_user_list = $("photo_tag_user_list");		
	var myCropper = new Cropper('target_image',{							
		onComplete:function(top,left,width,height){	
			var tags_users_left = new Fx.Tween(photo_tag_user_list).start('margin-left', left-80);
			var tags_users_top = new Fx.Tween(photo_tag_user_list).start('margin-top', top-270);
	
			$('resize_coords_top').value=top;	
			$('resize_coords_left').value=left;	
			$('resize_coords_width').value=width;	
			$('resize_coords_height').value=height;
			
		}
	});
    photo_tag_user_list.style.display = 'block';
}


function add_photo_tag(srv,module_name,user_id,photo_id,album,page,aantber)
{

	var resize_coords_top = document.forms["photo_tag_cos"].resize_coords_top.value;
	var resize_coords_left = document.forms["photo_tag_cos"].resize_coords_left.value;
	var resize_coords_width = document.forms["photo_tag_cos"].resize_coords_width.value;
	var resize_coords_height = document.forms["photo_tag_cos"].resize_coords_height.value;	
    var tag_user_list = $("photo_tag_user_list");
	
	post_data(srv+'modules/mod_photo_party_gallery/mod_photo_party_gallery_add_tag.php?user_id='+user_id+'&photo_id='+photo_id+'&module_name='+module_name+'&top='+resize_coords_top+'&left='+resize_coords_left+'&width='+resize_coords_width+'&height='+resize_coords_height+'&album='+album+'&page='+page+'&aantber='+aantber+'',tag_user_list);
	tag_user_list.style.display = 'none';
	post_data(srv+'modules/mod_photo_party_gallery/mod_photo_party_gallery_tag_names.php?photo_id='+photo_id+'&module_name='+module_name+'','photo_tag_names');	
	post_data(srv+'modules/mod_photo_party_gallery/mod_photo_party_gallery_reload.php?user_id='+user_id+'&photo_id='+photo_id+'&module_name='+module_name+'','photo');		
}


function mod_photo_gallery_refuse_tag_window(srv,module_name,user_id,photo_id)
{
	post_data(srv+'modules/mod_photo_party_gallery/mod_photo_party_gallery_reload.php?user_id='+user_id+'&photo_id='+photo_id+'&module_name='+module_name+'','photo');		
}


function view_photo_tag(bid)
{
	var window1 = document.getElementById("tag_id_"+bid);	
    window1.style.display = 'block';	
}


function view_photo_tag_hidden(bid)
{
	var window1 = document.getElementById("tag_id_"+bid);	
    window1.style.display = 'none';	
}


function view_photo_tag_1(bid)
{
	var window1 = document.getElementById("tag_id_1_"+bid);	
    window1.style.display = 'block'; 
}


function view_photo_tag_hidden_1(bid)
{
	var window1 = document.getElementById("tag_id_1_"+bid);	
    window1.style.display = 'none';	
}

function delete_photo_tag(srv,bid,photo_id,module_name)
{
	post_data(srv+'modules/mod_photo_party_gallery/mod_photo_party_gallery_photo_delete_tag.php?bid='+bid+'&module_name='+module_name+'','delete_tag_succes_'+bid);	
	var elm = new Fx.Slide($('tag_name_'+bid)).slideOut();
	var elm = new Fx.Slide($('delete_icons_'+bid)).slideOut();

	post_data(srv+'modules/mod_photo_party_gallery/mod_photo_party_gallery_reload.php?photo_id='+photo_id+'&module_name='+module_name+'','photo');	
}

function delete_photo_tag_1(srv,bid,photo_id,module_name)
{
	post_data(srv+'modules/mod_photo_party_gallery/mod_photo_party_gallery_photo_delete_tag.php?bid='+bid+'&module_name='+module_name+'','delete_tag_succes_'+bid);	
	var elm = new Fx.Slide($('tag_name_1_'+bid)).slideOut();
	var elm = new Fx.Slide($('delete_icons_1_'+bid)).slideOut();

	post_data(srv+'modules/mod_photo_party_gallery/mod_photo_party_gallery_reload.php?photo_id='+photo_id+'&module_name='+module_name+'','photo');	
}

function popup_mail_tag_user()
{
	var window1 = document.getElementById("mail_tag_user");	
    window1.style.display = 'block';	
	var window2 = document.getElementById("mail_tag_user_form");	
    window2.style.display = 'block';	    
	var window3 = document.getElementById("photo_tag_user_list");	
    window3.style.display = 'none';	     
    
}

function sent_tag_mail(srv,module_name)
{
	post_data(srv+'modules/mod_photo_party_gallery/mod_photo_party_gallery_sent_tag_mail.php?module_name='+module_name,'tag_mail', 'tag_mail');
}


