
function PopulatePortfolios(data, fldId)
{
    var fld = document.getElementById(fldId);
    ClearListBox(fldId);
    var dataArray = data.split(";");
    var opt = new Option("-- All Portfolios --", "0");
    fld.options[0] = opt;
    var curOpt = 1;
    for (var i = 0; i < dataArray.length; i++) 
    {
        var thisOpt = dataArray[i].split(",");
        var opt = new Option(thisOpt[1], thisOpt[0]);
        if (thisOpt[0] != '') 
        {
            fld.options[curOpt++] = opt;
        }
    }
    fld.style.backgroundColor = '#ffffff';
}


function PopulatePFImages(data, fldId) 
{
    var fld = document.getElementById(fldId);
    ClearListBox(fldId);
    var dataArray = data.split(";");
    var opt = new Option("-- All Images --", "0");
    fld.options[0] = opt;
    var curOpt = 1;
    for (var i = 0; i < dataArray.length; i++) 
    {
        var thisOpt = dataArray[i].split(",");
        var opt = new Option(thisOpt[1], thisOpt[0]);
        if (thisOpt[0] != '') 
        {
            fld.options[curOpt++] = opt;
        }
    }
    fld.style.backgroundColor = '#ffffff';
}

function ChangeLblSize(fldId) 
{
    var fld = document.getElementById(fldId);
    ChangeSize(fld);
}
function ChangeSize(fld) 
{
    //alert(fld.id);
    var checkedRel = -1;
    var allopts = document.getElementsByName("radOpt");
    for (var i = 0; i < allopts.length; i++)
    {
        if (allopts[i].checked == true)
        {
            checkedRel = allopts[i].getAttribute('rel');
            //alert(checkedRel);
        }
    }


    var fropts = document.getElementsByTagName("div");
   // alert(fropts.length);
    if (fropts.length > 0)
    {
        for (var i = 0; i < fropts.length; i++)
        {
            if (fropts[i].id == 'fropt_' + fld.value)
            {
                fropts[i].style.display = "block";
                var displayedOpts = fropts[i].getElementsByTagName("input");
                //alert(displayedOpts.length);
                for (var j = 0; j < displayedOpts.length; j++)
                {
                    //alert(displayedOpts[j].id + " - " + displayedOpts[j].getAttribute('rel'));
                    if (displayedOpts[j].getAttribute('rel') == checkedRel)
                    {
                        displayedOpts[j].checked = true;
                    }
                }

            }
            else if (fropts[i].className == "fropt")
            {
                fropts[i].style.display = "none";
            }
            else
            {
            }
        }
    }

    DisplayPrice();
}


function ChangeSizeIE(itemid, tag)
{
    // alert(location.host + ", " + location.pathname);
    location.href = "http://" + location.host + location.pathname + "?item=" + itemid + "&tag=" + tag;
}

function DisplayPriceIE(itemid, optid, tag)
{
    location.href = "http://" + location.host + location.pathname + "?item=" + itemid + "&opt=" + optid + "&tag=" + tag;
}

function DisplayPrice()
{
    var allopts = document.getElementsByName("radOpt");
    var optId = 0;
    for (var i = 0; i < allopts.length; i++) 
    {
        if (allopts[i].checked == true) 
        {
            optId = allopts[i].value;
        }
    }

   // alert(optPrices.length);
    for (var i = 0; i < optPrices.length; i++)
    {
        if (optPrices[i][0] == optId)
        {
            var price = document.getElementById("price");
            price.innerHTML = "&pound;" + optPrices[i][1];
        }
    }
   // alert(optId);
}

function ToggleView(viewall) 
{
    var theForm = document.frmViewall;
    theForm.all.value = (viewall) ? 1 : 0;
    document.frmViewall.submit();
}

function HideHint(fld)
{
    fld.style.backgroundImage = "none";
}
