function popup(name,url,wwidth,wheight) {
	
	var left = parseInt((screen.width - wwidth) / 2);
	var top = parseInt((screen.height - wheight) / 2);
				
	var win = window.open(url,name + $random(10000,99999),'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,width=' + wwidth + ',height=' + wheight + ',top=' + top + ',left=' + left + ',screenX=' + left + 'screenY=' + top);
}

window.addEvent('domready', function() {
	
	['sendfriend','favorite','comment','report','embed'].each(function(item,index) {
		var option = $(item);
		if (option) {
			option.addEvent('click',function(event) {
				event.stop();
				var url = this.getProperty('href');
				
				
				if (item == 'sendfriend') {
					height = 500;
				} else if (item == 'favorite') {
					height = 200;	
				} else if (item == 'comment') {
					height = 300;	
				} else if (item == 'report') {
					height = 400;	
				} else if (item == 'embed') {
					height = 200;	
				}
								
				popup(item,url,500,height);
			});	
		}
	});
	
	var comments = $('comments');
	if (comments) {
		comments.getElements('a.commentreport').addEvent('click',function(event) {
			event.stop();
			var url = this.getProperty('href');
			popup('comment',url,500,250);
			
		});	
	}
});

