
   var delim=0;
   var fotoReg= "images\/imgS\/small([0-9]+).jpg$";
   var fotoReg2= "images\/imgS\/small.jpg$";
   var regex = new RegExp(fotoReg);
   var regex2 = new RegExp(fotoReg2);
   var width=200;
   var height=150;

function getImageSize( node) {
    var oHlpr = document.createElement( 'IMG');
    var oPic = node;
    oHlpr.style.visibility = 'hidden';
    oHlpr.style.position = 'absolute';
    oHlpr.top = 0; oHlpr.left = 0;
    oHlpr.src = oPic.src;
    document.body.appendChild( oHlpr);
    var imSize = { 'width':oHlpr.offsetWidth,'height':oHlpr.offsetHeight }
    document.body.removeChild( oHlpr);
    return imSize;
}


   function imageResize() {
   var fotoImg= document.getElementsByTagName('img');
    for (var i=0;fotoImg.length>i;i++) {
          var currentNode = fotoImg[i];

		if (regex.test(currentNode.src) != false) {
                 var tempw=currentNode.width;
                 var temph=currentNode.height;

		if(!currentNode.naturalWidth)
		{
		 var is=getImageSize(currentNode);
                 currentNode.naturalWidth=is.width;
                 currentNode.naturalHeight=is.height;
		}
	    
	    
                delim=0;
            	if(currentNode.naturalWidth > currentNode.naturalHeight) {
		 delim=parseInt(currentNode.naturalWidth)/parseInt(width);
		}
            	else if(currentNode.naturalWidth == currentNode.naturalHeight) {
		 delim=parseInt(currentNode.naturalHeight)/parseInt(height);
		}
            	else if(currentNode.naturalWidth < currentNode.naturalHeight) {
		 delim=parseInt(currentNode.naturalHeight)/parseInt(height);
		}

            	if(currentNode.naturalWidth > width) {
		 delim=parseInt(currentNode.naturalWidth)/parseInt(width);
		}
            	else if(height < currentNode.naturalHeight) {
		 delim=parseInt(currentNode.naturalHeight)/parseInt(height);
		}

		if(delim > 0)
		{
		currentNode.height=parseInt(currentNode.naturalHeight)/delim;
		currentNode.width=parseInt(currentNode.naturalWidth)/delim;
		}
	    }
		else if (regex2.test(currentNode.src) != false) {
                 currentNode.height=40;
                 currentNode.width=200;
	    }
          
        }
      }
    
   function image_Onmouse(val) {

          var currentNode = val;
		if(!currentNode.naturalWidth)
		{
		 var is=getImageSize(currentNode);
                 currentNode.naturalWidth=is.width;
                 currentNode.naturalHeight=is.height;
		}
	    

                 currentNode.width=currentNode.naturalWidth;
                 currentNode.height=currentNode.naturalHeight;
    }

   function image_Outmouse(val) {

          var currentNode = val;
		//alert('delim: '+delim+'\ncurrentNode.height: '+currentNode.height+'\ncurrentNode.width: '+currentNode.width+'\ncurrentNode.naturalHeight: '+currentNode.naturalHeight+'\ncurrentNode.naturalWidth: '+currentNode.naturalWidth);

		if(!currentNode.naturalWidth)
		{
		 var is=getImageSize(currentNode);
                 currentNode.naturalWidth=is.width;
                 currentNode.naturalHeight=is.height;
		}
	    
	    
                delim=0;
            	if(currentNode.naturalWidth > currentNode.naturalHeight) {
		 delim=parseInt(currentNode.naturalWidth)/parseInt(width);
		}
            	else if(currentNode.naturalWidth == currentNode.naturalHeight) {
		 delim=parseInt(currentNode.naturalHeight)/parseInt(height);
		}
            	else if(currentNode.naturalWidth < currentNode.naturalHeight) {
		 delim=parseInt(currentNode.naturalHeight)/parseInt(height);
		}

            	if(currentNode.naturalWidth > width) {
		 delim=parseInt(currentNode.naturalWidth)/parseInt(width);
		}
            	else if(height < currentNode.naturalHeight) {
		 delim=parseInt(currentNode.naturalHeight)/parseInt(height);
		}


		if(delim > 0)
		{
		currentNode.height=parseInt(currentNode.naturalHeight)/delim;
		currentNode.width=parseInt(currentNode.naturalWidth)/delim;
		}
    }
  

