var L_Language_Text="1033";
var L_ClickOnce1_text    = "You are already attempting to save this item. If you attempt to save this item again, you may create duplicate information. Would you like to save this item again?";
var L_STSDelConfirm_Text  = "Are you sure you want to delete this item?";
var L_STSDelConfirm1_Text = "Are you sure you want to delete this folder and all its contents?";
var L_NewDocLibTb1_Text = "The document could not be created. \nThe required application may not be installed properly, or the template for this document library cannot be opened.\n\nPlease try the following:\n1. Check the General Settings for this document library for the name of the template, and install the application necessary for opening the template. If the application was set to install on first use, run the application and then try creating a new document again.\n\n2.  If you have permission to modify this document library, go to General Settings for the library and configure a new template.";
var L_NewDocLibTb2_Text = "'New Document' requires a Windows SharePoint Services-compatible application and Microsoft Internet Explorer 5.0 or greater. To add a document to this document library, click the 'Upload Document' button.";
var L_NewFormLibTb1_Text = "The form could not be created.\nThe required application may not be installed properly, or the template for this form library cannot be opened.\n\nPlease try the following:\n1. Check the General Settings for this form library for the name of the template, and install the application necessary for opening the template. If the application was set to install on first use, run the application and then try creating a new form again.\n\n2.  If you have permission to modify this form library, go to General Settings for the library and configure a new template.";
var L_NewFormLibTb2_Text = "This feature requires Microsoft Internet Explorer 5.0 or later and a Windows SharePoint Services-compatible XML editor such as Microsoft Office InfoPath.";
var L_NewFormLibTb3_Text = "The form(s) could not be merged.\nThe required application may not be installed properly, or the template for this form library cannot be opened.\n\nPlease try the following:\n1. Check the General Settings for this form library for the name of the template, and install the application necessary for opening the template. If the application was set to install on first use, run the application and then try creating a new form again.\n\n2.  If you have permission to modify this form library, go to General Settings for the library and configure a new template.";
var L_NewFormLibTb4_Text = "Select the form(s) you want to merge, and then click 'Merge Forms' on the toolbar.";
var L_NewFormLibTb5_Text = "Select the form(s) you want to relink, and then click 'Relink Forms' on the toolbar.";
var L_NewFormLibTb6_Text = "Only 100 forms can be relinked at a time. Modify your selection and then try again.";
var L_NewFormClickOnce1_Text = "New Folder";
var UTF8_1ST_OF_2         = 0xc0   ;   
var UTF8_1ST_OF_3         = 0xe0   ;   
var UTF8_1ST_OF_4         = 0xf0   ;  
var UTF8_TRAIL            = 0x80   ;   
var HIGH_SURROGATE_BITS   = 0xD800 ;
var LOW_SURROGATE_BITS    = 0xDC00 ;
var SURROGATE_6_BIT       = 0xFC00 ;
var SURROGATE_ID_BITS     = 0xF800 ;
var SURROGATE_OFFSET      = 0x10000;
var BASETYPE_GENERIC_LIST           =   0	;
var BASETYPE_DOCUMENT_LIBRARY       =	1	;
var BASETYPE_SHARED_TEMPLATES       =	2	;
var BASETYPE_DISCUSSION	            =	3	;
var BASETYPE_SURVEY                 =	4	;
var BASETYPE_ISSUE                 =	5	;	
var LISTTEMPLATE_GENERIC_LIST	    =   100	;
var LISTTEMPLATE_DOCUMENT_LIBRARY   =	101	;
var LISTTEMPLATE_SURVEY             =	102	;
var LISTTEMPLATE_LINKS              =	103	;
var LISTTEMPLATE_ANNOUNCEMENTS      =	104	;
var LISTTEMPLATE_CONTACTS           =	105	;
var LISTTEMPLATE_EVENTS             =	106	;	
var LISTTEMPLATE_TASKS              =	107	;
var LISTTEMPLATE_DISCUSSION         =	108	;
var LISTTEMPLATE_IMAGE_LIBRARY      =	109	;
var LISTTEMPLATE_ISSUE_TRACKER      =   1100;
var LISTTEMPLATE_MEETINGS           =	150	;
var LISTTEMPLATE_MEETING_USER       =	202	;
var LISTTEMPLATE_MY_DOCUMENTS       =   2002;
var LISTTEMPLATE_PRIVATE_DOCUMENTS  =   2003;


var L_Edit_Text           = "Edit";
var L_ViewItem_Text       = "View Item";
var L_EditItem_Text       = "Edit Item";
var L_EditSeriesItem_Text = "Edit Series";
var L_DeleteItem_Text     = "Delete Item";
var L_DeleteDocItem_Text  = "Delete";
var L_ViewProperties_Text = "View Properties";
var L_EditProperties_Text = "Edit Properties";
var L_Discuss_Text        = "Discuss";
var L_Subscribe_Text      = "Alert Me";
var L_Review_Text         = "Send for Review";
var L_EditIn_Text         = "Edit in ^1"; 
var L_Checkin_Text        = "Check In";
var L_Checkout_Text       = "Check Out";
var L_CreateDWS_Text      = "Create Document Workspace";
var L_PublishBack_Text    = "Publish to Source Location";
var L_Versions_Text       = "Version History";
var L_Reply_Text          = "Reply";
var L_ExportContact_Text  = "Export Contact";
var L_ExportEvent_Text    = "Export Event";
var L_Reschedule_Text     = "Rescheduling Options";
var L_Move_Text           = "Move";
var L_Keep_Text           = "Keep";
var L_Delete_Text         = "Delete";
var L_Open_Text           = "Open";
var L_SiteSettings_Text   = "Change Site Settings";
var L_ManageUsers_Text    = "Manage Users";
var L_DeleteSite_Text     = "Delete Site";
var L_SiteStorage_Text    = "Manage Site Storage";
var L_Sharing_Text        = "Sharing";
var L_Settings_Text       = "Settings";
var L_Remove_Text         = "Remove from this list";
var L_ModerateItem_Text   = "Approve/reject";
var L_DownloadOriginal_Text = "Download Picture";
var L_EditVersion_Text    = "Edit";
var L_ViewVersion_Text    = "View";
var L_RestoreVersion_Text = "Restore";
var L_DeleteVersion_Text  = "Delete";
var L_EditInOIS_Text      = "Edit Picture";
var L_AddToMyLinks_Text   = "Add to My Links";
var L_AddToCategory_Text  = "Submit to Portal Area";
function ContextInfo()
{
    this.listBaseType   = null;
    this.listTemplate   = null;
    this.listName       = null;
    this.listUrlDir     = null;
    this.HttpPath       = null;
    this.HttpRoot       = null;
    this.imagesPath     = null;
    this.PortalUrl      = null;
    this.isWebEditorPreview = null;
    this.rootFolderForDisplay = null;
    this.isPortalTemplate = null;
    this.isModerated = false; 
    this.recursiveView = false; 
    this.displayFormUrl = null;
    this.editFormUrl    = null;
    this.newFormUrl     = null;   
    this.ctxId          = null;
}



