/* Presentation Engine Utility Functions */

function change(id)
{
   var target = document.getElementById(id);
   if (target.style.display == "none")
   {
      target.style.display = "";
   }
   else
   {
      target.style.display = "none";
   }
   
   return true;
}
				
/* ******************************************************************************* */
function scrollToThumbnail(pos)
{
	
	if (document.all['Thumbnail'].length)
	   document.all['Thumbnail'][pos - 1].scrollIntoView();
}


/* Presentation Engine Utility Functions */
/* Function:    resizer
   Description: Sets and image element with src and resized width and height preserving 
                aspect Ratio  
*/
function resizer(thisImage,maxWidth,maxHeight) 
   { 
     var aspect_ratio,width,height;
     
         /*thisImage.style.display = "inline";*/
         
         if (maxHeight == 0)
         {
           maxHeight = 100000;
         }
	 
	 aspect_ratio = thisImage.width / thisImage.height;
	 
	 if ((thisImage.width > maxWidth) || thisImage.height > maxHeight)
	 {
		 if (aspect_ratio <= 1)
		 {
		   thisImage.width = maxHeight * aspect_ratio; 
		   thisImage.height = maxHeight;
		   
		   if (thisImage.width > maxWidth) 
		   {
		     thisImage.height = maxWidth * (1 / aspect_ratio);
		     thisImage.width = maxWidth;
		   }
		   
		 }
		 else 
		 {  
		   thisImage.height = maxWidth * (1 / aspect_ratio);
		   thisImage.width = maxWidth;
		   
		   
		   if (thisImage.height > maxHeight)
		   {
		     thisImage.width = maxHeight * aspect_ratio; 
		   thisImage.height = maxHeight;
		   }
		   
		 }
	 }
    
   }
   
   
   function AdjustUrl(UrlToBeAdjusted) {
      return UrlToBeAdjusted.replace(/_amp_/g,"&");
   }