function Library_Create(item, pgrid) {
var url='';
if(window.location.search == ''){
url= WorkspaceRoot + 'ASP.NET/Components/DocumentFlow/CreateNew.aspx?' + item.Query;;
}else{
    url= WorkspaceRoot + 'ASP.NET/Components/DocumentFlow/CreateNew.aspx' + window.location.search;
}

//window.open(url);
fmHandleInternal(url, true);
}

function Upload_Documents_Flash(item, pgrid) {
var url= '';
if(window.location.search == ''){
    url=  WorkspaceRoot + 'ASP.NET/Components/DocumentFlow/UploadFile.aspx?' + item.Query;
}else{
    url=   WorkspaceRoot + 'ASP.NET/Components/DocumentFlow/UploadFile.aspx' + window.location.search + '&' + item.Query;
}
window.open(url,"Upload_Documents_Flash", "height=360,width=430,status=yes,toolbar=no,menubar=no,location=no, resizable=no, left=200,top=200,screenX=200,screenY=200");
}

function UploadReplace_SingleDocument_Flash(dID) {
var url= '';
if(window.location.search == ''){
    url= WorkspaceRoot + 'ASP.NET/Components/DocumentFlow/UploadSingleFile.aspx?provider=df&replaceId='+ dID;
}else{
    url= WorkspaceRoot + 'ASP.NET/Components/DocumentFlow/UploadSingleFile.aspx' + window.location.search + '&provider=df&replaceId='+ dID;
}
window.open(url,"SingleDocument", "height=170,width=420,status=yes,toolbar=no,menubar=no,location=no, resizable=no, left=200,top=200,screenX=200,screenY=200");
}

function Upload_Documents(item, pgrid) {
var url= '';
if(window.location.search == ''){
    url= WorkspaceRoot + 'ASP.NET/Components/DocumentFlow/UploadDocuments.aspx?' + item.Query;
}else{
    url= WorkspaceRoot + 'ASP.NET/Components/DocumentFlow/UploadDocuments.aspx' + window.location.search + '&' + item.Query;
}
window.open(url,"Upload_Documents", "height=240,width=430,status=yes,toolbar=no,menubar=no,location=no, resizable=no, left=200,top=200,screenX=200,screenY=200");
}

function DF_AddLink(item, pgrid) {
var url= '';
if(window.location.search == ''){
    url= WorkspaceRoot + 'ASP.NET/Components/DocumentFlow/AddDocumentLink.aspx?provider=df&' + item.Query;
}else{
    url= WorkspaceRoot + 'ASP.NET/Components/DocumentFlow/AddDocumentLink.aspx' + window.location.search + '&provider=df';
}
window.open(url,"DF_AddLink", "height=200,width=365,status=yes,toolbar=no,menubar=no,location=no, resizable=no, left=200,top=200,screenX=200,screenY=200");
}

function DF_AddHTML(item, pgrid) {
var url= '';
if(window.location.search == ''){
    url= WorkspaceRoot + 'ASP.NET/Components/DocumentFlow/HtmlEditor.aspx?provider=df&' + item.Query;
    }else{
    url= WorkspaceRoot + 'ASP.NET/Components/DocumentFlow/HtmlEditor.aspx' + window.location.search + '&provider=df';
    }
window.open(url,"DF_AddHTML", "height=600,width=970,status=yes,toolbar=no,menubar=no,location=no, resizable=no, left=150,top=20,screenX=50,screenY=20");
}

function DF_CopyDocumentShortcut(dID){
var href= window.location.href;
var Root= href.substring(0, href.indexOf('ASP.Net'));
if(Root == ''){
Root= href.substring(0, href.lastIndexOf('/') + 1);
}
    var url= Root + 'DF_DocumentViewer.aspx?id=' + dID;
        clipboardData.setData("Text", url);
}

function DF_Download(dID){
var href= window.location.href;
var Root= href.substring(0, href.indexOf('ASP.Net'));
var url= Root + "ASP.Net/Components/DocumentFlow/Download.aspx?id="+ dID;
window.open(url,"DF_Download","height=100,width=100,status=yes,toolbar=no,menubar=no,location=no, resizable=no, left=400,top=300,screenX=200,screenY=200");

}

function DF_Restore(dID){
if(confirm('Are you sure to undo last move')){
var href= window.location.href;
var Root= href.substring(0, href.indexOf('ASP.Net'));
var url= Root + "ASP.Net/Components/DocumentFlow/RestoreDocument.aspx?id=" + dID + "&provider=df";
window.open(url,"DF_Restore","height=100,width=100,status=yes,toolbar=no,menubar=no,location=no, resizable=no, left=400,top=300,screenX=200,screenY=200");
}

}

function DF_ViewVersions(dID){
var url= WorkspaceRoot + 'ASP.NET/Components/DocumentFlow/DocVersions.aspx?id='+ dID +'&provider=df';
window.open(url,"DF_ViewVersions", "height=150,width=600,status=yes,toolbar=no,menubar=no,location=no, resizable=no, left=200,top=200,screenX=200,screenY=200");
}


function UploadComplete(){
 window.opener.fmRefreshGrid();
 window.close();
}

function OpenInWindowsexplorer(){
    var href= window.location.href;
    var Root='';
    if(href.indexOf('ASP.Net') != -1){
        Root= href.substring(0, href.indexOf('ASP.Net'));
    }else{
        Root= href.substring(0, href.lastIndexOf('/') + 1);
    }
    var url= Root + 'ASP.Net/Components/WebDav/webdavExplore.aspx?link=' + Root + 'df';
    window.open(url,"WindowsExplorer", "height=150,width=100,status=yes,toolbar=no,menubar=no,location=no, resizable=no, left=200,top=200,screenX=200,screenY=200");
}

function CheckIN(id){
if(confirm('Are you sure you want to check in this document')){
    var href= window.location.href;
    var Root= href.substring(0, href.indexOf('ASP.Net'));
    var url= Root + "ASP.Net/Components/DocumentFlow/Check_IN_OUT.aspx?id="+ id + "&checkIn=true";
    window.open(url,"CheckIN","height=100,width=300,status=yes,toolbar=no,menubar=no,location=no, resizable=no, left=400,top=400,screenX=200,screenY=200");
   }
}

function CheckOUT(id){
if(confirm('Are you sure you want to check out this document')){
    var href= window.location.href;
    var Root= href.substring(0, href.indexOf('ASP.Net'));
    var url= Root + "ASP.Net/Components/DocumentFlow/Check_IN_OUT.aspx?id="+ id;
    window.open(url,"CheckOUT","height=100,width=300,status=yes,toolbar=no,menubar=no,location=no, resizable=no, left=400,top=400,screenX=200,screenY=200");
  }
}

function AlertMeDocument(id){
    var href= window.location.href;
    var Root= href.substring(0, href.indexOf('ASP.Net'));
    var url= Root + "ASP.Net/Components/DocumentFlow/AlertMe.aspx?id="+ id;
    window.open(url,"CheckOUT","height=500,width=700,status=yes,toolbar=no,menubar=no,location=no, resizable=no, left=200,top=200,screenX=200,screenY=200");
}

