
var g = {
	open:function(obj, extra_params){//opens the popup
		pop_up(900, 750, obj.getAttribute('href')+extra_params, 'toolbar=0, scrollbars=1, location=0, statusbar=0, menubar=0, resizable=1');
	},
	
	select:function(img_num, destination){//selects image to central image in the popup
		var main = document.getElementById(destination);
		
		selected_img = img_num;
		var replacement = eval('img'+selected_img);
		
		if(replacement.src)
			main.src = replacement.src;	
		return false;
	},
	
	select_large:function(img_num, destination){//selects image to central image in personal renovation_stages
		var main = document.getElementById(destination);
		
		selected_img = img_num;
		var replacement = eval('img'+selected_img);
		
		if(replacement.src)
			main.src = replacement.src;	
		main.width = 690;
		main.height = 517;
		return false;
	},
	
	change:function(destination, replacement){
		var main = document.getElementById(destination);
		
		if(replacement.src)
			main.src = replacement.src;
		main.width = 640;
		main.height = 480;
		return false;
	},
	
	change_large:function(destination, replacement){
		var main = document.getElementById(destination);
		
		if(replacement.src)
			main.src = replacement.src;
		main.width = 690;
		main.height = 517;
		return false;
	},
	
	change_small:function(link_obj, destination){
		var main = document.getElementById(destination);
			
		if(link_obj.href)
			main.src = link_obj.href;
		main.width = 370;
		main.height = 277;
		return false;
	},
		
	next:function(destination){
		selected_img += 1;
		
		try{
			var vobj = eval('img'+selected_img);
		}catch(e){
			var vobj = '';
		}
		
		if(vobj)//make change
			g.change(destination,vobj);
		else//rollback
			selected_img -= 1;
	},
	
	previous:function(destination){
		selected_img -= 1;
		
		try{
			var vobj = eval('img'+selected_img);
		}catch(e){
			var vobj = '';
		}
		
		if(vobj)//make change
			g.change(destination,vobj);
		else//rollback
			selected_img += 1;
	},
	
	next_large:function(destination){
		selected_img += 1;
		
		try{
			var vobj = eval('img'+selected_img);
		}catch(e){
			var vobj = '';
		}
		
		if(vobj)//make change
			g.change_large(destination,vobj);
		else//rollback
			selected_img -= 1;
	},
	
	previous_large:function(destination){
		selected_img -= 1;
		
		try{
			var vobj = eval('img'+selected_img);
		}catch(e){
			var vobj = '';
		}
		
		if(vobj)//make change
			g.change_large(destination,vobj);
		else//rollback
			selected_img += 1;
	}
}
