// phpmax.co.cc
// 30.Nov.2010 22:13
// (c) pbboard.com

function ResizeAv(what){
if(maxAvWidth<1 || maxAvHeight<1){return false;}
if(parseInt(what.width)>maxAvWidth) {
what.height=(maxAvWidth/what.width)*what.height;
what.width=maxAvWidth;
}
if (parseInt(what.height)>maxAvHeight) {
what.width=(maxAvHeight/what.height)*what.width;
what.height=maxAvHeight;
}
}

function ResizeIt(what){
var imgHeight;
var imgWidth;
imgWidth = what.width;
imgHeight = what.height;
resize=0;
if(maxWidth<1 || maxHeight<1){return false;}
widthorig=what.width;
heightorig=what.height;
if(parseInt(what.width)>maxWidth) {
what.height=(maxWidth/what.width)*what.height;
what.width=maxWidth;
resize=1;
}
if (parseInt(what.height)>maxHeight) {
what.width=(maxHeight/what.height)*what.width;
what.height=maxHeight;
resize=1;
}
if(resize==1){
image = new Image();
image = what;
newImage = image.cloneNode( true );
newImage.origHeight = image.height;
 newImage.origWidth = image.width
if(image.outerHTML){}
else {newImage.onclick = function() {};}
if(parentNode = image.parentNode){
textMessage = resLng+" "+imgWidth+"*"+imgHeight;
elem = document.createElement("td");
var newDiv = null;
newDiv = document.createElement("div");
newDiv.setAttribute("class", "resizebar");
newDiv.innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javascript: jQuery.facebox({image:'"+what.src+"'});\">"+textMessage+"</a>";
elem.appendChild(newImage);
elem.appendChild(newDiv);
tableRow = document.createElement("tr");
tableRow.appendChild(elem);
TableElem = document.createElement("table");
TableElem.appendChild(tableRow);
frag = document.createElement("div");
frag.appendChild(TableElem);
if(image.outerHTML)
{
image.outerHTML = frag.innerHTML;
}
else {
parentNode.replaceChild( TableElem, image );
}}}}