var IsMenuShown = false;
var itemTableDeferred = null;
var itemTable = null;
var imageCell = null;
var onKeyPress = false;
var downArrowText = null;
var currentCtx = null;
var currenMenu = null;
var currentItemID = null;
var currentItemAppName = null;
var currentItemProgId = null;
var currentItemIcon = null;
var currentItemOpenControl = null;
var currentItemFileUrl = null; 
var currentItemFSObjType = null; 
var currentItemCheckedOutUserId = null;
var currentItemCheckoutExpires = null;



function resetExecutionState()
{
    IsMenuShown = false;
    itemTable = null;
    EndDeferItem();
    imageCell = null;
    onKeyPress = false;
    currentCtx = null;
    currenMenu = null;
    currentItemID = null;
    downArrowText = null;
    currentItemAppName = null;
    currentItemProgId = null;
    currentItemIcon = null;
    currentItemOpenControl = null;
    currentItemFileUrl = null;
    currentItemFSObjType = null;
    currentItemCheckedOutUserId = null;
    currentItemCheckoutExpires = null;
}



function setupMenuContext(ctx)
{
    currentCtx = ctx;
}



function StartDeferItem(elm)
{
    if (elm != itemTable)
    {
        itemTableDeferred = elm;
        elm.onmouseout = EndDeferItem;
        elm.onclick = DeferredOnItem;
        elm.oncontextmenu = DeferredOnItem;
    }
}
function DeferredOnItem()
{
    var elm = itemTableDeferred;
    if (elm != null)
    {
        HideSelectedRow();
        OnItem(elm);
        CreateMenu();
        window.event.returnValue=false;
    }
}
function EndDeferItem()
{
    var elm = itemTableDeferred;
    if (elm != null)
    {
        itemTableDeferred = null;
        elm.onmouseout = null;
        elm.onclick = null;
        elm.oncontextmenu = null;
    }
}



////////////GLOBAL VARIABLE DECLARED

var elmnt;
var elmntID='';
var userLink;
var DocLink;
var mURL;
var spanObj;
var menu21=new Array();
var menu22=new Array();
var menu30=new Array();
var menu23=new Array();
var menu24=new Array();

var UserLogin;

UserLogin='';



var objHidden="";
var FName;
var temp="";
//var objHDowlLoad;

