
function BrowseServer (input_image) {
    var finder = new CKFinder ();
    finder.basePath = '../';
    finder.selectActionFunction = SetFileField;
    finder.popup ();
    window.input_image = input_image;
}

function getCKeditorValue (id) {
    return CKEDITOR.instances[id].getData ();
}

function SetFileField (fileUrl) {
    /*console.log(fileUrl);
     $port = window.location.port;
     $port = $port ? ':' : '' + $port;
     $host = window.location.host;*/
    split = '\/Attachments\/';
    fileUrl = fileUrl.split (split);
    if (!!fileUrl[1]) {
        document.getElementById (window.input_image).value = fileUrl[1];
    }
}

function get_vid_val () {
    var vid = $ ('input.vid:checked');
    if (vid.length) {
        var ids = '';
        $.each (vid, function (index) {
            ids += ',' + vid[index].value;
        });
        return ids.substr (1);
    } else {
        return false;
    }
}

function get_url () {
    var $protocol = location.protocol + '//';
    var $path = location.pathname;
    var $hostname = location.hostname;
    return $protocol + $hostname + $path;
}


