
function rescaleImage(image_name)
{    
 var max_height //= window.innerHeight;    
 var max_width //= window.innerWidth - 400;
 
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      max_width = window.innerWidth - 220,
      max_height = window.innerHeight
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       max_width = document.documentElement.clientWidth - 220,
       max_height = document.documentElement.clientHeight
 }
 
 // older versions of IE
 
 else
 {
       max_width = document.getElementsByTagName('body')[0].clientWidth - 220,
       max_height = document.getElementsByTagName('body')[0].clientHeight
 }

 
 
 
 
    
 var height = image_name.height;    
 var width = image_name.width;
 var ratio
 
 if(height > width)    
  {     
   ratio = height/width; 
  }
  
  else if(width > height)    
  {     
   ratio = width/height; 
  }
  else if(width = height)    
  {     
   ratio = width/height; 
  }
    
 // If height or width are too large, they need to be scaled down    
 // Multiply height and width by the same value to keep ratio constant    
  if(height > width)    
  {        
  //ratio = height / width;        
  height = max_height;// * ratio;        
  width = height / ratio;    
  }
  else  if(width >= height)    
  {        
 // ratio = width / width;        
          
  width = max_width; // * ratio;
  height = width / ratio; 
     if (height > max_height)
	 {
		height =  max_height
		width = height * ratio
	 }
     
  }  
    
  //image_name.width = width;    
  //image_name.height = height; 
  
  //Adon
  //if (width > height)
  //{
 // if (width < max_width)
 // {
//	width =  max_width
//	 if (width < height)
//	 {
//	   height =  width / ratio
//	 }
//	 if (width > height)
//	 {
//	   height =  width * ratio
//	 }
 // }
  
//  if (height < max_height)
//  {
//	height =  max_height
//	 if (width < height)
//	 {
//	   width =  height * ratio
//	 }
//	 if (width > height)
//	 {
//	   width =  height / ratio
//	 }
//  }
//  }
  
//  if (height > width)
//  {
//	height =  max_height
//	width =  height / ratio 
//  }//end adon
  
  image_name.width = width;    
  image_name.height = height; 
  
  return image_name;
  }
  
  
  
  
 
 
 
 
 
 function rescaleGalleryImage(image_name)
{    
 var max_height //= window.innerHeight;    
 var max_width //= window.innerWidth - 400;
 
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      max_width = window.innerWidth - 260,
      max_height = window.innerHeight - 34
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       max_width = document.documentElement.clientWidth - 260,
       max_height = document.documentElement.clientHeight - 34
 }
 
 // older versions of IE
 
 else
 {
       max_width = document.getElementsByTagName('body')[0].clientWidth - 260,
       max_height = document.getElementsByTagName('body')[0].clientHeight - 34
 }

 
 
 
 
    
 var height = image_name.height;    
 var width = image_name.width;
 var ratio
 
 if(height > width)    
  {     
   ratio = height/width; 
  }
  
  else if(width > height)    
  {     
   ratio = width/height; 
  }
  else if(width = height)    
  {     
   ratio = width/height; 
  }
    
 // If height or width are too large, they need to be scaled down    
 // Multiply height and width by the same value to keep ratio constant    
  if(height > width)    
  {        
  //ratio = height / width;        
  height = max_height;// * ratio;        
  width = height / ratio;    
  }
  else  if(width >= height)    
  {        
 // ratio = width / width;        
          
  width = max_width; // * ratio;
  height = width / ratio; 
     if (height > max_height)
	 {
		height =  max_height
		width = height * ratio
	 }
     
  }  
    
 
  
  image_name.width = width;    
  image_name.height = height; 
  
  return image_name;
  } 
  
  
  
  
  
  function rescaleImage2(image_name)
  {    
   
    var max_height
    var max_width
	
	
   // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      max_width = 1,
      max_height = window.innerHeight - 385
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       max_width = 1,
       max_height = document.documentElement.clientHeight - 385
 }
 
 // older versions of IE
 
 else
 {
       max_width = 1,
       max_height = document.getElementsByTagName('body')[0].clientHeight - 385
 }

 
 
 
 
    
 var width = image_name.width;
   
   image_name.width = 1;    
   image_name.height = max_height;
   
   return image_name;
   }
   
   
   
   
   
   
   
   
   function rescaleImage3(image_name)
  {    
   
    var max_height
    var max_width
	
	
   // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      max_width = 1,
      max_height = window.innerHeight - 160
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       max_width = 1,
       max_height = document.documentElement.clientHeight - 160
 }
 
 // older versions of IE
 
 else
 {
       max_width = 1,
       max_height = document.getElementsByTagName('body')[0].clientHeight - 160
 }

 
 
 
 
    
 var width = image_name.width;
   
   image_name.width = 1;    
   image_name.height = max_height;
   
   return image_name;
   }
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
    function rescaleTitleImage(image_name)
  {    
   
    var max_height
    var max_width
	
	
   // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      
      max_height = window.innerHeight - 20
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
      
       max_height = document.documentElement.clientHeight - 20
 }
 
 // older versions of IE
 
 else
 {
     
       max_height = document.getElementsByTagName('body')[0].clientHeight - 20
 }

 
 
 
 
    
 var width = image_name.width;
   
       
   image_name.height = max_height;
   image_name.width = 150;
   
   return image_name;
   }
   
   
   
   
      function rescaleTitle2Image(image_name)
  {    
   
    var max_height
    var max_width
	
	
   // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      max_width = window.innerWidth - 150
     
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       max_width = document.documentElement.clientWidth - 150
      
 }
 
 // older versions of IE
 
 else
 {
       max_width = document.getElementsByTagName('body')[0].clientWidth - 150
       
 }
 
 
 
 
    
 var width = image_name.width;
   
       
   image_name.height = 182;
   image_name.width = max_width;
   
   return image_name;
   }
   