//function OnItem(elm,elmID,link,mURL)
//Start Module:Online Form :Added by Dibya on 16/Dec/2008//
function OnItem(elm,elmID,link,mURL)
{
    
    //Start Module :WorkFlow added by Dibya on 29/Jan/2009 For adding Generate Barcode Link on SMS800Inc Site Only 
    var ssite= link.substring(link.lastIndexOf('|Site=')+6);
           
    if(ssite=='SMS800Inc')
    {
        menu13[2]='<tr><td  style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:addToMyLink(userLink,3,mURL);">Generate&nbsp;Barcode</a></td></tr></table>'
        menu15[2]='<tr><td  style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:addToMyLink(userLink,3,mURL);">Generate&nbsp;Barcode</a></td></tr></table>'
        menu16[2]='<tr><td  style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;">a href="javascript:addToMyLink(userLink,3,mURL);">Generate&nbsp;Barcode</a></td></tr></table>'
        menu17[2]='<tr><td  style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;">a href="javascript:addToMyLink(userLink,3,mURL);">Generate&nbsp;Barcode</a></td></tr></table>'
    }
      
   //End Module :WorkFlow added by Dibya on 29/Jan/2009 For adding Generate Barcode Link on Inc Site Only
    //alert('elm = '+elm +' elmID : '+elmID +' link :'+link +' mURL : '+mURL ); 
    var PageValue="";
    var docPath="";
    var docName="";
    var vid="";
    var vTest=""; 
    //Added by satendra date:17/01/09
    var FileName = "";
    FileName=link.substring(link.indexOf('&FileName'));
    FileName=FileName.substring(FileName.indexOf('=')+1);
    //alert(FileName);
    
    //Start :Module:Add to my Document :Added by Dibya on 16/Dec/2008
    temp=link;
   //End: Module:Add to my Document :Added by Dibya on 16/Dec/2008
    if(link.indexOf('&PageName') > 0)
    {
        //PageValue = link.substring(link.indexOf('&PageName')); 
         PageValue = link.substring(link.indexOf('&PageName'),link.indexOf('&FileName')); ////Start :Module:Add to my Document :Added by Dibya on 16/Dec/2008
         
         
        link = link.substring(0,link.indexOf('&PageName'));
        
    }
    if(link.indexOf('&strPath') > 0)
    {
        docPath = link.substring(link.indexOf('&strPath')); 
        
        docPath = docPath.substring(9); 
        
        docName = link.substr(0,link.indexOf('&'));
       //alert(docPath);
        //docName = docPath.substring(docPath.lastIndexOf('/')+1);
        vTest = docPath.substr(0,docPath.indexOf('&SiteName'));
       // alert(vTest);
        vTest = vTest + '/' + docName; 
        
        
       
    }
    if(link.indexOf('&id') > 0)
    {
        
        vid = link.substring(link.indexOf('&id')); 
        vid = vid.substring(4); 
        vid = vid.substr(0,vid.indexOf('&'));
    }
    
    
    
    if(link.indexOf('None-Doc')>0)
    {
        return false;
    }
    
    
 
    userLink = link;
    DocLink=docName;
    //alert(DocLink);
  // alert(userLink);
    //spanObj=mURL;
    //alert(PageValue);
    //alert(mURL)
    // alert(mURL);
    //alert(temp);
    //alert("init" + PageValue);
    
    if(PageValue == '&PageName=Public')
    {
       //alert(PageValue);
        
        
        menu21[0]='<table width="100%" cellspacing="0" cellpadding="0"><tr><td width="100%" style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:callDopostBackDownLoad1('+ "'" + mURL+ "','" + vTest + "'" +');">Download &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></td></tr></table>'
        
        //alert("1");
    }
    if (PageValue == '&PageName=PForms')
    {
       //alert(PageValue);
//    alert(vTest);
        //Added by satendra date:17/01/09
      var TempvTest=vTest.substring(0,vTest.lastIndexOf('/'));
      //  TempvTest =TempvTest.substring(TempvTest.indexOf("~")+1);
      //  var vTest1 = vTest.substring(0,vTest.lastIndexOf('/'));
      vTest=TempvTest+'/'+FileName.substring(0,FileName.indexOf('.'));
      //end
        menu21[0]='<table width="100%" cellspacing="0" cellpadding="0"><tr><td width="100%" style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:callDopostBackDownLoad1('+ "'" + mURL+ "','" + vTest + "'" +');">Download &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></td></tr>'
        menu21[2]='<tr><td width="100%" style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:winshow1(DocLink,6,'+"'"+vTest+"'"+');">Fill Form &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></td></tr></table>'
        
       //alert("2-");
    }
    else if(PageValue == '&PageName=PForms|complex')
    {
     //alert(PageValue);
     menu21[0]='<table width="100%" cellspacing="0" cellpadding="0"><tr><td width="100%" style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:callDopostBackDownLoad1('+ "'" + mURL+ "','" + vTest + "'" +');">Download &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></td></tr>'
     menu21[2] = '</table>';
     
    } //Changed by satendra
    else if(PageValue == '&PageName=PForms|Permission')
    {
        menu21=new Array();
       
        
    }//end Changed by satendra
    if(PageValue == '&PageName=Secure')
    { 
        //alert(PageValue);
      menu21[0]='<table width="100%" cellspacing="0" cellpadding="0"><tr><td width="100%" style="border-bottom:solid 0px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:callDopostBackDownLoad1('+ "'" + mURL+ "','" + vTest + "'" +');">Download &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></td></tr>'
      //Start :Module:Add to my Document :Added by Dibya on 16/Dec/2008
      //menu21[1]='<tr><td width="100%" style="border-bottom:solid 0px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:winshow(userLink,2);">Add to My Documents</a></td></tr>'
      menu21[1]='<tr><td width="100%" style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:winshow(temp,2);">Add to My Documents</a></td></tr></table>'
      
       //End :Module:Add to my Document :Added by Dibya on 16/Dec/2008
      //alert("3");
    
    }
    
    
    //Change for to make new Fill Form Menu By Kamal 28/08/08//
    //alert(PageValue);
    if(PageValue == '&PageName=Forms')
    {
           
      //Added by satendra date:17/01/09
      var TempvTest=vTest.substring(0,vTest.lastIndexOf('/'));
      //  TempvTest =TempvTest.substring(TempvTest.indexOf("~")+1);
      //  var vTest1 = vTest.substring(0,vTest.lastIndexOf('/'));
      vTest=TempvTest+'/'+FileName.substring(0,FileName.indexOf('.'));
      //end
      
     // var faxDownload = "The document being downloaded can only be submitted via fax.Filename must not be changed.";
      //var normalDownload="The document being downloaded can only be submitted by uploading it to the website.This form cannot be submitted via fax.Filename must not be changed.";
     menu21[0]='<table width="100%" cellspacing="0" cellpadding="0"><tr><td width="100%" style="border-bottom:solid 0px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:callDopostBackDownLoad('+ "'" + mURL+ "','" + vTest + "'" +');">Download &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></td></tr>'
     //Start :Module:Add to my Document :Added by Dibya on 16/Dec/2008
     //menu21[1]='<tr><td width="100%" style="border-bottom:solid 0px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:winshow(userLink,2);">Add to My Documents</a></td></tr>'
     menu21[1]='<tr><td width="100%" style="border-bottom:solid 0px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:winshow(temp,2);">Add to My Documents</a></td></tr>'
      //End :Module:Add to my Document :Added by Dibya on 16/Dec/2008
     menu21[2]='<tr><td width="100%" style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:winshow(DocLink,6,'+"'"+vTest+"'"+');">Fill Form &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></td></tr></table>'
     //menu21[3]='<tr><td width="100%" style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:callDopostBackDownLoad('+ "'" + mURL+ "','" + vTest + "'" +');" onclick="javascript:alert('+ "'"+ faxDownload +"' "+');">Download For Fax &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></td></tr></table>'  
     //alert("4");
    }
    else if(PageValue == '&PageName=Forms|complex')
    {
     //alert(PageValue);
    
     menu21[0]='<table width="100%" cellspacing="0" cellpadding="0"><tr><td width="100%" style="border-bottom:solid 0px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:callDopostBackDownLoad('+ "'" + mURL+ "','" + vTest + "'" +');">Download &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></td></tr>'
     //Start :Module:Add to my Document :Added by Dibya on 16/Dec/2008
     //menu21[1]='<tr><td width="100%" style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:winshow(userLink,2);">Add to My Documents</a></td></tr>'
     menu21[1]='<tr><td width="100%" style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:winshow(temp,2);">Add to My Documents</a></td></tr></table>'
     
     //End :Module:Add to my Document :Added by Dibya on 16/Dec/2008
     menu21[2] = '';
    // menu21[3]='<tr><td width="100%" style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:callDopostBackDownLoad('+ "'" + mURL+ "','" + vTest + "'" +');">Download For Fax</a></td></tr></table>' 
     
    }//Changed by satendra
    else if(PageValue == '&PageName=Forms|Permission')
    {
        menu21=new Array();
        
            
    }//end Changed by satendra
   //**************************End**************************//
    
          //menu22[0]='<table width=100% cellspacing="0" cellpadding="0" ><tr><td style="border-bottom:solid 0px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="../SecureContent.aspx?Text=My Documents&URL=Shared%20Documents/'+ mURL + '/My Stuff/My Documents&PControls=none&View='+ mURL + '&docname=' + userLink + '&download=true">Download &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></td></tr>'
       menu22[0]='<table width=100% cellspacing="0" cellpadding="0" ><tr><td style="border-bottom:solid 0px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:fnDload(' + "'" + docName + "','" + docPath + "','" + mURL + "'" + ');">Download &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></td></tr>'
       menu22[1]='<tr><td  style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;" onclick=\"return window.confirm(\'Are you sure you want to remove this document?\')\"><a href="javascript:fnDelDoc(' + "'" + vid + "'" + ');">Remove from My Documents</a></td></tr></table>'
      
    //    menu22[1]='<tr><td  style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:winshow(userLink,4);">Remove from My Documents</a></td></tr></table>'
      
        menu23[0]='<table width=100% cellspacing="0" cellpadding="0" ><tr><td  style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;" onclick=\"return window.confirm(\'Are you sure you want to remove this document?\')\"><a href="javascript:fnDelDoc(' + "'" + vid + "'" + ');">Remove from My Documents</a></td></tr></table>'   
   

     
    
   
   objHidden.value=0;
   if(UserLogin.length>0)
   {   
        objHidden.value=mURL;
        //menu30[0]='<table width=100% cellspacing="0" cellpadding="0" ><tr><td style="border-bottom:solid 0px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:callDopostBack(mURL);">Download&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></td></tr>'
        menu30[0]='<table width=100% cellspacing="0" cellpadding="0" ><tr><td style="border-bottom:solid 0px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:callDopostBack('+ "'" + mURL+ "','" + vTest + "'" +');">Download&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></td></tr>'
        //Start :Module:Add to my Document :Added by Dibya on 16/Dec/2008
        //menu30[1]='<tr><td  style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:winshow(userLink,2);">Add to My Documents</a></td></tr></table>'
        menu30[1]='<tr><td  style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:winshow(temp,2);">Add to My Documents</a></td></tr></table>'
        //End :Module:Add to my Document :Added by Dibya on 16/Dec/2008
         //alert("5");
        
   }
   else
   {
        objHidden.value=mURL;
        //menu30[0]='<table width=100% cellspacing="0" cellpadding="0" ><tr><td style="border-bottom:solid 0px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;border-bottom:solid 1px #0061A1;"><a href="javascript:document.aspnetForm.submit();">Download&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></td></tr>'
        menu30[0]='<table width=100% cellspacing="0" cellpadding="0" ><tr><td style="border-bottom:solid 0px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;border-bottom:solid 1px #0061A1;"><a href="javascript:callDopostBack('+ "'" + mURL+ "','" + vTest + "'" +');">Download&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></td></tr></table>'
        //alert("6");
   }
//   menu30[1]='<tr><td  style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:winshow(userLink,2);">Add to My Documents</a></td></tr></table>'
   
    
    if (!browseris.ie5up || !browseris.win32)
        return false;
    if (IsMenuOn())
    {
        StartDeferItem(elm);
        return false;
    }
    if (itemTable != null)
        OutItem();
    itemTable = elm;
    currentItemID = itemTable.ItemId;   
    var createCtx = new Function("setupMenuContext(" + itemTable.CTXName + ");");
    createCtx();
    var ctx = currentCtx;
    itemTable.className="ms-selectedtitle";
   //alert('hi');
  //Set the value of element to the Global variablebrweb
  elmnt=elm;
  elmntID=elmID;
  
  VarTest=userLink;
  //mURL = mURL;  
    if (browseris.ie55up)
    {
        itemTable.onclick = showAlert;//CreateMenu;
        itemTable.oncontextmenu = CreateMenu;
        
    }
    else 
    { 
        itemTable.onclick = EditMenuDefaultForOnclick;
        itemTable.oncontextmenu = EditMenuDefaultForOnclick;
    }
    itemTable.onmouseout = OutItem;
    titleRow = itemTable.children[0].children[0];
    i = 0;
    while (titleRow.children[i] != null)
        imageCell = titleRow.children[i++];
       
    if (ctx.listTemplate == LISTTEMPLATE_MEETINGS)
    {
        if (itemTable.menuType == "Orphaned") 
            downArrowText = L_Reschedule_Text;
    }
    else
        downArrowText = L_Edit_Text;
    
    //THIS IS WHERE WE ADD CODE FOR THE MENU CHANGES
    var ReturnVal;
    if(PageValue == '&PageName=Forms|Permission')
    {
//        imageCell.children[0].src = ctx.imagesPath + "Images/downarrw.gif";
//        imageCell.children[0].alt = downArrowText;
        //imageCell.children[0].onclick = 'return false;';
//        imageCell.children[0].style.visibility = "visible";    
//        imageCell.style.visibility="visible";
        
        //imageCell.className="ms-menuimagecell";
        return false;
    }
    else
    {
        imageCell.children[0].src = ctx.imagesPath + "Images/downarrw.gif";
        imageCell.children[0].alt = downArrowText;
        imageCell.children[0].onclick = showAlert;
        imageCell.children[0].style.visibility = "visible";    
        imageCell.style.visibility="visible";
        
        imageCell.className="ms-menuimagecell";
        //ReturnVal=true;
    }
    
    return true;
    
    
}


