

function updateWidth (oSender, oForm)
{
    var sVal = oSender[oSender.selectedIndex].value;
    var iWidthFrom, iWidthTo

    if (isNaN(sVal)) 
    {
        if(sVal.indexOf("-") >= 0)
        {
            // This is a range, split on "-" and distribute values
            var wSplit  = sVal.split("-");
            iWidthFrom  = wSplit[0];
            iWidthTo    = wSplit[1];
        }
        else
        {
            // Nope, this is a letter, probably "M", lets swap with constant -1
            iWidthFrom  = -1;
            iWidthTo    = -1;
        }
    }
    else
    {
        // 0, this is for all'
        iWidthFrom  = 0;
        iWidthTo    = 0;        
    }

    oForm["width_from"].value   = iWidthFrom;
    oForm["width_to"].value     = iWidthTo;
    oForm["width_txt"].value     = sVal;
 
}


function updateHeight(oSender, oForm) {
    var sVal = oSender[oSender.selectedIndex].value;
    var iHeightFrom, iHeightTo

    if (isNaN(sVal)) {
        if (sVal.indexOf("-") >= 0) {
            // This is a range, split on "-" and distribute values
            var wSplit = sVal.split("-");
            iHeightFrom = wSplit[0];
            iHeightTo = wSplit[1];
        }
        else {
            // Nope, this is a letter, probably "M", lets swap with constant -1
            iHeightFrom = -1;
            iHeightTo = -1;
        }
    }
    else {
        // 0, this is for all'
        iHeightFrom = 0;
        iHeightTo = 0;
    }

    oForm["height_from"].value = iHeightFrom;
    oForm["height_to"].value = iHeightTo;
    oForm["height_txt"].value = sVal;

}

function checkSwap(oSender) 
{   
    if (oSender)
    {
        oSender.checked = (!oSender.checked);
        
    }
}

function autoIframe(frameId) {

    var objToResize;
    //try {
        frame = document.getElementById(frameId);
        innerDoc = (frame.contentDocument) ? frame.contentDocument : frame.contentWindow.document;
        objToResize = (frame.style) ? frame.style : frame;
        objToResize.height = innerDoc.body.scrollHeight + 10;
        //objToResize.height = Math.max(innerDoc.body.offsetHeight +10 || innerDoc.body.scrollHeight + 10);

    //}
        //catch (err) 
    //{
    //    window.status = err.message;
        //}
        
    return objToResize.height;
}

function setIframeHeight(iheight) 
{

    if (!iheight)
    {
        iheight = autoIframe("frameSearchResults")
    }
    iheight += "";
    iheight = iheight.replace(/px/gi, "");
    iheight = parseInt(iheight);
    
    if (iheight < 500)
    {        
        iheight = 1100;
    }

    iheight += "";
    if (iheight.indexOf("px") < 0) 
    {        
        iheight = iheight + "px";
    }
    
    try
    {    
        document.getElementById("frameSearchResults").style.height = iheight;
    }
    catch (e)
    {
        document.getElementById("frameSearchArchitectResults").style.height = iheight; 
    }
}
