// JavaScript Document<script language="javascript">
<!-- 
function getPosition(e) {
    e = e || window.event;
    var cursor = {x:0, y:0};
	
    if (e.pageX || e.pageY) {
        cursor.x = e.pageX;
        cursor.y = e.pageY;
    } 
    else {
        var de = document.documentElement;
        var b = document.body;
        cursor.x = e.clientX + 
            (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
        cursor.y = e.clientY + 
            (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
    }
    return cursor;
}
//
function iscale (sc_max, i_flo, ix)
{
	var sc = sc_max * Math.exp (-0.25*(ix - i_flo)*(ix - i_flo));
	
	if (sc < 1)
	    sc = 1.0;
	return sc;
}
//
function getCells (ncells)
{
	var cells = new Array();
	
	for (n = 0; n < ncells; n++)
	   {
	       cells[n] =  document.getElementById('cell_' + n);
	   }
	return cells;
}
//
function getImages (ncells)
{
	var images = new Array();
	
	for (n = 0; n < ncells; n++)
	   {
	       images[n] =  document.getElementById('img_' + n);
	   }
	return images;
}
//
function warp (id, ncells, dw, cell_w, cell_h, font_size)
{
	var cell, img;
	var cell_spacing, w, sc_max;
	
	var x = getPosition(event).x - X0;
	var y = getPosition(event).y - Y0;
	
	var i_flo = (x / dw);
	
	sc_max = ((dw - 4) / cell_w);
	
	for (n = 0; n < ncells; n++)
	   {
		   xn = 0.75 + n;
		   sc = iscale (sc_max, i_flo, xn);
		   
	       cell = Cells[n];
		   img  = Images[n];
	
		   cell.style.height = Math.round (sc * cell_h) + 'px';
		   w                 = sc * cell_w;
		   cell.style.width  = Math.round (w) + 'px';
		   
		   img.width = Math.round(w);
		   cell.style.fontSize = Math.round (sc * font_size) + 'px';
	   }
	return ;
}
//
function unwarp (ncells, cell_w, cell_h)
{
	var cell;
	alert ("unwarp");
	
	for (n = 0; n < ncells; n++)
	   {
	       cell = Cells[n];
		   cell.style.height = cell_h + 'px';
		   cell.style.width  = cell_w + 'px';
	   }
	return ;
}
// -->