/////////////////////////////FUNCTIONS ADDED  - START//////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
///////////////////MAKE CHANGES REQUIRED IN THE FUNCTION BELOW///////////////////
/////////////////////////////////////////////////////////////////////////////////

function showAlert()
{
	//alert(elmntID.toString());
	switch(elmntID.toString())
	{
		case "m11":
			dropdownmenu(elmnt, event, menu11, '200px');
			break;
			
		case "m12":
			dropdownmenu(elmnt, event, menu12, '400px');
			break;
			
		case "m13":		    
		    dropdownmenu(elmnt, event, menu13, '130px');
			break;
			
		case "m14":
			dropdownmenu(elmnt, event, menu14, '107px');
			break;	
			
		case "m15":
			dropdownmenu(elmnt, event, menu15, '240px');
			break;	
			
		case "m16":
			dropdownmenu(elmnt, event, menu16, '240px');
			break;	
			
	    case "m17":
			dropdownmenu(elmnt, event, menu17, '240px');
			break;
			
		case "m18":
			dropdownmenu(elmnt, event, menu18, '170px');
			break;		
			
		case "m21":
			dropdownmenu(elmnt, event, menu21, '130px');
			break;	
		
		case "m22":
			dropdownmenu(elmnt, event, menu22, '170px');
			break;	
			
		case "m23":
		    dropdownmenu(elmnt, event, menu23, '170px');
			break;	
			
		case "m24":
		    dropdownmenu(elmnt, event, menu24, '170px');
			break;					
			
    	case "m30":
			dropdownmenu(elmnt, event, menu30, '130px');
			break;	
		
		
		
		
		
		/*Add new cases as the example below, only change the value specified in the square brackets..
		case "value":
			dropdownmenu(elmnt, event, [menu var name defined below], '250px');
			break;
		*/
	}
}
var varSts;


