﻿/*A.kostyuk: [ShowBOEditor]  function will work only in edit mode
needs to show custom editors, managers
*/
function ShowBOEditor(commandname, editor, id) {
    commandname = commandname == "" ? "vvvirischeque:webedit" : commandname;
    var ctl = document.getElementById("scWebEditRibbon");
    if (ctl != null) {
        ctl.contentWindow.scForm.invoke(commandname + "(editor=" + editor + ",id=" + id + ")");
    } else {
        alert("Can't find Edit Ribbon, Is It Edit Mode?");
    }
}

function OpenPrint(val) {
    var reg = /.*\?.*/;
    var maches = document.location.href.toString().match(reg);
    var newlocation = document.location.href;
    newlocation += ((maches == null) ? '?' : '&') + val;
    var newWindow = window.open(newlocation);
    var item = $("div.leftSearchContent ol").html();
    if (!item)
        return;
    if (item.length == 0)
        return;
    var content = "<!Doctype html><html xmlns='http://www.w3.org/1999/xhtml'><head><link rel='stylesheet' type='text/css' href='/sites/vvvirischeque/css/VVVButtonStyle.css'><link rel='stylesheet' type='text/css' href='/sites/vvvirischeque/css/import.css'><link rel='stylesheet' type='text/css' href='/sites/vvvirischeque/css/style.css'><link rel='stylesheet' type='text/css' href='/sites/vvvirischeque/css/design.css'><title> VVV Cadeaubon - Cadeaubon gekregen?  </title></head> <body id='body'> <div class='pageWrapper' id='ctl1'> <div class='mainWrapper' id='ctl2'><div class='mainContentWrapper'> <div class='leftPaneWrapper'> <div class='contentRound'> <div class='contentRoundTop' id='contentRoundTop'><div class='leftSearchBlock'><div class='leftSearchContent'><ol>" + item + "</ol></div></div><div class='clear'></div> </div> <div class='contentRoundBottom'><img src='/sites/vvvirischeque/images/content_round_bot-trans.png' alt='content round bottom' height='11' width='641'/> </div> </div> <!--top 5--> </div> <div class='rightPaneWrapper'> </div> </div> </div> </div> <script type='text/javascript'>setTimeout('window.print();', 2000);</script></body> </html>";
    newWindow.document.write(content);
    newWindow.document.close();
}

// Forms

$(function() {
    if ($('div.MssNavigation').length) {
        var $module = $('div.MssNavigation');
        $('input.btn', $module).each(function() {
            $(this).wrap('<span class="custom-button"></span>');
            $(this).after('<ins><!-- --></ins>');
            var text = $(this).val();
            $(this).val('');
            $(this).before('<span>' + text + '</span>')
            Cufon.replace('span.custom-button', { fontFamily: 'VAGRounded', hover: true });
        });
    }
});

