function popup_product_bin_mod( product, clipbin, action,  div_turn_on, div_turn_off) {
    swap_divs(div_turn_on, div_turn_off);
}

function swap_divs(div_turn_on, div_turn_off) {

    var divCollection = document.getElementsByTagName("div");

    for (var i=0; i<divCollection.length; i++) {
            if(divCollection[i].getAttribute("id") == div_turn_off) {
                divCollection[i].style.display = 'none';
            }
            if(divCollection[i].getAttribute("id") == div_turn_on) {
                divCollection[i].style.display = 'inline';
            }
    }

}



function do_reload_opener_simple() {

window.opener.document.location.href = window.opener.document.location.href;

return true;
}

function do_reload_opener(URL)
{
var prev = window.opener.document.location.href;

prev = prev.replace(/&/g,"*amp*");

window.opener.document.location.href = URL + '&PREV_URL=' + prev;

return true;
}

// When this page is re-loaded from the search results page
// bring it to the front.

function do_page_load_focus(size)
{
  window.focus();

  return true;
}



function expandSection(sectionId)
{
    var field;
    field = document.getElementById(sectionId);
    if(field != null)
        field.style.display = (field.style.display != "block")? "block" : "none";
}


//
// Below here are not needed anymore, but should be saved for future re-use
//


function quality_change_refresh_opener(href)
{
  opener.location.reload(true);
  window.location.href=href;
  if ( opener.document.getElementById("resize_js") ) {
    alert(opener.document.getElementById("resize_js").src);
    opener.document.getElementById("resize_js").src =
        "/oceans/vd?action=popup_javascript&id="+(new Date());
    alert(opener.document.getElementById("resize_js").src);
  }

  return true;
}


function do_page_change_size(size, href)
{
if ( size == 'large' ) {
   window.resizeTo(900,900);
} else {
   window.resizeTo(680,900);
}
window.location.href=href;

return true;
}


function add_product_update_bin(strURL, product, div_turn_on, div_turn_off, icon_div, num_contents_div) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatepage(self.xmlHttpReq.responseText, div_turn_on, div_turn_off, icon_div, num_contents_div);
        }
    }
    self.xmlHttpReq.send(getquerystring(product));
}

function getquerystring(product) {
    qstr = 'screen=add_clip_to_update_bin' + '&' + 'product=' + escape(product) ;  // NOTE: no '?' before querystring
    return qstr;
}

function updatepage(updatetext, div_turn_on, div_turn_off, icon_div, num_contents_div){
//   alert(str);
//   alert(divtag);
   var divCollection = document.getElementsByTagName("div");

    for (var i=0; i<divCollection.length; i++) {
            if(divCollection[i].getAttribute("id") == div_turn_off) {
                divCollection[i].style.display = 'none';
            }
            if(divCollection[i].getAttribute("id") == div_turn_on) {
                divCollection[i].style.display = 'block';
            }
            if(divCollection[i].getAttribute("id") == icon_div) {
                divCollection[i].style.display = 'inline';
            }
            if(divCollection[i].getAttribute("id") == num_contents_div) {
                divCollection[i].innerHTML = updatetext;
            }

    }

}


