function get_divcount(){
var div = document.getElementsByTagName('div');
var rows=0;
var cols=0;
for(var i=0;i
rows){
rows=trgt.substring(4,5)
}
// get higest col
if (trgt.substring(5,6)>cols){
cols=trgt.substring(5,6)
}
}
}
return [rows,cols];
}
function get_divgrid(){
alert(get_divcount())
var divarray= new Array ([get_divcount()[0]]);
alert(divarray.tostring);
}
function lineup(wsp){ // lineupp all div_xx in body
// get all divs contain 'div_'
var divs = get_divcount();
rows=parseInt(divs[0]); // horisontal div count
cols=parseInt(divs[1]); // vertical divs count
if(!wsp){
wsp=1
}
wspacedivider=wsp;
hspacedivider=4;
// useable body space
var body=document.getElementById('body');
var useableheight=body.parentElement.offsetHeight;
var useablewidth=body.offsetWidth;
var widthdiv=useablewidth/(cols+1);
var heightdiv=useableheight/(rows+1);
var wdivspace=widthdiv/(cols+wspacedivider)
var hdivspace=20;//heightdiv/(rows+hspacedivider)
var leftstart=0;
var topstart=0;
var divheight=0;
for(r=1;r<=rows;r++){
leftstart=0;
for(c=1;c<=cols;c++){
divid='div_'+r+''+c+'';
div=document.getElementById(divid);
if (div){
div.style.display="block";
// set divwspacing and div width
div.style.width=widthdiv+'px';
div.style.left=(leftstart+wdivspace)+'px';
leftstart=leftstart+div.offsetWidth+wdivspace;
// set divhspacing and div width
if (div.offsetHeight>divheight){
divheight=div.offsetHeight
}
div.style.top=(topstart+hdivspace)+'px';
}
if (c==cols){
topstart=topstart+divheight+hdivspace;
}
}
}
}