/**ID_PRODUCT:ID_SIZE|ID_CFRAME|ID_FRAME|ID_LINER|ID_FILLET|ID_TMAT|ID_MMAT|ID_BMAT|ID_GLASS|ID_MEDIUM|ID_PCOLOR|ID_ACATEGORY**/
Object.extend = function(destination, source) {
  for (var property in source)
    destination[property] = source[property];
  return destination;
};

function frame_it(properties){
    properties = Object.extend({
            product:0,
            size: 0,
            cframe:0,
            frame:0,
            liner:0,
            fillet:0,
            topmat:0,
            middlemat:0,
            bottommat:0,
            glass:0,
            medium:0,
            pcolor:0,
            acategory:0
        }, properties || {});
    var name = "FRAMER";
    if(properties.size==0){
        var ARR_SELECT = document.getElementsByTagName('select');
        for(var i=0;i<ARR_SELECT.length;i++){
            if(ARR_SELECT[i].className=='size_to_frame')
                properties.size = ARR_SELECT[i].value;
        }
    }

    var url='/pictureframer/framer/index.php?set';
    url+='=' + properties.product;     //ID_PRODUCT
    url+=':' + properties.size;        //ID_SIZE
    url+='|' + properties.cframe;      //ID_CFRAME
    url+='|' + properties.frame;       //ID_FRAME
    url+='|' + properties.liner;       //ID_LINER
    url+='|' + properties.fillet;      //ID_FILLET
    url+='|' + properties.topmat;      //ID_TMAT
    url+='|' + properties.middlemat;   //ID_MMAT
    url+='|' + properties.bottommat;   //ID_BMAT
    url+='|' + properties.glass;       //ID_GLASS
    url+='|' + properties.medium;      //ID_MEDIUM
    url+='|' + properties.pcolor;      //ID_PCOLOR
    url+='|' + properties.acategory;   //ID_ACATEGORY
    // Second window
    /* 
    if(screen.width>1024 && screen.height>768)
        framer=window.open(url, name,'width=1024, height=768, scrollbars=yes');
    else
        framer=window.open(url, name,'fullscreen=yes, scrollbars=yes');
    framer.focus(); */

    window.location.href=url;
}
