lastid = null;
tiledata = new Array();

 
tiledata = new Array(6);
for(i = 0; i < tiledata.length; i++)
	{
		tiledata[i] = new Array(6);
	}	
	
function structure_hover(elem,width,height,sizex,sizey)
	{
		if(lastid != null)
			{
				breakdown = lastid.split(":");
				for(i=0;i<width;i++)
					{
						for(h=0;h<height;h++)
							{
								x = Number(breakdown[0]) + Number(i);
								y = Number(breakdown[1]) + Number(h);
								
								if(x < sizex && y < sizey) 
									{
										document.getElementById(x + ":" + y + "_td").style.background = tiledata[i][h];
									}	
							}	
					}
			
			}
		
		breakdown = elem.split(":");
		if(elem != null)
			{
				for(i=0;i<width;i++)
					{
						for(h=0;h<height;h++)
							{
								x = Number(breakdown[0]) + Number(i);
								y = Number(breakdown[1]) + Number(h);
								if(x < sizex && y < sizey) 
									{
										tiledata[i][h] = document.getElementById(x + ":" + y + "_td").style.background;
										document.getElementById(x + ":" + y + "_td").style.background = "#5CA161";
									}	
							}	
					}
		 		lastid = elem;	
			}
	}
function structure_proceed(id, structure, colony)
	{
		window.location = "structures_construct.php?act=process&colony=" + colony + "&structure=" + structure + "&coordinates=" + id;
	}
function modifyPop(id, what)
	{		
		xajax_modifyPop(id, what, modifyPop_cb);
	}
function modifyPop_cb(result)
	{
		xajax_getLayout("dyn_structure_details_occupation", result, ('details_' + result));
		setTimeout("xajax_getLayout('dyn_structure_details_occupation_colony_population', '" + result + "', 'pop_" + result + "')",300);
		setTimeout("xajax_getLayout('dyn_structure_details_occupation_colony_populationimages', '" + result + "', 'popimg_" + result + "')",500);
	}
function modifyInvestment(id, what)
	{
		xajax_modifyInvestment(id, what);	
	}
	