function winshow(xelm,xstatus,xpath)
{   
  //alert(xelm);
   //alert('inside method-');
   //alert('xelm : '+xelm +' xstatus : '+xstatus +' xpath :'+xpath);
//    alert(xstatus);
   //alert(xpath);
    var userval;
    varSts=xstatus;
       if(xstatus  == '2')
    {  
        //Adding Documents to MyFolder
            var addVal;
            userval = false;
           
            addVal=window.confirm('Are you sure you want to add documents?');
            //alert(addVal);
            if(addVal)
            {
                var PageName = "../PopPupFavDoc.aspx";
                //Start :Module Online Form :Added by Dibya on 16/Dec/2008
                var VarUrl = PageName + "?docname=" + xelm + "&sts=" + xstatus + "&rankey=" + Math.floor ( Math.random ( ) * 100 + 1 );
                //var VarUrl = PageName + "?docname=" + xelm + "&sts=" + xstatus + "&rankey=" + Math.floor ( Math.random ( ) * 100 + 1 );
               //alert(VarUrl);
                CreateXmlReq();
       	        
   	            if(XmlReq)
	            {
	                XmlReq.onreadystatechange = HandleaddDoc;
		            XmlReq.open("GET", VarUrl, true);
		            XmlReq.send();	
                }
            }
    }
    else if(xstatus  == '3')
    {
        //Removing quick link from My Quick LInks
        userval=window.confirm('Are you sure you want to remove this link?');
    }
    else if(xstatus  == '4')
    {
        //Removing documents from my documents
        userval=window.confirm('Are you sure you want to remove this document?');
    }
    else if(xstatus  == '6')
    {
        OpenOnlineForm(xelm,xpath);
    }
   
    //alert(userval);
    if(userval)
    {
           // don`t delete commented code...........By Abhishek Verma
            var PageName = "../PopPupFavDoc.aspx";
            var VarUrl = PageName + "?docname=" + xelm + "&sts=" + xstatus;
            CreateXmlReq();
	        if(XmlReq)
	        {
	            XmlReq.onreadystatechange = HandleRes;
		        XmlReq.open("GET", VarUrl, true);
		        XmlReq.send();	
			}
   }
}

function winshow3(xelm,xstatus)
{
  
  //alert(xelm);
    //alert('inside method-');
  //  alert('xelm : '+xelm +' xstatus : '+xstatus );
//    alert(xstatus);
//    alert(xpath);
    var userval;
    varSts=xstatus;
       if(xstatus  == '2')
    {  
        //Adding Documents to MyFolder
            var addVal;
            userval = false;
           
            addVal=window.confirm('Are you sure you want to add documents?');
            if(addVal)
            {
                var PageName = "../PopPupFavDoc.aspx";
                //Start :Module Online Form :Added by Dibya on 16/Dec/2008
                var VarUrl = PageName + "?docname=" + xelm + "&sts=" + xstatus + "&rankey=" + Math.floor ( Math.random ( ) * 100 + 1 );
                //var VarUrl = PageName + "?docname=" + xelm + "&sts=" + xstatus + "&rankey=" + Math.floor ( Math.random ( ) * 100 + 1 );
                
                CreateXmlReq();
       	        
   	            if(XmlReq)
	            {
	                XmlReq.onreadystatechange = HandleaddDoc;
		            XmlReq.open("GET", VarUrl, true);
		            XmlReq.send();	
                }
            }
    }
}


