/*Img rollover function*/
function rollover(name,source){
    //alert('calling 1');
    document.images[name].src=source;
}
function rollovernew(name,source,swatchnumber){
    //alert('calling 1');
    document.images[name].src=source;
     if (document.ProductDetail.options0 != null && document.ProductDetail.options0[0] != null) {
        document.ProductDetail.options0[0].selectedIndex = swatchnumber;
        if (optionDrops0[0][0] != null){
            OptionSet01();
        }
        else {
            document.ProductDetail.options0.options[swatchnumber].selected = true;
        }
    }
}
/*rollover image, and change the link for an anchor*/
function rollovertwo(name,source,oldlink,newlink, orientation, swatchnumber){
    document.images[name].src=source;
    var anchorIndex = findLinkByHref(oldlink);
    document.links[anchorIndex].href="javascript:openMe('/shopping/product/popupthreed.jsp?file=" + newlink + "','threeD_" + orientation + "');";
    if (document.ProductDetail.options0 != null && document.ProductDetail.options0[0] != null) {
        document.ProductDetail.options0[0].selectedIndex = swatchnumber;
        if (optionDrops0[0][0] != null){
            OptionSet01();
        }
        else {
            document.ProductDetail.options0.options[swatchnumber].selected = true;
        }
    }
    return false;

}
function findLinkByHref(href) {
  for (var i=0; i<document.links.length; i++) {
    //alert( document.links[i].href);
    var linkhref=document.links[i].name;
    if (linkhref.indexOf(href)>=0) return i;
  }
  return -1;
}
