// javascript File
function writeFlash(id,fName,fWidth,fHeight) 
{
    //alert("aaa");
    document.getElementById(id).innerHTML = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='"+fWidth+"' height='"+fHeight+"' id='myflash' align='middle'><param name='allowScriptAccess' value='sameDomain' /><param name='movie' value='"+fName+"' /><param name='quality' value='high' /><PARAM NAME=wmode VALUE=transparent><embed src='"+fName+"' quality='high' bgcolor='#ffffff' width='"+fWidth+"' height='"+fHeight+"' name='mymovie' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>";
}






function resize(which) {
var X = new Image() 

  var max="165";
  var elem = document.getElementById(which);
  X.src=elem.src;
  //alert(X.width);
  if (elem == undefined || elem == null) 
  {
  alert("undefined");
  return false;
  }
  if (X.width > max)
      elem.width = max;
  if (X.height > max) 
      elem.height = max;
}



function chang_img(img)
{
    var MaxWidth = 175;
	var MaxHeight = 140;
	var reset = false;
	var newWidth = 175;
	var newHieght = 140;
    tmpImage = new Image();
    //tmpImage.src = img;
    tmpImage.src=document.getElementById(img).src
	
	if (tmpImage.height > tmpImage.width)
        {
            MaxWidth=140;
            MaxHeight=165;
            
        }
	
    if (tmpImage.width> MaxWidth || tmpImage.height > MaxHeight)
    {
    if ((tmpImage.width!=0 ) && (tmpImage.height!=0))
        {
        widthRatio = tmpImage.width / MaxWidth;
        heightRatio = tmpImage.height / MaxHeight;
        ratio = Math.max(widthRatio, heightRatio);
        newWidth = tmpImage.width / ratio;
        newHieght = tmpImage.height / ratio;
        }        	
    }  
    else if (tmpImage.width==0 || tmpImage.height==0)
    {
        MaxWidth=165;
        MaxHeight=165;
        newWidth=165;
        newHeight=165;
    }
    
    //set new height

        //tmpImage.width = newWidth;
		//tmpImage.height = newHeight;
		document.getElementById(img).height=newHieght;
		document.getElementById(img).width=newWidth;
    document.getElementById(img).style.visibility="hidden";   
    document.getElementById(img).src = tmpImage.src;
    document.getElementById(img).style.visibility="visible";


}