//Common function to open a HTML form based on the Form type and the WSS Path passed to it.
function OpenOnlineForm(SMSFormType,xpath)
{
    //alert(SMSFormType+'-'+xpath);
    
    //SMSFormType=SMSFormType.replace(".pdf","")
    //SMSFormType=SMSFormType.toLowerCase();
    window.open('../../ReDirectPopOP.aspx?wsspath='+xpath+ '&SMSFormType='+SMSFormType+'','help','toolbar=no,location=no,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=1100,height=900,Top=20,Left=20');
   
    //alert(formtype);
//    switch(formtype)
//    {
//        case 'sms-110':
//        window.open('../Controls/OnlineForms/HTML/SMS-110.aspx?wsspath='+xpath+'','help','toolbar=no,location=no,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=900,height=900,Top=20,Left=20');
//        break;
//        
//        case 'sms-10':
//        window.open('../Controls/OnlineForms/HTML/SMS-10.aspx?wsspath='+xpath+'','help','toolbar=no,location=no,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=900,height=900,Top=20,Left=20');
//        break;

//        case 'sms-57a':
//        window.open('../Controls/OnlineForms/HTML/SMS-57a.aspx?wsspath='+xpath+'','help','toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=900,height=750,Top=20,Left=20');
//        break;

//        case 'sms-17':
//        window.open('../Controls/OnlineForms/HTML/SMS-17.aspx?wsspath='+xpath+'','help','toolbar=yes,location=no,directories=no,status=yesmenubar=yes,scrollbars=yes,resizable=yes,width=900,height=750,Top=20,Left=20');
//        break;

//        case 'sms-47':
//        window.open('../Controls/OnlineForms/HTML/SMS-47.aspx?wsspath='+xpath+'','help','toolbar=yes,location=no,directories=no,status=yesmenubar=yes,scrollbars=yes,resizable=yes,width=900,height=750,Top=20,Left=20');
//        break;

//        case 'sms-66':
//        window.open('../Controls/OnlineForms/HTML/SMS-66.aspx?wsspath='+xpath+'','help','toolbar=yes,location=no,directories=no,status=yesmenubar=yes,scrollbars=yes,resizable=yes,width=900,height=750,Top=20,Left=20');
//        break;
//        
//        case 'sms-6a':
//        window.open('../Controls/OnlineForms/HTML/SMS-6a.aspx?wsspath='+xpath+'','help','toolbar=yes,location=no,directories=no,status=yesmenubar=yes,scrollbars=yes,resizable=yes,width=900,height=750,Top=20,Left=20');
//        break;

//        case 'sms-64':
//        window.open('../Controls/OnlineForms/HTML/SMS-64.aspx?wsspath='+xpath+'','help','toolbar=yes,location=no,directories=no,status=yesmenubar=yes,scrollbars=yes,resizable=yes,width=900,height=750,Top=20,Left=20');
//        break;

//        case 'sms-19':
//        window.open('../Controls/OnlineForms/HTML/SMS-19.aspx?wsspath='+xpath+'','help','toolbar=yes,location=no,directories=no,status=yesmenubar=yes,scrollbars=yes,resizable=yes,width=900,height=750,Top=20,Left=20');
//        break;

//        case 'sms-40':
//        window.open('../Controls/OnlineForms/HTML/SMS-40.aspx?wsspath='+xpath+'','help','toolbar=yes,location=no,directories=no,status=yesmenubar=yes,scrollbars=yes,resizable=yes,width=900,height=750,Top=20,Left=20');
//        break;

//        case 'sms-41':
//        window.open('../Controls/OnlineForms/HTML/SMS-41.aspx?wsspath='+xpath+'','help','toolbar=yes,location=no,directories=no,status=yesmenubar=yes,scrollbars=yes,resizable=yes,width=900,height=750,Top=20,Left=20');
//        break;
//        
//        case 'sms-44':
//        window.open('../Controls/OnlineForms/HTML/SMS-44.aspx?wsspath='+xpath+'','help','toolbar=yes,location=no,directories=no,status=yesmenubar=yes,scrollbars=yes,resizable=yes,width=900,height=750,Top=20,Left=20');
//        break;

//        case 'sms-42':
//        window.open('../Controls/OnlineForms/HTML/SMS-42.aspx?wsspath='+xpath+'','help','toolbar=yes,location=no,directories=no,status=yesmenubar=yes,scrollbars=yes,resizable=yes,width=900,height=750,Top=20,Left=20');
//        break;

//        case 'sms-57b':
//        window.open('../Controls/OnlineForms/HTML/SMS-57b.aspx?wsspath='+xpath+'','help','toolbar=yes,location=no,directories=no,status=yesmenubar=yes,scrollbars=yes,resizable=yes,width=900,height=750,Top=20,Left=20');
//        break;

//        case 'sms-57':
//        window.open('../Controls/OnlineForms/HTML/SMS-57.aspx?wsspath='+xpath+'','help','toolbar=yes,location=no,directories=no,status=yesmenubar=yes,scrollbars=yes,resizable=yes,width=900,height=750,Top=20,Left=20');
//        break;

//        case 'sms-57a':
//        window.open('../Controls/OnlineForms/HTML/SMS-57a.aspx?wsspath='+xpath+'','help','toolbar=yes,location=no,directories=no,status=yesmenubar=yes,scrollbars=yes,resizable=yes,width=900,height=750,Top=20,Left=20');
//        break;

//        case 'sms-38':
//        window.open('../Controls/OnlineForms/HTML/SMS-38.aspx?wsspath='+xpath+'','help','toolbar=yes,location=no,directories=no,status=yesmenubar=yes,scrollbars=yes,resizable=yes,width=900,height=750,Top=20,Left=20');
//        break;

//        case 'sms-20':
//        window.open('../Controls/OnlineForms/HTML/SMS-20.aspx?wsspath='+xpath+'','help','toolbar=yes,location=no,directories=no,status=yesmenubar=yes,scrollbars=yes,resizable=yes,width=900,height=750,Top=20,Left=20');
//        break;

//        case 'sms800 enhancement request':
//        window.open('../Controls/OnlineForms/HTML/sms800 Enhancement Request.aspx?wsspath='+xpath+'','help','toolbar=yes,location=no,directories=no,status=yesmenubar=yes,scrollbars=yes,resizable=yes,width=900,height=750,Top=20,Left=20');
//        break;

//        case 'sms800enhancementrequest':
//        window.open('../Controls/OnlineForms/HTML/SMS800EnhancementRequest.aspx?wsspath='+xpath+'','help','toolbar=yes,location=no,directories=no,status=yesmenubar=yes,scrollbars=yes,resizable=yes,width=900,height=750,Top=20,Left=20');
//        break;
//    }

}


//fil
function winshow1(xelm,xstatus,xpath)
{
    var userval;
    varSts=xstatus;
    
    if(xstatus  == '2')
    {  
        //Adding Documents to MyFolder
        var addVal;
        userval = false;
        
        addVal=window.confirm('Are you sure you want to Fill Form?');
        
    }    
   
    else if(xstatus  == '6')
    {
       OpenOnlineForm(xelm,xpath);
    }
    
    
    if(userval)
    {
           // don`t delete commented code...........By Abhishek Verma
            var PageName = "../PopPupFavDoc.aspx";
            var VarUrl = PageName + "?docname=" + xelm + "&sts=" + xstatus;
            CreateXmlReq();
	        if(XmlReq)
	        {
	            XmlReq.onreadystatechange = HandleRes;
		        XmlReq.open("GET", VarUrl, true);
		        XmlReq.send();	
			}
   }
}


//------------------------------------------------------------------------------

