function open_close(id) {
    var div = document.getElementById(id);
    if (!div) return false;
    if (div.style.display == 'none') {
            div.style.display = 'block';
    } else {
         div.style.display = 'none';
    }
    return false;

}

function show_color_production(id, div){
        var table = document.getElementById('color_set');
        colors = table.getElementsByTagName("div");
        for (var i = 0; i < colors.length; i++) {
           colors[i].style.border = '0px';
        } 
        
        div.style.border = '2px solid #fcd603';
        //посылаем запрос на сервер
        JsHttpRequest.query(
                "/request/",{'id': id},
                function(responseJS, error) {
                    if (responseJS) {
                        var prod_img = document.getElementById('prod_img');
                        prod_img.src = '/img/production/big/'+responseJS.img_name;
                        prod_img.width = responseJS.img_width;
                        prod_img.height = responseJS.img_height;
                        // меняем url ссылки
                        var zoom_link = $('zoom_link');
                        zoom_link.href = '/img/production/orig/'+responseJS.img_name
                    }
                },
            true
        );
        return false;
     } 

function open_preview(img_name) {
    var img_preview = document.getElementById('img_preview');
    img_preview.src = '/elements_img/small/'+ img_name;
    img_preview.style.display = 'block';
    _x= this.__calMouseXPos; 
   // r= mousePageXY();
    img_preview.style.top = this.__calMouseYPos+'px';
    img_preview.style.left = this.__calMouseXPos+15+'px';
    return false;
}

function hide_preview() {
    var img_preview = document.getElementById('img_preview');
    img_preview.style.display = 'none';   
}

function open_window(id, cat_id) 
{ 
x=screen.width/2-300;  
y=screen.height/2-300;
height = cat_id == 2  ? 800 : 600;
popupWin = window.open("/popup/"+id+'/', "contacts", "location,width=600,height="+height+",left="+x+', top='+y);
//popupWin.blur(); // передаём фокус новому окну
  
//e=screen.availHeight;  
//r=screen.availWidth;  
    //ScrWindow=window.open("/","","toolbar=no,location=no,left=0,top=0,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width="+width+",height="+height+""); 
//    if (ScrWindow != null && ScrWindow.opener == null) ScrWindow.opener=window; 
//    ScrWindow.document.open(); 
//    ScrWindow.document.writeln ("<html><head><title>"+title+"</title></head><body>"+content+"</body></html>"); 
//    ScrWindow.document.close(); 
} 

//function show_menu_cont (id) {
//    ${}
//    
//}

