function ImageLoader(id,url){ 
	this.i = new Image();  
	this.imEl=document.getElementById(id); 
	
	this.loadImage = function(){ 
		objRef=this; 
		this.imEl.src="http://social-flirtnet.de/templates/images/ajax-loader.gif"; 
		this.i.src=url; 
		objRef.waitForImage(); 
	};   
	
	this.waitForImage = function(){ 
		if(objRef.i.complete){ 
			objRef.imEl.src=this.i.src;
			if(objRef.imEl.width > 600){
				hide('details');
				hide('ratingbox');
				hide('googleads');
			}
		}else{ 
			setTimeout('objRef.waitForImage()',100); 
		} 
	}; 
} 
	
function expandimage(imgfile){
	var img = document.getElementById('image');	
	if(img.name == 'thumb'){
		loa=new ImageLoader('image',"http://social-flirtnet.de/images/galleries/"+imgfile);
		loa.loadImage();
		img.name = 'image';
	}else{
		img.src = "http://social-flirtnet.de/images/galleries/s/"+imgfile;
		img.name = 'thumb';
		show('details');
		show('ratingbox');
		show('googleads');
	}
}

function rateimg(id){
	var val = null;
	var rating = document.forms[0].elements;
	for (i=0; i<rating.length; i++) if(rating[i].checked == true) val = rating[i].value;
	new Ajax.Updater('rating_result','http://social-flirtnet.de/ajax', { parameters: { mode: 'gallery', gmode: 'rateimg', id: id, val: val } });
	hide('rating_rate');
	show('rating_numbers');
}

function textedit(id){
	txt = document.getElementById('textedit_text').value;
	new Ajax.Updater('textedit','http://social-flirtnet.de/ajax', { parameters: { mode: 'gallery', gmode: 'textedit', id: id, text: txt } });
}