function HandleRes()
{
	if(XmlReq.readyState == 4)
	{
		if(XmlReq.status == 200)
		{	
		    if(varSts == '4')
		    {
		        chkAvailabilityDocpopUp();
		    }
		    else if(varSts == '3')
		    {
		       chkAvailabilityQuickLinkpopUp();
		    }
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}
function HandleaddDoc()
{
    if(XmlReq.readyState == 4)
	{
		if(XmlReq.status == 200)
		{
		    alert("The document has been added." );	
		    //chkAvailabilityDocpopUp();		
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}
function CreateXmlReqNew()
{
	try
	{
		XmlReq = new ActiveXObject("Msxml2.XMLHTTP");
		
	}
	catch(e)
	{
		try
		{
			XmlReq = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch(oc)
		{
			XmlReq = null;
		}
	}
	if(!XmlReq && typeof XMLHttpRequest != "undefined") 
	{
	   XmlReq = new XMLHttpRequest();
	}
}

var secs
var timerID = null
var timerRunning = false
var delay = 1000
var myControl
function InitializeTimer(controlvk)
{
    myControl = controlvk;
    // Set the length of the timer, in seconds
    secs = 60    
    StopTheClock()    
    StartTheTimer(controlvk)
    
    
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function StartTheTimer()
{
    if (secs==0)
    {
        StopTheClock()
        // Here's where you put something useful that's
        // supposed to happen after the allotted time.
        // For example, you could display a message:
        //alert("You have just wasted 10 seconds of your life.")
        
        myControl.close();
    }
    else
    {
        //self.status = secs
        secs = secs - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer()", delay)
    }
}



var reqAjaxPageUrl;
var Statusmode;
function addToMyLink(verLink,varMode,mURL)
{
 var ssite=verLink.substring(verLink.lastIndexOf('|Site=')+6);

      //Start -Module :Workflow Added by Dibya on 26th/Nov/2008 for Generate Barcode Link
    
      var path=verLink.substring(verLink.indexOf('|')+1,verLink.lastIndexOf('|'));       
      var indx=path.indexOf('|URL'); 
     
      var pth;
      if(indx>0)
      {
            path=path.substring(path.indexOf('|')+1);
            
      }
      
   //End -Module :Workflow Added by Dibya on 26th/Nov/2008 for Generate Barcode Link
    
    Statusmode=varMode;
    var userAction
    var uAction;
  
    if(varMode == '1')
    {
        userAction=window.confirm('Are you sure you want to add this link to My Quick Links?');
    }
    else if(varMode == '2')
    {
        userAction=window.confirm('Are you sure you want this page to be set as your start page?');
    }
    //Start -Module :Workflow Added by Dibya on 25th Nov 2008 for adding Generate Barcode Link (Module :Workflow) 
    else     
    {     
            userAction=window.confirm('Generate Barcode'); ///Start -Module :Workflow Altered by Dibya on 24/Jan/2009 fpr making BarCode to Barcode
            if(userAction)
            {            
                 url = '../Controls/WorkFlow/GenerateBarcode.aspx?' + path;
                 myname ='mywin';
                 myfeatures ='slocation=no,width=500,height=150,Top=175,Left=350';
                 window.open(url, myname, myfeatures); 
                 //InitializeTimer(windvk);
            } 
              
     
    }
    //End -Module :Workflow Added by Dibya on 25th Nov 2008 for adding Generate Barcode Link (Module :Workflow) 
   
    
    
   if (userAction){
  
         reqAjaxPageUrl = 'PopUpWindow.aspx?link='+ verLink + '&mode=' + varMode + '&URL=' + mURL + "&testVal" + Math.floor ( Math.random ( ) * 100 + 1 );
           
           
            CreateXmlReq();
            if(XmlReq)
	        {
		        XmlReq.onreadystatechange = HandleResponsenew;
		        XmlReq.open("GET", reqAjaxPageUrl,  true);
		        XmlReq.send();	
	        }
	}
   
}
function HandleResponsenew()
{
//4 means connection has been established successfully and ready to use
	if(XmlReq.readyState == 4)
	{
	
	//200 means successful reterive the data
		if(XmlReq.status == 200)
		{			
			GetSystemMsgAjax(XmlReq.responseXML.documentElement);
		}
		else
		{
			alert("There was a problem retrieving data from the server." );
		}
	}
}
function GetSystemMsgAjax(ResultVal)
{
    //-------------Retrieve Message alert-------
    var mess = ResultVal.getElementsByTagName('Message')[0].text;
   // alert(mess);
}

//--------------------------------------------------------------------------------------------------
//Add new menu Arrays as required for different pages. 
//Contents for menu 1

var menu11=new Array()
menu11[0]='<table width=100% cellspacing="0" cellpadding="0" ><tr><td style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="#">Remove from My Quick Links</a></td></tr></table>'

//Contents for menu 2, and so on
var menu12=new Array()
menu12[0]='<table width=100% cellspacing="0" cellpadding="0" ><tr><td style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="#">Remove from My Quick Links</a></td></tr></table>'

//Contents for menu 3, and so on addToMyLink(verP)
var menu13=new Array()
menu13[0]='<table width=100% cellspacing="0" cellpadding="0" ><tr><td style="border-bottom:solid 0px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a  href="javascript:addToMyLink(userLink,1,mURL);">Add to My Quick Links</a></td></tr>'
menu13[1]='<tr><td  style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:addToMyLink(userLink,2,mURL);">Set as Start Page&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a></td></tr>'
//Start -Module :Workflow Added By Dibya on 25th Nov for generating BarcCode

//menu13[2]='<tr><td  style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:addToMyLink(userLink,3,mURL);">Generate&nbsp;Barcode</a></td></tr></table>'
//End -Module :Workflow Added By Dibya on 25th Nov for generating BarcCode

//Contents for menu 4, and so on
//menu14[0]='<a href="javascript:addToMyLink(userLink,1,mURL);">Add to My Quick Links</a>\n'
var menu14=new Array()
menu14[0]='<table width=100% cellspacing="0" cellpadding="0" ><tr><td style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:addToMyLink(userLink,2,mURL);">Set as Start Page</a></td></tr></table>'

//Contents for menu 5, and so on
var menu15=new Array()
menu15[0]='<table width=100% cellspacing="0" cellpadding="0" ><tr><td style="border-bottom:solid 0px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:addToMyLink(userLink,1,mURL);">Add to My Quick Links</a></td></tr>'
menu15[1]='<tr><td  style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:addToMyLink(userLink,2,mURL);">Set as Start Page</a></td></tr>'
//Start -Module :Workflow Added By Dibya on 25th Nov for generating BarcCode
//menu15[2]='<tr><td  style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:addToMyLink(userLink,3,mURL);">Generate&nbsp;Barcode</a></td></tr></table>'
//End -Module :Workflow Added By Dibya on 25th Nov for generating BarcCode

//Contents for menu 6, and so on
var menu16=new Array()
menu16[0]='<table width=100% cellspacing="0" cellpadding="0" ><tr><td style="border-bottom:solid 0px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:addToMyLink(userLink,1);">Add to My Quick Links</a></td></tr>'
menu16[1]='<tr><td  style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:addToMyLink(userLink,2);">Set as Start Page</a></td></tr>'
//Start -Module :Workflow Added By Dibya on 25th Nov for generating BarcCode
//menu16[2]='<tr><td  style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;">a href="javascript:addToMyLink(userLink,3,mURL);">Generate&nbsp;Barcode</a></td></tr></table>'
//End -Module :Workflow Added By Dibya on 25th Nov for generating BarcCode

//Contents for menu 7, and so on
var menu17=new Array()
menu17[0]='<table width=100% cellspacing="0" cellpadding="0" ><tr><td style="border-bottom:solid 0px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:addToMyLink(userLink,1,mURL);">Add to My Quick Links</a></td></tr>'
menu17[1]='<tr><td  style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:addToMyLink(userLink,2,mURL);">Set as Start Page</a></td></tr>'
//Start -Module :Workflow Added By Dibya on 25th Nov for generating BarcCode
//menu17[2]='<tr><td  style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;">a href="javascript:addToMyLink(userLink,3,mURL);">Generate&nbsp;Barcode</a></td></tr></table>'
//End -Module :Workflow Added By Dibya on 25th Nov for generating BarcCode

//Modified by Abhishek Verma
var menu18=new Array()
menu18[0]='<table width=100% cellspacing="0" cellpadding="0" ><tr><td style="border-bottom:solid 1px #0061A1;border-top:solid 1px #0061A1;border-left:solid 1px #0061A1;border-right:solid 1px #0061A1;"><a href="javascript:winshow(userLink,3);">Remove from My Quick Links</a></td></tr></table>'

//DECIDES THE DEFAULT MENU LOOK AND FEEL.		
var menuwidth='165px'//'100px' //default menu width
var menubgcolor='#eeeeee'//'red'  //menu bgcolor
var disappeardelay=250 //100  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype)
{
      
        var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
        var parentEl=what.offsetParent;
        
        while (parentEl!=null)
        {
        totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
        parentEl=parentEl.offsetParent;
        }
     
      if(offsettype=="left" && (elmntID.toString()=="m21" || elmntID.toString()=="m30"))  
      {
        totaloffset = totaloffset  + what.offsetWidth - 130 ;
      }
      else if(offsettype=="left" && (elmntID.toString()=="m22" || elmntID.toString()=="m18" || elmntID.toString()=="m23"))  
      {
        totaloffset = totaloffset  + what.offsetWidth - 170 ;
      }      
  
    return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth)
{
    if (ie4||ns6)
        dropmenuobj.style.left=dropmenuobj.style.top="-500px"
         //alert(dropmenuobj.contentmeasure); 
    
    if (menuwidth!="")
    {
    dropmenuobj.widthobj=dropmenuobj.style
    dropmenuobj.widthobj.width=menuwidth   
    }
   
    if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
        obj.visibility=visible
    else if (e.type=="click")
        obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}   
function clearbrowseredge(obj, whichedge){

var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{

var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight

if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){
//move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge) < dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge

}
}
return edgeoffset

}

function populatemenu(what){
//alert(what);
if (ie4||ns6)


//Start Module : WorkFlow Added by Dibya on 29/Jan/2009
dropmenuobj.innerHTML=what.join("")
//    alert(userLink);
//    alert(elmntID.toString());
//    //if site is not SMS800Inc and elmntID.toString()='m13' or m15 or m16 or m17 then remove from menucontents the td of Generate Barcode
//    var ssite= userLink.substring(userLink.lastIndexOf('|Site=')+6);   
////    alert(ssite);
//    if(ssite!='SMS800Inc' && (elmntID.toString()=='m13' || elmntID.toString()=='m15' || elmntID.toString()=='m16' || elmntID.toString()=='m17'))
//    {
//        
//        var content=what;
//        content=content.toString().substring(0,content.toString().lastIndexOf(',<tr>'))+'</table>';
//        
//        dropmenuobj.innerHTML=content
//        alert(content);
//        alert(dropmenuobj.innerHTML);
//       
//    }
//    else
//    {
//    dropmenuobj.innerHTML=what.join("")
//    }
    

//Strat Module : WorkFlow Added by Dibya on 29/Jan/2009

//alert(dropmenuobj.innerHTML);
}


function dropdownmenu(obj, e, menucontents, menuwidth){
 
    if (window.event) event.cancelBubble=true
    else if (e.stopPropagation) e.stopPropagation()
    clearhidemenu()

    dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv    
    //alert()
    populatemenu(menucontents)
//    alert(document.getElementById("dropmenudiv").value);
//     alert(document.getElementById("dropmenudiv").innerHTML);

    if (ie4||ns6)
    {   //changed by satendra
        if(menucontents.length>0)
        {//end changed by satendra
            showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
            dropmenuobj.x=getposOffset(obj, "left")
            dropmenuobj.y=getposOffset(obj, "top") 
            
            dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
            dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
       //changed by satendra 
       }//end changed by satendra
       else
       {
         alert('You do not have permission to submit/download this form.')
       }
       
        
    }

    return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true;
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e)
{

if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu();
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu();
}

function hidemenu(e)
{
    if (typeof dropmenuobj!="undefined")
    {
        if (ie4||ns6)
        dropmenuobj.style.visibility="hidden"
    }


}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu()
{
if (typeof delayhide!="undefined")
    clearTimeout(delayhide);
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu;


/////////////////////////////FUNCTIONS ADDED BY RITAM  - END//////////////////////////////

function OutItem()
{
    if (!IsMenuOn() && itemTable != null)
    {
        itemTable.className="ms-unselectedtitle";
        itemTable.onclick = "";
        itemTable.onmouseout = "";
        if (imageCell != null)
        {
            imageCell.children[0].style.visibility="hidden";
            imageCell.style.visibility="hidden";
            imageCell.bgColor="";
                      
        }
        resetExecutionState();
    }
}

function IsMenuOn()
{
    if (!IsMenuShown)
        return false;
    var fIsOpen = false;

	if (!fIsOpen)
		IsMenuShown = false;
    return fIsOpen;
}

function CreateMenu()
{
    if (! IsContextSet()) 
        return;
    var ctx = currentCtx;
    if (itemTable == null || imageCell == null ||
        (onKeyPress == false &&
         (event.srcElement.tagName=="A" ||
          event.srcElement.parentNode.tagName == "A")))
        return;
    IsMenuShown = true;
    window.document.body.onclick="";
  
    m = CMenu(currentItemID + "_menu");
    currenMenu = m;
	if (ctx.isVersions)
		AddVersionMenuItems(m, ctx);
    else if (ctx.listBaseType == BASETYPE_DOCUMENT_LIBRARY)
        AddDocLibMenuItems(m, ctx);
    else if (ctx.listTemplate == LISTTEMPLATE_MEETINGS)
         AddMeetingMenuItems(m, ctx);
    else   
         AddListMenuItems(m, ctx);
    OMenu(m, itemTable, null, null, -1);
    document.body.onclick=HideSelectedRow;
    return false;
}


function IsContextSet()
{
    if (currentCtx == null || currentCtx.HttpPath == null ||
        currentItemID == null)
        return false;
    else
        return true;
}
var IMNControlObj = null;
var bIMNControlInited = false;
var IMNDictionaryObj = null;
var bIMNSorted = false;
var bIMNOnloadAttached = false;
var IMNOrigScrollFunc = null;
var bIMNInScrollFunc = false;
var IMNSortableObj = null;
var IMNHeaderObj = null;
var IMNNameDictionaryObj = null;
var IMNShowOfflineObj = null;
function EnsureIMNControl()
{
    if (!bIMNControlInited)
    {
        if (browseris.ie5up && browseris.win32)
        {

        }
        bIMNControlInited = true;
        if (IMNControlObj)
        {
            IMNControlObj.OnStatusChange = IMNOnStatusChange;
        }
    }
    return IMNControlObj;
}

