var thefield; //global set to the field object on the calling form
function FileSelectCK(field)
{
    var finder = new CKFinder();
    //finder.basePath = '../../';    // The path for the installation of CKFinder (default = "/ckfinder/").
    finder.basePath = '/ckfinder/';    // The path for the installation of CKFinder (default = "/ckfinder/").
    
    finder.selectActionFunction = SetFileField;
    thefield=field;
    finder.popup();
    
}

// This is a sample function which is called when a file is selected in CKFinder.
function SetFileField( fileUrl )
{
    thefield.value = fileUrl;
}
