 function lib_open_img_window(src,width,height){
   if(width==0)
     width=500;
   width+=20;
   if(height==0)
     height=400;
   height+=20;
   if(height>600)
     height=600;
   var left = (screen.availWidth/2) - (width/2);
   var top = (screen.availHeight/2) - (height/2);
   info=window.open('/img_preview.php?src='+src,'info','resizable=1, scrollbars=1, toolbar=0, status=0, width='+width+', height='+height+', left='+left+', top='+top);
   info.focus();
 }
function open_window(src, id, width, height){
   if(width==0)   width=500;
   width+=20;
   if(height==0)  height=400;
   height+=20;
   if(height>600)  height=600;
   var left = (screen.availWidth/2) - (width/2);
   var top = (screen.availHeight/2) - (height/2);
   info=window.open('/'+src+'?id='+id,'photo','resizable=1, scrollbars=1, toolbar=0, status=0, width='+width+', height='+height+', left='+left+', top='+top);
   info.focus();
 }


/**
 * Вопрос-ответ
 */

function faqSend(){
    var name = $('#faq_name').attr('value');
    var contacts = $('#faq_contacts').attr('value');
    var question = $('#faq_q').attr('value');

    if ( name != '' && contacts != '' && question != '' ){
        /// Передача данных раздела
        $.post(
        '/faq_form.php',
        {
            act: "save",
            name: name,
            contacts: contacts,
            question: question
        },
        function(result){
            res_list = result.split("<!--split-->");
            var good = res_list[1];
            var msg = res_list[2];
            if ( good == 'good' ){
                $('#msg').html('<div class="good">'+msg+'</div>');
                $('#form_faq_inside').hide();
            }
            else{
                $('#msg').html(msg);
            }
        }
        );
    }
}



/**
 * Для партнёров
 */

function forpartnSend(){
    var name = $('#faq_name').attr('value');
    var company = $('#faq_org').attr('value');
    var city = $('#faq_city').attr('value');
    var purpose = $('#faq_aim').attr('value');
    var contacts = $('#faq_contacts').attr('value');

    $('#forpartn_form .ajax').show();

    if ( name != '' && company != '' && city != '' && purpose != '' && contacts != '' ){
        /// Передача данных раздела
        $.post(
        '/forpartn.php',
        {
            act: "save",
            name: name,
            company: company,
            city: city,
            purpose: purpose,
            contacts: contacts
        },
        function(result){
            res_list = result.split("<!--split-->");
            var good = res_list[1];
            var msg = res_list[2];
            if ( good == 'good' ){
                $('#msg').html('<div class="good">'+msg+'</div>');
                $('#forpartn_form').hide();
            }
            else{
                $('#msg').html(msg);
                $('#forpartn_form .ajax').hide();
            }
        }
        );
    }
}


/**
 * Резюме
 */
function resumeSend(form){
    /// Передача данных раздела
    $.ajaxUpload
    ({
        url: '/resume_form.php',
        secureuri: false,
        uploadform: form,
        type: 'POST',
        dataType: 'html',
        success: function(data, status){
            res_list = data.split("<!--split-->");
            var good = res_list[1];
            var msg = res_list[2];
            if ( good == 'good' ){
                $('#msg').html('<span class="ok">'+msg+'</span>');
                $('#msg').show();
                $('#form_res').hide();
                $('h2.sendResumeLink').hide();
            }
            else{
                $('#msg').html('<span class="bad">'+msg+'</span>');
                $('#msg').show();
            }
        },
        error: function (data, status){
        }
    });
}
