if ( typeof Eduify == "undefined"){
	Eduify = function(){};
}

if ( typeof Eduify.Utils == "undefined"){
    Eduify.Utils = new function(){
        var isInProgress = false;        
        var contextMenuFlag = true;
        var FocusControlId=null;
        var _BubbleWindow=null;
        return{            
            GetContextMenuFlag : function()
            {
                return contextMenuFlag;
            },
            SetContextMenuFlag : function(val)
            {
                contextMenuFlag = val;
            },            
            SwapWidgetVisibility: function(widBodyId, widInfoId, icn)
            {// providing the collapse/exapnd functionality to the widget
                //alert(widBodyId + " " + widInfoId);
                var widBody = $j("*[id$="+widBodyId+"]")[0];
                var widInfo = $j("*[id$="+widInfoId+"]")[0];
	            if(widBody != null)
	            {
		            //if(widBody.className.toUpperCase().indexOf("DN") == -1)
		            if(widBody.style.display != "none")
		            {
			            widBody.style.display = "none";
			            //$j(widBody).slideDown("fast");
		                //widBody.className = widBody.className.toUpperCase().replace("DB","DN");
			            widInfo.value = "C";
			            icn.className = "icn_ex_co BI211";
		            }
		            else
		            {
			            //$j(widBody).slideUp("fast");
                        widBody.style.display = "block";
		                //widBody.className = widBody.className.toUpperCase().replace("DN","DB");
			            widInfo.value = "E";
			            icn.className = "icn_ex_co BI212";
		            }
	            }
            },
            //Open the Editor for the Provided Document Id
            OpenEditor:function(pDocId)
            {
                window.open('editor?documentId='+pDocId,'eddoc'+pDocId,'toolbar=0,menubar=0,location=0,channelmode=1,resizable=1');
                //window.open("editor?documentId="+pDocId);
            },
            OpenFile:function(pFileId)
            {
                window.open("editor?documentId=-3&fileId="+pFileId,'edfile'+pFileId,'toolbar=0,menubar=0,location=0,channelmode=1,resizable=1');
            },
            ReadEssayInEditor:function(pDocId, pEssayId)
            {
                window.open('editor?documentId='+pDocId+'&essayId=' + pEssayId,'edEssay'+pEssayId,'toolbar=0,menubar=0,location=0,channelmode=1,resizable=1');
            },            
            OpenEssayEditor:function(pAppPath)
            {
                var lPath = '';
                if(pAppPath){
                    lPath = pAppPath + '/';
                }
                window.open(lPath + 'editor?documentId=-5&type=essay','edEssay','toolbar=0,menubar=0,location=0,channelmode=1,resizable=1');
            },
            OpenContestEssay:function()
            {
                window.open('Contest?param=myessay');
            },
            // Displays a Gray out Opaque Div over the screen
            GrayOutOn : function(pTop,pLeft,pWidth,pHeight,pTargetElementId,pzIndex){                
                var lOpDiv  = document.createElement('div');
                var pnlContent = null;
                
                if (pTargetElementId != null && pTargetElementId.nodeType){
                    pnlContent = pTargetElementId;
                }
                else if (pTargetElementId != null && pTargetElementId != ""){
                    pnlContent = $j("*[id$="+pTargetElementId+"]")[0];
                }else{
                    pnlContent = $j("*[id$=pnlScreenContents]")[0];
                }
                
                if(pTop == -1 && pLeft== -1 && pWidth== -1 && pHeight == -1){
                    pTop = Eduify.Utils.GetABSTop(pnlContent);
                    pLeft = Eduify.Utils.GetABSLeft(pnlContent);
                    pWidth = $j(pnlContent).outerWidth(true);
                    pHeight=  $j(pnlContent).outerHeight(true);
                }
                document.body.appendChild(lOpDiv);
                lOpDiv.className = 'Elightbox_bg DB';
                lOpDiv.style.left = pLeft + "px";
                lOpDiv.style.top = pTop + "px";
                lOpDiv.style.width = pWidth+5+ "px";
                if(typeof pzIndex != 'undefined')
                {
                    lOpDiv.style.zIndex = pzIndex;
                }
                lOpDiv.style.height = pHeight+5+ "px";
                lOpDiv.style.display = "block";
            },
            // Removes a Gray out Opaque Div 
            GrayOutOff : function (pzIndex){
                var lOpDiv =null;
                var lOpDiv1 = $j('.Elightbox_bg');
                if(typeof pzIndex != 'undefined')
                {
                    for(var lIndex = 0;lIndex < lOpDiv1.length;lIndex++){
                    if(lOpDiv1[lIndex].style.zIndex == pzIndex)
                    {
                        lOpDiv = lOpDiv1[lIndex];
                    }
                    }
                }else{
                    lOpDiv = lOpDiv1[0];
                }
                document.body.removeChild(lOpDiv);
            },
            // Retunrs the Absolute Left position of the provided element
            GetABSLeft: function (pElement){
                var posleft = pElement.offsetLeft;
                if (pElement.offsetParent != null && pElement.offsetParent.tagName.toLowerCase() != "body")
                    posleft += Eduify.Utils.GetABSLeft(pElement.offsetParent);
                return posleft;
            },
            // Retunrs the Absolute Top position of the provided element
            GetABSTop : function(pElement){                        
                var posTop = pElement.offsetTop;
                if (pElement.offsetParent!= null && pElement.offsetParent.tagName.toLowerCase() != "body")
                    posTop += Eduify.Utils.GetABSTop(pElement.offsetParent);
                return posTop;            
            },
            HideConfirmDlg : function(){
                $j("div[id$=wdwConfirm]")[0].control.hide();
            },
            ShowConfirmDlg : function(){
                $j("div[id$=wdwConfirm]")[0].control.show();
            },
            HideVerifyEmailDlg : function(){
                $j("div[id$=wdwVerifyEmail]")[0].control.hide();
            },
            ShowVerifyEmailDlg : function(){
                $j("div[id$=wdwVerifyEmail]")[0].control.show();
            },
            HidePrflIncmDlg : function(){
                if(window.history.length > 1)
                {
                    window.history.go(-1);
                }
                else 
                {
                    window.location.replace('home');
                }
            },
            //WARP Panel Request Event for Default Grayout Effect
            RefRequest : function(oPanel, oEvent, pId)
            {   
                if (!this.isInProgress)
                {
                    this.isInProgress = true;
                    Eduify.Utils.GrayOutOn(-1,-1,-1,-1,null,50);
                }
                else
                {
                    oEvent.cancel = true;
                }
            },
            //WARP Panel Response Event for Default Grayout Effect
            RefResponse : function(){
                Eduify.Utils.GrayOutOff(50);
                this.isInProgress = false;
            },
              ReportInitializeTab : function (oWebTab){
              
                //Left Slice Css Classes
                var lTabLCss = ["PB0 W8 H20 BI103 spTabBlueLeft BB1111",   //Default
                                "PB0 W8 H20 BI103 spTabWhiteLeft BB1102",  //Hover
                                "PB0 W8 H20 BI103 spTabWhiteLeft BB1102",  //Selected
                                "PB0 W8 H20 BI103 spTabBlueLeft BB1111"    //Disabled
                                ];
                //Right Slice Css Classes
                var lTabRCss = ["PB0 W8 H20 BI103 spTabBlueRight BB1111",  //Default
                                "PB0 W8 H20 BI103 spTabWhiteRight BB1102", //Hover
                                "PB0 W8 H20 BI103 spTabWhiteRight BB1102", //Selected
                                "PB0 W8 H20 BI103 spTabBlueRight BB1111"   //Disabled
                                ];
                var lTabMCss = [
                                "PB0 H20 DB PT6 TC BI103 FAB1500 CO02 spTabBlueRepeat BB1111",
                                "PB0 H20 DB PT6 TC BI103 FAB1500 CO119 spTabWhiteRepeat BB1102",
                                "PB0 H20 DB PT6 TC BI103 FAB1500 CO119 spTabWhiteRepeat BB1111",
                                "PB0 H20 DB PT6 TC BI103 FAB1500 CO02 spTabBlueRepeat BB1111"
                                ];
                //Resetting Defaults Css Classes
                for(var lIndex = 0;lIndex <4;lIndex++){
                    oWebTab._cssL[lIndex] = lTabLCss[lIndex];
                    oWebTab._cssR[lIndex] = lTabRCss[lIndex];
                }

                $j("#"+oWebTab.ID+"_tbl > tbody > tr:first > td:last").addClass("BB1111");
                var ldivExportEmailPrint=$j("div[id$=EmailExportPrint]")[0];
                  $j("#"+oWebTab.ID+"_tbl > tbody > tr:first > td:last").html(ldivExportEmailPrint);
                
                $j("#"+oWebTab.ID+"_tbl > tbody > tr:first > td[id=sep]").addClass("H20 DIB BB1111");
                //Applying Css Classes for First User
                for(var index=0 ;index < oWebTab.Tabs.length; index++){
                    lTab = oWebTab.Tabs[index];
                    lTab.css = lTabMCss;
                    lTab.elemLeft.className = lTabLCss[0];
                    lTab.element.className = lTabMCss[0];
                    lTab.elemRight.className = lTabRCss[0];
                }
                // Applying Selected Css on Selected Tab
                lTab = lTab = oWebTab.Tabs[0];
                lTab = oWebTab.getSelectedTab();
                lTab.elemLeft.className = lTabLCss[2];
                lTab.element.className = lTabMCss[2];
                lTab.elemRight.className = lTabRCss[2];
                $j("#"+oWebTab.ID+"_cp")[0].className="CB DB";
                
            },
            InitializeTab : function (oWebTab){
                //Left Slice Css Classes
                var lTabLCss = ["PB0 W8 H20 BI103 spTabBlueLeft BB1111",   //Default
                                "PB0 W8 H20 BI103 spTabWhiteLeft BB1102",  //Hover
                                "PB0 W8 H20 BI103 spTabWhiteLeft BB1102",  //Selected
                                "PB0 W8 H20 BI103 spTabBlueLeft BB1111"    //Disabled
                                ];
                //Right Slice Css Classes
                var lTabRCss = ["PB0 W8 H20 BI103 spTabBlueRight BB1111",  //Default
                                "PB0 W8 H20 BI103 spTabWhiteRight BB1102", //Hover
                                "PB0 W8 H20 BI103 spTabWhiteRight BB1102", //Selected
                                "PB0 W8 H20 BI103 spTabBlueRight BB1111"   //Disabled
                                ];
                var lTabMCss = [
                                "PB0 W90 H20 DB PT6 TC BI103 FAB1500 CO02 spTabBlueRepeat BB1111 WSNWI",
                                "PB0 W90 H20 DB PT6 TC BI103 FAB1500 CO119 spTabWhiteRepeat BB1102 WSNWI",
                                "PB0 W90 H20 DB PT6 TC BI103 FAB1500 CO119 spTabWhiteRepeat BB1111 WSNWI",
                                "PB0 W90 H20 DB PT6 TC BI103 FAB1500 CO02 spTabBlueRepeat BB1111 WSNWI"
                                ];
                //Resetting Defaults Css Classes
                for(var lIndex = 0;lIndex <4;lIndex++){
                    oWebTab._cssL[lIndex] = lTabLCss[lIndex];
                    oWebTab._cssR[lIndex] = lTabRCss[lIndex];
                }

                $j("#"+oWebTab.ID+"_tbl > tbody > tr:first > td:last").addClass("BB1111");
                $j("#"+oWebTab.ID+"_tbl > tbody > tr:first > td[id=sep]").addClass("H20 DIB BB1111");
                //Applying Css Classes for First User
                for(var index=0 ;index < oWebTab.Tabs.length; index++){
                    lTab = oWebTab.Tabs[index];
                    lTab.css = lTabMCss;
                    lTab.elemLeft.className = lTabLCss[0];
                    lTab.element.className = lTabMCss[0];
                    lTab.elemRight.className = lTabRCss[0];
                }
                // Applying Selected Css on Selected Tab
                lTab = lTab = oWebTab.Tabs[0];
                lTab = oWebTab.getSelectedTab();
                lTab.elemLeft.className = lTabLCss[2];
                lTab.element.className = lTabMCss[2];
                lTab.elemRight.className = lTabRCss[2];
                $j("#"+oWebTab.ID+"_cp")[0].className="CB DB";
                
            },// Initiailize tab ends here
                //After Tab change Event for IG Tab Control
            AfterTabChange : function(oWebTab,oTab,oEvent){
                //Resetting Content Pane Css and Bg Color.
                $j("#"+oWebTab.ID+"_cp")[0].className="CB DB";
            },
            WorkBoxTabHeaderDiv:function(oWebTab){
   
            Eduify.Utils.InitializeTab(oWebTab);
            var ldivAmount=$j("div[id$=divAmount]")[0];
            $j("#"+oWebTab.ID+"_tbl > tbody > tr:first > td:last").html(ldivAmount);
            
            },
            DocumentClick : function()
            {
                $j(document).click(
                    function(pEvent){
                        if (FocusControlId !=null)
                        {
                            if (pEvent.target.id ==(FocusControlId+"_input"))
                            {
                                    return false;
                            }
                            var combo=igcmbo_getComboById(FocusControlId);
                            if (combo!=null)
                            {
                                var lHidden=lHidden=document.getElementById(FocusControlId+"_HF");
                                var lFlag=0;
                               if (lHidden!=null && lHidden.value==combo.getDisplayValue())
                                {
                                    lFlag=1;
                                }
                                else
                                {
                                    lHidden.value=combo.getDisplayValue();
                                }
                                Eduify.Utils.WebComboPostBack(FocusControlId,lFlag);
                            }
                            FocusControlId =null;
                        }
                    }
                );
            },
            Init_Combo :function (cmbo){
            
                cmb_img = document.getElementById(cmbo+"_img");
                cmb_img.className="DN";
                cmb_img.height=cmb_img.width="";
                cmb_img.style.height=cmb_img.style.width="auto";
                cmb_img.src="images/spacer.gif"; 

            },
            WebComboHideDropDown:function(webComboId,newValue,keyCode)
            {
                 var combo=igcmbo_getComboById(webComboId);
                 if (keyCode == 9)
                 {
                    combo.setDropDown(false);
                 }
            },
            WebCombo_EditKeyDown : function(webComboId,newValue,keyCode)
            {
                //Init_Combo(webComboId);
                //if user press enter or tab
                var lHidden;
                var flag=0;
                var combo = igcmbo_getComboById(webComboId);
                FocusControlId=webComboId;
                if (document.createElement) 
                {
                    lHidden=document.getElementById(webComboId+"_HF");
                    if (lHidden==null)
                    {               
                        lHidden = document.createElement('input');              
                        lHidden.type = 'hidden';
                        lHidden.id=webComboId+"_HF";
                        document.forms[0].appendChild(lHidden);
                        lHidden.value=combo.getDisplayValue();
                    }
                    else
                    {
                        if (lHidden.value==combo.getDisplayValue())
                        {
                            flag=1;
                        }
                        else
                        {
                            lHidden.value=combo.getDisplayValue();
                        }
                    }
                }
                if (keyCode==9)
                {
                    Eduify.Utils.WebComboPostBack(webComboId,flag)
                }
               
            },
            WebComboPostBack:function(webComboId,flag)
            {
            
                 var combo=igcmbo_getComboById(webComboId);
                 combo.setDropDown(false);
                 var str=combo.getDisplayValue();
                 if (combo.getValue()!=null && combo.selectedIndex==-1)
                 {
                    setTimeout("Eduify.Utils.WebComboPostBack('"+webComboId+"','"+flag+"')",0);
                 }
                 if((combo.getValue() == null && (str != null) && (str!="")) || (combo.selectedIndex!=-1))
                 { 
                    if (flag==0)
                    {
                     __doPostBack(combo.UniqueId,str);
                    }
                 }                   
            },
            ContextMenuStyle : function(id,lHeightClass,lMenuWidthClass,lTableWidthClass,lBorderWidth)
            {   /* This functin apples styles on context menu.*/
                var mainDiv = $j("#"+id+"_MainM > div")[0];
                var mainTable = $j("#"+id+"_MainM > div > table")[0];
                $j("#"+id+"_MainM").addClass(lMenuWidthClass);
                $j(mainTable).removeClass("BCT").addClass("AL BC2I");
                $j(mainTable).addClass(lHeightClass + " " + lTableWidthClass);
                
                /* Top elements Start */
                var lTopElm = document.createElement("div");
                lTopElm.className = "DB "+lMenuWidthClass;
                                                               
                var lT1 = document.createElement("div");
                lT1.className = "AL W18 H18 Cont_LeftTop F02";
                var lT2 = document.createElement("div");
                lT2.className = "AL H18 BC2I "+lBorderWidth;
                var lT21 = document.createElement("div");
                lT21.className = "AL Cont_HorTopBg F02 "+lBorderWidth;
                lT2.appendChild(lT21);
                var lT3 = document.createElement("div");
                lT3.className = "AR W18 H18 Cont_RightTop F02";
                
                lTopElm.appendChild(lT1);
                lTopElm.appendChild(lT2);
                lTopElm.appendChild(lT3);
                /* Top elements end */
                
                /* Left element Start */
                var lLeftElm = document.createElement("div");
                lLeftElm.className = "AL W10 Cont_VerLeftBg F02 DIB " + lHeightClass;
                /* Left element end */
                                   
                /* Right element Start */                                                                
                var lRightElm = document.createElement("div");
                lRightElm.className = "AL W7 Cont_VerRightBg F02 DIB " + lHeightClass;
                /* Right element End */                                                                
                               
                /* Bottom Elements Start*/
                var lBottomElm = document.createElement("div");
                lBottomElm.className = "DB "+lMenuWidthClass;
                                                               
                var lB1 = document.createElement("div");
                lB1.className = "AL W18 H18 Cont_LeftBottom F02 PB3";
                var lB2 = document.createElement("div");
                lB2.className = "AL H18 BC2I "+lBorderWidth;
                var lB21 = document.createElement("div");
                lB21.className = "AL Cont_HorBottomBg H18 F02 MT9 "+lBorderWidth;
                lB2.appendChild(lB21);
                var lB3 = document.createElement("div");
                lB3.className = "AR W18 H18 Cont_RightBottom F02 PB3";
                
                lBottomElm.appendChild(lB1);
                lBottomElm.appendChild(lB2);
                lBottomElm.appendChild(lB3);                
                /* Bottom Elements End*/
                if(mainDiv != undefined)
                {
                    mainDiv.insertBefore(lLeftElm,mainDiv.firstChild);
                    mainDiv.insertBefore(lTopElm,mainDiv.firstChild);  
                    mainDiv.appendChild(lRightElm);                                     
                    mainDiv.appendChild(lBottomElm);         
                }
            },
            ///Resets the Iframe Border for Infragistcis Dialog Control
            DlgInit :function(oDialog,oParams){
                oDialog.get_contentPane().get_iframe().frameBorder=0;
                oDialog.get_contentPane().get_iframe().scrolling="no";
            },
            TextBoxOnFocus : function(textbox, text)
            {   // This function set the value of textbox to empty.
                if(textbox.value == text) textbox.value='';
            },
            TextBoxOnChange : function(textbox, text)
            {   // This function set the value of textbox to default value provided.
                if(textbox.value.length == 0) textbox.value = text;
            },
            OpenShareForRBox : function(pClipId, pIsAddBook)
            {
                if(pClipId ==null || parseInt(pClipId)=="NaN" || pClipId <=0)
                {
                    if(typeof Eduify.ClipList != "undefined")
                    {
                        pClipId = Eduify.ClipList.GetSelectedClipId();
                    }
                }
                if(pClipId == null || pClipId == -1 || parseInt(pClipId) == "NaN"){
                    Eduify.Alert("error :: ","Please select a clipping to share.",EdButtons.OkOnly);
                    return;
                }
                 
                if(pIsAddBook)
                {
                    Eduify.Utils.OpenShareDlg(null,null,pClipId,null);
                }else{
                     Eduify.Utils.OpenAddressbookDlg(null,pClipId);    
                }
                
            },
            OpenShareForRBoxAllSel : function(pClipId)
            {   
                if(pClipId ==null || parseInt(pClipId)=="NaN" || pClipId <=0)
                {
                    if(typeof Eduify.ClipList != "undefined")
                    {
                        pClipId = Eduify.ClipList.GetSelectedClipId();
                    }
                }
                if(pClipId == null || pClipId == -1 || parseInt(pClipId) == "NaN"){
                    Eduify.Alert("error :: ","Please select a clipping to share.",EdButtons.OkOnly);
                    return;
                }
                Eduify.Utils.OpenHomeInviteDlg(null,pClipId);
                
            },
            OpenShareForPBox : function(pDocId,pFileId,pIsAddBook)
            {   
                var lDocId = -1;
                var lFileId = -1;
                if(pDocId == null || parseInt(pDocId)=="NaN" || pDocId <= 0)
                {
                    if(typeof Eduify.PBox != "undefined")
                    {
                        pDocId =  Eduify.PBox.GetSelectedDocument();
                    }
                }
              
                if(pDocId == null || pDocId <= 0 || parseInt(pDocId) == "NaN"){                                            
                    //Not a document                    
                    if(pFileId == null || parseInt(pFileId)=="NaN" || pFileId <= 0)
                    {
                        if(typeof Eduify.PBox != "undefined")
                        {
                            lFileId =  Eduify.PBox.GetSelectedFile();
                        }
                    }else{
                        lFileId = pFileId;
                    }                
                }else{
                    //Document
                    lDocId = pDocId;
                }
                
                if(lDocId == -1 && lFileId == -1)
                {
                    Eduify.Alert("error :: ","Please select a document to share.",EdButtons.OkOnly);
                    return;                                                  
                }
                if(lDocId > 0)
                {
                    if(pIsAddBook)
                    {                    
                        Eduify.Utils.OpenSharePermissionDlg(lDocId,null,null,'false');                    
                    }else
                    {
                        Eduify.Utils.OpenAddressbookDlg(pDocId,null);    
                    }
                }else{
                    //File error
                    var lIsEduifyFile = Eduify.UI.Common.AJAXMethods.IsEditorAllowedFile(parseInt(lFileId)).value;    
                    if(lIsEduifyFile)
                    {
                        Eduify.Alert("error :: ","This file cannot be shared. Please convert it to an Eduify document first.",EdButtons.OkOnly);
                    }else{
                        Eduify.Alert("error :: ","This file cannot be shared currently. Please select another file.",EdButtons.OkOnly);
                    }                        
                }
            },
            OpenShareForPBoxAllSel : function(pDocId, pFileId)
            {   
                var lDocId = -1;
                var lFileId = -1;
                if(pDocId == null || parseInt(pDocId)=="NaN" || pDocId <= 0)
                {
                    if(typeof Eduify.PBox != "undefined")
                    {
                        pDocId =  Eduify.PBox.GetSelectedDocument();
                    }
                }
              
                if(pDocId == null || pDocId <= 0 || parseInt(pDocId) == "NaN"){                                            
                    //Not a document                    
                    if(pFileId == null || parseInt(pFileId)=="NaN" || pFileId <= 0)
                    {
                        if(typeof Eduify.PBox != "undefined")
                        {
                            lFileId =  Eduify.PBox.GetSelectedFile();
                        }
                    }else{
                        lFileId = pFileId;
                    }                
                }else{
                    //Document
                    lDocId = pDocId;
                }
                
                if(lDocId == -1 && lFileId == -1)
                {
                    Eduify.Alert("error :: ","Please select a document to share.",EdButtons.OkOnly);
                    return;                                                  
                }
                
                if(lDocId > 0)
                {
                    Eduify.Utils.OpenSharePermissionDlg(lDocId,null,null,'true');
                }else{
                    //File error
                    var lIsEduifyFile = Eduify.UI.Common.AJAXMethods.IsEditorAllowedFile(parseInt(lFileId)).value;    
                    if(lIsEduifyFile)
                    {
                        Eduify.Alert("error :: ","This file cannot be shared. Please convert it to an Eduify document first.",EdButtons.OkOnly);
                    }else{
                        Eduify.Alert("error :: ","This file cannot be shared currently. Please select another file.",EdButtons.OkOnly);
                    }                               
                }
            },
            //New Sharing Screen Methods
           OpenShareDlg : function (pDocId,pContent,pClipId,pShareType,pSourceFT,pUseLnkShrTxt){
                var lDialog = $j("div[id$=wdwShare]")[0].control;
                var lDialogURL = "invite?";
                var lClipId = ""; 
                var lDocId = ""; 
                var lContent = "";                                 
                
                if(pDocId != null && parseInt(pDocId) != "NaN" && pDocId  > 0)
                {
                    lDocId = "did="+pDocId;
                }
                else
                {
                    lDocId="";
                }
                
                if(pClipId != null && parseInt(pClipId) != "NaN" && pClipId  > 0)
                {
                    lClipId = "cid="+pClipId;
                }
                else
                {
                    lClipId="";
                }
                
                lDialogURL+=lClipId;
                lDialogURL+="&"+lDocId;
                if(pSourceFT != null && parseInt(pSourceFT) != "NaN")
                {
                    lDialogURL+= "&SourceFT="+pSourceFT;
                }
                if (pContent != null && parseInt(pContent)!= "NaN")
                {
                
                    var myUltraWebTab = igtab_getTabById(pContent);
                      if(myUltraWebTab == null)
                      {
                       return;
                       }
                     var lSelectedTabIndex = myUltraWebTab.selected;
                    lDialogURL += "&content=" + lSelectedTabIndex;
                }
                if(pShareType != null && parseInt(pShareType)!="NaN")
                {
                    lDialogURL += "&psh="+pShareType;
                }        
                if(pUseLnkShrTxt != null){
                    lDialogURL += "&ulst="+pUseLnkShrTxt;
                }
                //set location in query string
                lDialogURL += "&"+"loc="+this.GetCurrentLocation();
               
                lDialog.get_contentPane().get_iframe().setAttribute("frameborder","0");
                lDialog.get_contentPane().set_contentUrl(lDialogURL);
                lDialog.setSize("750px","650px");  //Height,width
                lDialog.show();
            },
            OpenAddressbookDlg : function (pDocId,pClipId){             
                var lDialog = $j("div[id$=wdwShare]")[0].control;
                var lDialogURL = "accountsemail?inDlg=true";
                var lReturnJS = "parent.Eduify.Utils.OpenShareDlg("; 
                                                
                if(pClipId != null && parseInt(pClipId) != "NaN" && pClipId  > 0)
                {
                    lReturnJS = "parent.Eduify.Utils.OpenShareDlg(";                                                 
                    if(pDocId != null && parseInt(pDocId) != "NaN" && pDocId  > 0)
                    {
                        lReturnJS = lReturnJS + pDocId+",";
                    }
                    else
                    {
                        lReturnJS = lReturnJS +"null,";
                    }
                    
                    lReturnJS = lReturnJS +"null,";
                    
                    if(pClipId != null && parseInt(pClipId) != "NaN" && pClipId  > 0)
                    {
                        lReturnJS = lReturnJS + pClipId+",";
                    }
                    else
                    {
                        lReturnJS = lReturnJS +"null,";
                    }
                    lReturnJS = lReturnJS +"null,null);";
                }else{
                    lReturnJS = "parent.Eduify.Utils.OpenSharePermissionDlg(";                                                 
                    if(pDocId != null && parseInt(pDocId) != "NaN" && pDocId  > 0)
                    {
                        lReturnJS = lReturnJS + pDocId+",";
                    }
                    else
                    {
                        lReturnJS = lReturnJS +"null,";
                    }                    
                    lReturnJS = lReturnJS +"null,null,'false');";
                }
                lDialogURL+="&next="+lReturnJS;
                
                lDialog.get_contentPane().get_iframe().setAttribute("frameborder","0");
                lDialog.get_contentPane().set_contentUrl(lDialogURL);
                lDialog.setSize("850px","600px");  //Height,width
                lDialog.show();
            },
            GetCurrentLocation : function()
            {   
                //get current Location
                var lLocation = window.location.href;                
                lLocation = lLocation.substr(lLocation.lastIndexOf("/")+1);
                if(lLocation.indexOf("?")> 0)
                {
                    lLocation = lLocation.substr(0,lLocation.indexOf("?"));
                }
                return lLocation;
            },
            OpenHomeInviteDlg : function (pDocId,pClipId){                
                var lDialog = $j("div[id$=wdwShare]")[0].control;
                var lDialogURL = "invite?sel=true";                                                                                                              
                var lClipId = ""; 
                var lDocId = "";                 
                
                if(pDocId != null && parseInt(pDocId) != "NaN" && pDocId  > 0)
                {
                    lDocId = "did="+pDocId;
                }
                else
                {
                    lDocId="";
                }
                
                if(pClipId != null && parseInt(pClipId) != "NaN" && pClipId  > 0)
                {
                    lClipId = "cid="+pClipId;
                }
                else
                {
                    lClipId="";
                }
                
                lDialogURL+="&"+lClipId;
                lDialogURL+="&"+lDocId;
                                                             
                //set location in query string
                lDialogURL += "&"+"loc="+this.GetCurrentLocation();
                                
                lDialog.get_contentPane().get_iframe().setAttribute("frameborder","0");
                lDialog.get_contentPane().set_contentUrl(lDialogURL);
                lDialog.setSize("750px","650px");  //Height,width
                lDialog.show();
            },
            //New Sharing Screen Methods
            CloseShareDlg : function (reset){
            
                 var lDialog = $j("div[id$=wdwShare]")[0].control;
                 try{
                    lDialog.get_contentPane().set_contentUrl("");
                    
                    if(reset && parent.pBtnRefershSharing){
                        parent.document.getElementById(parent.pBtnRefershSharing).click();
                    }
                 }catch(e){}
                 lDialog.hide();
            },
            //hide edit essay dialog
            HideEditEssayDlg : function()
            {
                var lDialog = $j("div[id$=wdwEdEssayDlg]")[0].control;
                if(typeof(lDialog)!= 'undefined'){
                    lDialog.hide();
                }
            },
            CloseFirstLoginDlg : function (type, flag){
                 var lDialog = $j("div[id$=wdwShare]")[0].control;
                 try{
                    lDialog.get_contentPane().set_contentUrl("");
                    if(flag){
                        Eduify.UI.Common.AJAXMethods.DisableFirstLoginDlg(type);
                    }
                    
                 }catch(e){}
                 lDialog.hide();
            },
            HideShareDlg : function (reloadPg){
                try{
                    if(reloadPg){
                        parent.location=parent.location;
                    }
                    var lDialog = parent.$j("div[id$=wdwShare]")[0].control;
                        lDialog.get_contentPane().set_contentUrl("");
                        lDialog.hide();
                }catch(e){}
            },
            AuditBoxShare : function(pFBConnect)
            {            
                $j("input[id$=hfSelected]")[0].value = "0";
                $j("input[id$=hfSelectedType]")[0].value = "Invite";                
                if(pFBConnect)
                {
                    FB.Connect.requireSession(); 
                    return false;                    
                }
            },
            PaperBoxShare : function(pAlert)
            {   
                var lContent = Eduify.PBox.GetSelectedDocument();
                if(lContent != -1)
                {   //if eduify doc selected 
                    $j("input[id$=hfSelected]")[0].value = lContent;
                    $j("input[id$=hfSelectedType]")[0].value = "Document";
                    if(pAlert)
                    {                       
                        FB.Connect.requireSession(); 
                        return false;
                    }
                }else{
                    lContent = Eduify.PBox.GetSelectedFile();
                    if(lContent != -1)
                    {
                        $j("input[id$=hfSelected]")[0].value = lContent;
                        $j("input[id$=hfSelectedType]")[0].value = "File";
                         if(pAlert)
                        {                           
                            FB.Connect.requireSession(); 
                            return false;
                        }
                    }else{
                        //If folder selected
                        //Eduify.Alert("error :: ","Please select a document to share.",EdButtons.OkOnly);
                        $j("input[id$=hfSelected]")[0].value = "";
                    $j("input[id$=hfSelectedType]")[0].value = "";
                        return false;
                    }
                }
            },
            ResearchBoxShare : function(pAlert)
            {
                var lContent = Eduify.ClipList.GetSelectedClipId();    
                $j("input[id$=hfSelected]")[0].value = lContent;
                $j("input[id$=hfSelectedType]")[0].value = "Clipping";
                if(pAlert)
                {
                    if(lContent == null || parseInt(lContent) <= 0 || parseInt(lContent) == "NaN"){
                        Eduify.Alert("error :: ","Please select a clipping to share.",EdButtons.OkOnly);
                        return false;
                    }
                    FB.Connect.requireSession(); 
                    return false;
                }
            },
            //Opens the Beta Invite Uninvited Users Dialog
            OpenInviteDialog:function(pUrl)
            {
                lDialog = $j("div[id$=wdwShare]")[0].control;
                lDialog.get_contentPane().get_iframe().setAttribute("frameborder","0");
                lDialog.get_contentPane().set_contentUrl(pUrl);
                lDialog.setSize("850px","650px");
                lDialog.show();
            },
            OpenSearch:function(pObj)
            {
                var lsearchText ="";
                var lDialog = null;
                
                if(pObj != null){
                    lsearchText = escape($j(pObj).text());
                }else{
                    lsearchText = escape($j("input[id$=txtSearch]").val());
                }
                
                if(lsearchText.toLowerCase() != "search for help")
                {
                    lDialog = $j("div[id$=wdwShare]")[0].control;
                    lDialog.get_contentPane().get_iframe().setAttribute("frameborder","0");
                    if(lsearchText == ""){
                        lDialog.get_contentPane().set_contentUrl("search");
                    }else{
                        lDialog.get_contentPane().set_contentUrl("search?q="+lsearchText);
                    }
                    lDialog.setSize("800px","680px");
                    lDialog.show();
                }
            },
            OfferHelp:function(pUrl){
                var lDialog = null;
                lDialog = $j("div[id$=wdwShare]")[0].control;
                lDialog.get_contentPane().get_iframe().setAttribute("frameborder","0");
                lDialog.get_contentPane().set_contentUrl(pUrl);
                lDialog.setSize("750px","500px");  //width,Height
                lDialog.show();
                return false;
            },
            //Trade in points screen
           OpenTradeInDlg : function (){
                var lDialog = $j("div[id$=wdwShare]")[0].control;
                var lDialogURL = "tradein";

                lDialog.get_contentPane().get_iframe().setAttribute("frameborder","0");
                lDialog.get_contentPane().set_contentUrl(lDialogURL);
                lDialog.setSize("750px","620px");  //width, height
                lDialog.show();
            },
            //Open firstlogin dialog
           OpenFirstLogin : function (type){
                var lDialog = $j("div[id$=wdwShare]")[0].control;
                if(lDialog==null || typeof(lDialog)=='undefined'){
                    setTimeout("Eduify.Utils.OpenFirstLogin('"+type+"')",500);
                    return;
                }
                if( type=='Home' && $j.browser.safari )
                {
                    var lDialogURL = "firstloginSafari";
                }
                else 
                {
                    var lDialogURL = "firstlogin?type="+type;
                }

                lDialog.get_contentPane().get_iframe().setAttribute("frameborder","0");
                lDialog.get_contentPane().set_contentUrl(lDialogURL);
                 if( $j.browser.safari && type=='Home')
                 {
                    lDialog.setSize("740px","500px");  //width, height
                 }
                 else
                 {
                    lDialog.setSize("750px","620px");  //width, height
                 }
                lDialog.show();
                
                if(lDialog._safari){
                    var _sHt = lDialog.getBody().offsetHeight - 10;
                    lDialog.getBody().style.height = _sHt + 'px';
                    lDialog.getBody().parentNode.style.height = _sHt + 'px';
                }
            },
            OpenEditEssayDlg : function()
            {
                var lDialog = $j("div[id$=wdwEdEssayDlg]")[0].control;
                if(lDialog==null || typeof(lDialog)=='undefined'){
                    setTimeout("Eduify.Utils.OpenEditEssayDlg()",500);
                    return;
                }
                var lDialogURL = "Pages/Wunderkind/GoEditIt";

                lDialog.get_contentPane().get_iframe().setAttribute("frameborder","0");
                lDialog.get_contentPane().get_iframe().scrolling="no";
                lDialog.get_contentPane().set_contentUrl(lDialogURL);
                lDialog.setSize("750px","540px");  //width, height
                lDialog.show();                
            },
            OpenPayment : function(pIsSSLEnable)
            {   
                var lDialog = null;
                var lCurLoc = document.location.href.toLowerCase();                
                if(pIsSSLEnable)
                {
                    lCurLoc = lCurLoc.replace("http","https");
                }
                lCurLoc = lCurLoc.substr(0,lCurLoc.lastIndexOf("/")+1);
                lCurLoc = lCurLoc + "payment";
                            
                lDialog = $j("div[id$=wdwShare]")[0].control;
                lDialog.get_contentPane().get_iframe().setAttribute("frameborder","0");
                lDialog.get_contentPane().set_contentUrl(lCurLoc);
                lDialog.setSize("720px","610px");  //width,Height
                lDialog.show();                
            },
            OpenDlgWithUrl :function(pUrl,pWidth,pHeight)
            {   
                var lDialog = null;
                lDialog = $j("div[id$=wdwShare]")[0].control;
                lDialog.get_contentPane().get_iframe().setAttribute("frameborder","0");
                lDialog.get_contentPane().set_contentUrl(pUrl);
                lDialog.setSize(pWidth+"px",pHeight+"px");  //width,Height
                lDialog.show();                  
            },
            OpenDlgWithUrlOnConnectedState :function()
            {   
                var lDialog = null;
                var lContentId = $j("input[id$=hfSelected]")[0].value;
                var lContentType = $j("input[id$=hfSelectedType]")[0].value;                              
                
                var lIsRegisteredUser = Eduify.UI.Common.AJAXMethods.RegisterFBUser(FB.Facebook.apiClient.get_session().uid).value;     
                if(lIsRegisteredUser)
                {
                    //Refresh share widget
                    Eduify.Utils.RefreshWarp('warpShareWidget');
                    
                    if(lContentType == "Document")
                    {
                        //open share dialog for document share
                        //Eduify.Utils.OpenShareDlg(lContentId,null,null,null);
                        Eduify.Utils.OpenSharePermissionDlg(lContentId,null,null,'false');
                    }
                    else if(lContentType == "File")
                    {
                       //File error
                        var lIsEduifyFile = Eduify.UI.Common.AJAXMethods.IsEditorAllowedFile(parseInt(lFileId)).value;    
                        if(lIsEduifyFile)
                        {
                            Eduify.Alert("error :: ","This file cannot be shared. Please convert it to an Eduify document first.",EdButtons.OkOnly);
                        }else{
                            Eduify.Alert("error :: ","This file cannot be shared currently. Please select another file.",EdButtons.OkOnly);
                        }           
                    }
                    else if(lContentType == "Clipping")
                    {
                        //open share dialog for clip share
                        Eduify.Utils.OpenShareDlg(null,null,lContentId,null);
                    }
                    else if(lContentType == "Invite")
                    {
                        //open fb invite dialog
                        Eduify.Utils.OpenDlgWithUrl('fbmultifriendselector','830','750');
                    }
                }else{
                    Eduify.FBConnect.FB_Logout();                   
                    Eduify.Alert("error :: ","Provided facebook user is already utilized!",EdButtons.OkOnly);
                    return false;
                }
            },
            OpenFBPermDlgOnFBConnect :function()
            {                   
                var lIsRegisteredUser = Eduify.UI.Common.AJAXMethods.ConnectFBUser(FB.Facebook.apiClient.get_session().uid).value;     
                if(lIsRegisteredUser)
                {                    
                    //Refresh share widget
                    Eduify.Utils.RefreshWarp('warpSocialNetwork');                    
                }else{
                    Eduify.FBConnect.FB_Logout();                   
                    Eduify.Alert("error :: ","Provided facebook user is not the one attached with your eduify account!",EdButtons.OkOnly);
                    return false;
                }
            },
            OpenAndRegFBPermDlgOnFBConnect :function()
            {                   
                var lIsRegisteredUser = Eduify.UI.Common.AJAXMethods.RegisterFBUser(FB.Facebook.apiClient.get_session().uid).value;     
                if(lIsRegisteredUser)
                {                    
                    //Refresh share widget
                    Eduify.Utils.RefreshWarp('warpSocialNetwork');                    
                }else{
                    Eduify.FBConnect.FB_Logout();                   
                    Eduify.Alert("error :: ","Provided facebook user is already utilized!",EdButtons.OkOnly);
                    return false;
                }
            },
            OpenFBInviteDlgOnFBConnect :function()
            {                   
                var lIsRegisteredUser = Eduify.UI.Common.AJAXMethods.ConnectFBUser(FB.Facebook.apiClient.get_session().uid).value;     
                if(lIsRegisteredUser)
                {                    
                    //open fb invite dialog
                    Eduify.Utils.OpenDlgWithUrl('fbmultifriendselector','830','750');                    
                }else{
                    Eduify.FBConnect.FB_Logout();                   
                    Eduify.Alert("error :: ","Provided facebook user is not the one attached with your eduify account!",EdButtons.OkOnly);
                    return false;
                }
            },
            OpenFBInviteDlgOnEduifyConnect :function()
            {                   
                var lIsRegisteredUser = Eduify.UI.Common.AJAXMethods.RegisterFBUser(FB.Facebook.apiClient.get_session().uid).value;      
                if(lIsRegisteredUser)
                {                    
                    //open fb invite dialog
                    Eduify.Utils.OpenDlgWithUrl('fbmultifriendselector','830','750');                    
                }else{
                    Eduify.FBConnect.FB_Logout();                   
                    Eduify.Alert("error :: ","Provided facebook user is already utilized!",EdButtons.OkOnly);
                    return false;
                }
            },            
            FBLoginOrFBInvite : function()            
            {                               
                if(FB.Facebook.apiClient.get_session() && FB.Facebook.apiClient.get_session().uid != "")
                {   var lIsRegisteredUser = Eduify.UI.Common.AJAXMethods.ConnectFBUser(FB.Facebook.apiClient.get_session().uid).value;                                                                             
                    
                    if(lIsRegisteredUser)
                    {                    
                        //open fb invite dialog
                        Eduify.Utils.OpenDlgWithUrl('fbmultifriendselector','830','750');                    
                    }else{
                        FB.Connect.requireSession(); 
                        return false;
                    }
                }else{
                    FB.Connect.requireSession(); 
                    return false;   
                }                                
            },
            ConnectWithFB : function()
            {   
                var lIsRegisteredUser = Eduify.UI.Common.AJAXMethods.ConnectFBUser(FB.Facebook.apiClient.get_session().uid).value;     
                if(lIsRegisteredUser)
                {
                    //Refresh share widget
                    Eduify.Utils.RefreshWarp('warpShareWidget');                                        
                }else{
                    Eduify.FBConnect.FB_Logout();
                    Eduify.Alert("error :: ","Provided facebook user is not the one attached with your eduify account!",EdButtons.OkOnly);
                    return false;
                }
            },///wunderkind contest code starts here
            OpenSharingNotAllowedDlg : function (){                
                lDialog = null;
                lDialog = $j("div[id$=wdwShare]")[0].control;
                if(lDialog)
                {
                    lDialog.get_contentPane().get_iframe().setAttribute("frameborder","0");
                    lDialog.get_contentPane().set_contentUrl("SharingNotAllowed");
                    lDialog.setSize("750px","300px");  //width,Height
                    lDialog.show();                
                }
            },
            //Open the Create Clip Dialog, Reuse the Sharing Dialog
            CreateClip:function(pEditorCall){
                var lDialog = $j("div[id$=wdwShare]")[0].control;
                var lDialogURL = "CreateClip";
                if(pEditorCall){
                    lDialogURL += "?edtitorcall=true";
                    if(Editor && Editor.Dialogs){
                        Editor.Dialogs.HideDlg();
                    }
                }
                lDialog.get_contentPane().get_iframe().setAttribute("frameborder","0");
                lDialog.setSize("800px","650px");
                lDialog.get_contentPane().set_contentUrl(lDialogURL);
                lDialog.show();
            },
            //Registers a Cliend Side Hidden Field.
            RegHidden:function(pId,pValue){
                var lJHidden = $j("#"+pId);
                var lHidden = null;
                if(lJHidden.length == 0)
                {
                    lHidden = $j("<input type='hidden' id='"+pId+"' name='"+pId+"' value='"+pValue+"' />")[0];
                    document.forms[0].appendChild(lHidden);
                }
                else
                {
                    lJHidden.val(pValue);
                }
            },
            //Hides an IG Dialog dy irs SeverSide Id
            HideIGDialogById:function(pServerSideId){
                try{
                    var lDialog = $j("div[id$="+pServerSideId+"]")[0].control;
                    if(typeof(lDialog)!= 'undefined'){
                        lDialog.hide();
                    }
                }catch(e){}
            },
            //Show an IG Dialog by its SeverSide Id
            ShowIGDialogById:function(pServerSideId){
                try{
                    var lDialog = $j("div[id$="+pServerSideId+"]")[0].control;
                    if(typeof(lDialog)!= 'undefined'){
                        lDialog.show();
                    }
                }catch(e){}
            },
            //Displays the Get Satisfaction Widget
            ShowGetHelp:function(){
                try{
                    var lDialogElement = $j("div[id$=wdwShare]")[0];
                    var lDialog = lDialogElement.control;
                    if(typeof(lDialog)!= 'undefined')
                    {
                        $j(lDialogElement).css("height","auto");
                        lDialog.get_contentPane().get_iframe().setAttribute("frameborder","0");
                        lDialog.setSize("378px","350px");
                        lDialog.get_contentPane().set_contentUrl("pages/getsatisfaction/getsatisfaction.htm");
                        lDialog.show();
                    }
                }catch(e){}
            },
            //resizes the IG Dialog by its SeverSide Id
            ResizeDialog:function(pWdth,pHeight,pId){
                try{
                    var lDialog = $j("div[id$="+pId+"]")[0].control;
                    if(typeof(lDialog)!= 'undefined'){
                        lDialog.setSize(pWdth+"px",pHeight+"px");
                    }
                }catch(e){}
            },
            // Dialogue for PCheck Quota Upgrade
            OpenPCheckQuotaUpgradeDlg : function (){                
                lDialog = null;
                lDialog = $j("div[id$=wdwShare]")[0].control;
                lDialog.get_contentPane().get_iframe().setAttribute("frameborder","0");
                lDialog.get_contentPane().set_contentUrl("PCheckQuotaUpgrade");
                lDialog.setSize("730px","520px");  //width,Height
                lDialog.show();                
            },
            OpenStorageQuotaUpgradeDlg : function (){                          
                lDialog = null;
                lDialog = $j("div[id$=wdwShare]")[0].control;
                lCreateNewDocumentDialog =  $j("*[id$=wdwCreateNewDocument]")[0];                
                if(lCreateNewDocumentDialog)
                {
                    $j("*[id$=wdwCreateNewDocument]")[0].control.hide();
                }
                lDialog.get_contentPane().get_iframe().setAttribute("frameborder","0");
                lDialog.get_contentPane().set_contentUrl("StorageQuotaUpgrade");
                lDialog.setSize("730px","590px");  //width,Height
                lDialog.show();                
            },
            ClosePCheckQuotaUpgradeDlg : function (){                        
                 var lDialog = $j("div[id$=wdwShare]")[0].control;
                 try{
                    lDialog.get_contentPane().set_contentUrl("");
                 }catch(e){}
                 lDialog.hide();                 
            },
            RefreshPCheckQuotaUpgradeDlgParent : function (){                        
                var lPanelPaperBox = ig$($j("div[id$=warpAddFolder]")[0].id);
                if(lPanelPaperBox)
                {
                    lPanelPaperBox.refresh();
                }    
            },
            ProofreadApprove : function()
            {   
                $j("*[id$=lblHeader]").text("paper clean-up in process");
                $j("div[id$=pnlProofread]").removeClass("DB").addClass("DN");
                $j("div[id$=pnlSmartMove]").removeClass("DN").addClass("DB");
            },
             EditingApprove : function()
            {   
                $j("*[id$=lblHeader]").text("paper clean-up in process");
                $j("div[id$=pnlExpertEditing]").removeClass("DB").addClass("DN");
                $j("div[id$=pnlSmartMove]").removeClass("DN").addClass("DB");
            },
            PBoxProofread : function()
            {   
                var lDocId = Eduify.PBox.GetSelectedDocument();
                if(lDocId > -1)
                {
                    $j("input[id$=hfDocId]")[0].value = lDocId;
                    $j("input[id$=hfDocType]")[0].value = "0"; //Document
                }else{
                    lDocId = Eduify.PBox.GetSelectedFile();
                    $j("input[id$=hfDocId]")[0].value = lDocId;
                    $j("input[id$=hfDocType]")[0].value = "1"; //File
                }
            },
            ABoxSelDoc : function()
            {   
                var lDocId = Eduify.ABox.GetSelectedId();
                var lType = Eduify.ABox.GetSelectedType(); 
                if(lDocId > 0)
                {
                    $j("input[id$=hfDocId]")[0].value = lDocId;
                    if(lType == "File")
                    {                    
                        $j("input[id$=hfDocType]")[0].value = "1";
                    }
                    else if(lType == "Document")
                    {
                        $j("input[id$=hfDocType]")[0].value = "0";
                    }
                }else{
                    $j("input[id$=hfDocId]")[0].value = "";
                    $j("input[id$=hfDocType]")[0].value = "";
                }
            },
            GetLocalTimeOffSet : function()
            {   
                var now = new Date();
                var offset = now.getTimezoneOffset();
                $j("input[id$=hdTimeZoneOffset]")[0].value = offset;
            },
            //Initiates a Refresh call for the IG Warp Panel with the Provided serverSide Id
            RefreshWarp:function(pSSId){
                try{
                    var lPanel = ig$($j("div[id$="+pSSId+"]")[0].id);
                    if(!lPanel) return;
                        lPanel.refresh();
                }catch(e){}
            },
            SetButtonCss : function(pBgId, pBgCss, pLeftId, pLeftCss, pBtnId, pBtnCss,pRightId, pRightCss)
            {
                $j("div[id$="+pBgId+"]").removeClass().addClass(pBgCss);
                $j("div[id$="+pLeftId+"]").removeClass().addClass(pLeftCss);
                $j("input[id$="+pBtnId+"]").removeClass().addClass(pBtnCss);
                $j("div[id$="+pRightId+"]").removeClass().addClass(pRightCss);
            },
            btnHover:function(pObj,pLeftCss,pBtnCss,pRightCss)
            {
                $j("div:eq(0)",pObj).removeClass().addClass(pLeftCss);
                $j("input:nth-child(2)",pObj).removeClass().addClass(pBtnCss);
                $j("div:nth-child(3)",pObj).removeClass().addClass(pRightCss);
            },  
            Redirect : function(pUrl){
                window.location.replace(purl);
            },
            UpdateFBPoints : function(pNoOfInvites)
            {   
                //var lCurrent = parseInt($j("span[id$=lblUserFBPoints]").text());
                var lCurrentPoints = 0;
                if($j("span[id$=lblUserFBPoints]")[0])
                {
                    _fbInviteCount +=pNoOfInvites;
                    lCurrentPoints = _fbInviteCount * _pointsPerInvite;
                    $j("span[id$=lblUserFBPoints]").text(lCurrentPoints);
                }
            },
            SrchRefRequest :function(oPanel, oEvent, pId)
            {
                
                if (!this.isInProgress)
                {
                    this.isInProgress = true;
                    Eduify.Utils.GrayOutOn(-1,-1,-1,-1,oPanel.Id,50);
                }
                else
                {
                    oEvent.cancel = true;
                }

            },
            SelectServiceType : function(pSelectId, pUnSelectId)
            {                
                $j("div[id$="+pSelectId+"]").removeClass("CO28").addClass("CO111");
                $j("div[id$="+pSelectId+"1]").removeClass("sp_microsite_hr_grey1").addClass("sp_microsite_hr_blue1");
                $j("div[id$="+pSelectId+"2]").removeClass("sp_microsite_hr_grey2").addClass("sp_microsite_hr_blue2");
                $j("div[id$="+pSelectId+"3]").removeClass("sp_microsite_hr_grey3").addClass("sp_microsite_hr_blue3");
                $j("div[id$="+pSelectId+"4]").removeClass("sp_microsite_hr_grey4").addClass("sp_microsite_hr_blue4");
                $j("div[id$="+pSelectId+"5]").removeClass("sp_microsite_hr_grey5").addClass("sp_microsite_hr_blue5");                
                
                $j("div[id$="+pUnSelectId+"]").removeClass("CO111").addClass("CO28");
                $j("div[id$="+pUnSelectId+"1]").removeClass("sp_microsite_hr_blue1").addClass("sp_microsite_hr_grey1");
                $j("div[id$="+pUnSelectId+"2]").removeClass("sp_microsite_hr_blue2").addClass("sp_microsite_hr_grey2");
                $j("div[id$="+pUnSelectId+"3]").removeClass("sp_microsite_hr_blue3").addClass("sp_microsite_hr_grey3");
                $j("div[id$="+pUnSelectId+"4]").removeClass("sp_microsite_hr_blue4").addClass("sp_microsite_hr_grey4");
                $j("div[id$="+pUnSelectId+"5]").removeClass("sp_microsite_hr_blue5").addClass("sp_microsite_hr_grey5");                
            },
            SelectPaymentPlan : function(pSelectId, pUnSelectId1, pUnSelectId2)
            {
                $j("div[id$="+pSelectId+"]").removeClass("CO121").addClass("CO111");
                if(pSelectId == "plusDiv")
                {                   
                    $j("div[id$="+pSelectId+"1]").removeClass("sp_microsite_vr_grey6").addClass("sp_microsite_vr_blue1");
                    $j("div[id$="+pSelectId+"2]").removeClass("sp_microsite_vr_grey7").addClass("sp_microsite_vr_blue2");
                    $j("div[id$="+pSelectId+"3]").removeClass("sp_microsite_vr_grey8").addClass("sp_microsite_vr_blue3");
                    $j("div[id$="+pSelectId+"4]").removeClass("sp_microsite_vr_grey9").addClass("sp_microsite_vr_blue4");
                    $j("div[id$="+pSelectId+"5]").removeClass("sp_microsite_vr_grey10").addClass("sp_microsite_vr_blue5");
                }else{                                    
                    $j("div[id$="+pSelectId+"1]").removeClass("sp_microsite_vr_grey1").addClass("sp_microsite_vr_blue6");
                    $j("div[id$="+pSelectId+"2]").removeClass("sp_microsite_vr_grey2").addClass("sp_microsite_vr_blue7");
                    $j("div[id$="+pSelectId+"3]").removeClass("sp_microsite_vr_grey3").addClass("sp_microsite_vr_blue8");
                    $j("div[id$="+pSelectId+"4]").removeClass("sp_microsite_vr_grey4").addClass("sp_microsite_vr_blue9");
                    $j("div[id$="+pSelectId+"5]").removeClass("sp_microsite_vr_grey5").addClass("sp_microsite_vr_blue10");                
                }
                
                $j("div[id$="+pUnSelectId1+"]").removeClass("CO111").addClass("CO121");
                if(pUnSelectId1 == "plusDiv")
                {
                    $j("div[id$="+pUnSelectId1+"1]").removeClass("sp_microsite_vr_blue1").addClass("sp_microsite_vr_grey6");
                    $j("div[id$="+pUnSelectId1+"2]").removeClass("sp_microsite_vr_blue2").addClass("sp_microsite_vr_grey7");
                    $j("div[id$="+pUnSelectId1+"3]").removeClass("sp_microsite_vr_blue3").addClass("sp_microsite_vr_grey8");
                    $j("div[id$="+pUnSelectId1+"4]").removeClass("sp_microsite_vr_blue4").addClass("sp_microsite_vr_grey9");
                    $j("div[id$="+pUnSelectId1+"5]").removeClass("sp_microsite_vr_blue5").addClass("sp_microsite_vr_grey10");                
                }else{                      
                    $j("div[id$="+pUnSelectId1+"1]").removeClass("sp_microsite_vr_blue6").addClass("sp_microsite_vr_grey1");
                    $j("div[id$="+pUnSelectId1+"2]").removeClass("sp_microsite_vr_blue7").addClass("sp_microsite_vr_grey2");
                    $j("div[id$="+pUnSelectId1+"3]").removeClass("sp_microsite_vr_blue8").addClass("sp_microsite_vr_grey3");
                    $j("div[id$="+pUnSelectId1+"4]").removeClass("sp_microsite_vr_blue9").addClass("sp_microsite_vr_grey4");
                    $j("div[id$="+pUnSelectId1+"5]").removeClass("sp_microsite_vr_blue10").addClass("sp_microsite_vr_grey5");                
                }
                
                $j("div[id$="+pUnSelectId2+"]").removeClass("CO111").addClass("CO121");                
                if(pUnSelectId2 == "plusDiv")
                {
                    $j("div[id$="+pUnSelectId2+"1]").removeClass("sp_microsite_vr_blue1").addClass("sp_microsite_vr_grey6");
                    $j("div[id$="+pUnSelectId2+"2]").removeClass("sp_microsite_vr_blue2").addClass("sp_microsite_vr_grey7");
                    $j("div[id$="+pUnSelectId2+"3]").removeClass("sp_microsite_vr_blue3").addClass("sp_microsite_vr_grey8");
                    $j("div[id$="+pUnSelectId2+"4]").removeClass("sp_microsite_vr_blue4").addClass("sp_microsite_vr_grey9");
                    $j("div[id$="+pUnSelectId2+"5]").removeClass("sp_microsite_vr_blue5").addClass("sp_microsite_vr_grey10");                
                }else{                                                    
                    $j("div[id$="+pUnSelectId2+"1]").removeClass("sp_microsite_vr_blue6").addClass("sp_microsite_vr_grey1");
                    $j("div[id$="+pUnSelectId2+"2]").removeClass("sp_microsite_vr_blue7").addClass("sp_microsite_vr_grey2");
                    $j("div[id$="+pUnSelectId2+"3]").removeClass("sp_microsite_vr_blue8").addClass("sp_microsite_vr_grey3");
                    $j("div[id$="+pUnSelectId2+"4]").removeClass("sp_microsite_vr_blue9").addClass("sp_microsite_vr_grey4");
                    $j("div[id$="+pUnSelectId2+"5]").removeClass("sp_microsite_vr_blue10").addClass("sp_microsite_vr_grey5");                
                }
            },
            StartServiceOptionGrayOut:function(sender,args)
            {
                var pnlContent = $j("*[id$=pnlContents]")[0];                
                Eduify.Utils.GrayOutOn(-1,-1,-1,-1,pnlContent,50);
            },
            StopServiceOptionGrayOut:function(sender,args)
            {    
                 Eduify.Utils.GrayOutOff(50);         
                 if($j("*[id$='hdnJSDump']")[0] && $j("*[id$='hdnJSDump']")[0].value !='')
                 {
                    try{
                        eval($j("*[id$='hdnJSDump']")[0].value)  
                        $j("*[id$='hdnJSDump']")[0].value ='';       
                    }
                    catch(e)
                    {
                        //alert(e.description)
                    }
                 }                 
            },            
            //Share Permission dialog with tabs open in paperbox
            OpenSharePermissionDlg : function (pDocId,pSelTab,pDisTab,pIsSelAllCont){
                var lDialog = $j("div[id$=wdwShare]")[0].control;
                var lDialogURL = "SharePermission?";
                
                var lDocId = "";                
                var lSelTab = "";
                var lDisTab = "";
                var lIsSelAllCont = "";
                
                if(pDocId != null && parseInt(pDocId) != "NaN" && pDocId  > 0)
                {
                    lDocId = "did="+pDocId;
                }
                else
                {
                    lDocId="";
                }                                
                
                if(pSelTab != null && parseInt(pSelTab) != "NaN")
                {
                    lSelTab = "stab="+pSelTab;
                }else{
                    lSelTab = "";
                }
                
                if(pDisTab != null)
                {
                    lDisTab = "dtab="+pDisTab;
                }else{
                    lDisTab = "";
                }
                
                if(pIsSelAllCont != null)
                {
                    lIsSelAllCont = "sel="+pIsSelAllCont;
                }else{
                    lIsSelAllCont = "sel=false";
                }
                
                lDialogURL+=lDocId;                
                lDialogURL+="&"+lSelTab;
                lDialogURL+="&"+lDisTab;
                lDialogURL+="&"+lIsSelAllCont;
                               
                //set location in query string
                lDialogURL += "&"+"loc="+this.GetCurrentLocation();
               
                lDialog.get_contentPane().get_iframe().setAttribute("frameborder","0");
                lDialog.get_contentPane().set_contentUrl(lDialogURL);
                lDialog.setSize("755px","650px");  //Height,width
                lDialog.show();
            },
            SharePermissionRefRequest : function(oPanel, oEvent, pId)
            {   
                if (!this.isInProgress)
                {
                    this.isInProgress = true;
                    Eduify.Utils.GrayOutOn(-1,-1,-1,-1,$j("*[id$='wtSharePermission'")[0],50);
                }
                else
                {
                    oEvent.cancel = true;
                }
            },
            SharePermissionInitializeTab : function (oWebTab){
                //Left Slice Css Classes
                var lTabLCss = ["PB0 W8 H20 BI103 spTabBlueLeft BB1111",   //Default
                                "PB0 W8 H20 BI103 spTabWhiteLeft BB1102",  //Hover
                                "PB0 W8 H20 BI103 spTabWhiteLeft BB1102",  //Selected
                                "PB0 W8 H20 BI103 spTabBlueLeft BB1111"    //Disabled
                                ];
                //Right Slice Css Classes
                var lTabRCss = ["PB0 W8 H20 BI103 spTabBlueRight BB1111",  //Default
                                "PB0 W8 H20 BI103 spTabWhiteRight BB1102", //Hover
                                "PB0 W8 H20 BI103 spTabWhiteRight BB1102", //Selected
                                "PB0 W8 H20 BI103 spTabBlueRight BB1111"   //Disabled
                                ];
                var lTabMCss = [
                                "PB0 W150 H20 DB PT6 TC BI103 FAB1500 CO02 spTabBlueRepeat BB1111 WSNWI",
                                "PB0 W150 H20 DB PT6 TC BI103 FAB1500 CO119 spTabWhiteRepeat BB1102 WSNWI",
                                "PB0 W150 H20 DB PT6 TC BI103 FAB1500 CO119 spTabWhiteRepeat BB1111 WSNWI",
                                "PB0 W150 H20 DB PT6 TC BI103 FAB1500 CO02 spTabBlueRepeat BB1111 WSNWI"
                                ];
                //Resetting Defaults Css Classes
                for(var lIndex = 0;lIndex <4;lIndex++){
                    oWebTab._cssL[lIndex] = lTabLCss[lIndex];
                    oWebTab._cssR[lIndex] = lTabRCss[lIndex];
                }

                $j("#"+oWebTab.ID+"_tbl > tbody > tr:first > td:last").addClass("BB1111");
                $j("#"+oWebTab.ID+"_tbl > tbody > tr:first > td[id=sep]").addClass("H20 DIB BB1111");
                //Applying Css Classes for First User
                for(var index=0 ;index < oWebTab.Tabs.length; index++){
                    lTab = oWebTab.Tabs[index];
                    lTab.css = lTabMCss;
                    lTab.elemLeft.className = lTabLCss[0];
                    lTab.element.className = lTabMCss[0];
                    lTab.elemRight.className = lTabRCss[0];
                }
                // Applying Selected Css on Selected Tab
                lTab = lTab = oWebTab.Tabs[0];
                lTab = oWebTab.getSelectedTab();
                lTab.elemLeft.className = lTabLCss[2];
                lTab.element.className = lTabMCss[2];
                lTab.elemRight.className = lTabRCss[2];
                $j("#"+oWebTab.ID+"_cp")[0].className="CB DB";
                
            },
            SharePermissionCheckChange : function(chkbox)
            {   
                 var parentrow=chkbox.parentNode.parentNode;
                 parentrow.getElementsByTagName("input")[0].checked =true;
            },
            PBoxFirstUserTutorial : function(type)
            {   /* This function show the Paperbox first user tutorial*/                
                Eduify.Utils.GrayOutOn(-1,-1,-1,-1,null,50);
                $j('div[id$=pnlNavigate]').removeClass('DN').addClass('DB');
                //Eduify.UI.Common.AJAXMethods.DisableFirstLoginDlg(type);
                
                $j.ajax({
                    type: "POST",
                    url: _AjaxPath,
                    data: '{"type":'+ parseInt(type) +'}',
                    beforeSend: function(xhr) {
                        xhr.setRequestHeader("Ajax-Method", "DisableFirstLoginDlg");
                        xhr.setRequestHeader("Accept-Encoding", "gzip, deflate");
                    },
                    success: function(s) {                                            
                        if (eval(s)!=null)
                        {                                           
                        }
                    }
                }); 
            },
            ProvEdtrFirstLoginTutorial : function(type)
            {   /* This function show the Provider Editor first use tutorial*/
                Eduify.Utils.GrayOutOn(-1,-1,-1,-1,null,50);
                $j('div[id$=pnlEditBar]').removeClass('DN').addClass('DB');
                Eduify.UI.Common.AJAXMethods.DisableFirstLoginDlg(type);
            },
            ProvEdtrFirstLoginNext : function(pPrev, pNext)
            {   /* This function will show the next tutorial dialog */
                $j('div[id$='+pPrev+']').removeClass('DB').addClass('DN');
                if(pNext){
                    $j('div[id$='+pNext+']').removeClass('DN').addClass('DB');
                }
                else{
                    Eduify.Utils.GrayOutOff(50);
                }
            },
            SearchAndHideTutorialDlg : function(pText)
            {
                var lQTxt = $j('input[id$=inpSearchText]').val();
                if(parent.Editor && lQTxt != pText){
                    parent.Editor.Dialogs.HideQuoteTutorialDlg(0,false);
                    
                    parent.Editor.Dialogs.ShowAddQuoteDlg(lQTxt);
                }
            },
            CopyToClipboard : function(meintext,pSwfPath)
            {
                if(window.clipboardData)  
                {  
                    window.clipboardData.setData('text',meintext);  
                }  
                else  
                {                                        
                    var clipboarddiv = $j("div[id$=divclipboardswf]")[0];  
                    if(clipboarddiv==null)  
                    {  
                       clipboarddiv=document.createElement('div');  
                           clipboarddiv.setAttribute("name", "divclipboardswf");  
                       clipboarddiv.setAttribute("id", "divclipboardswf");  
                       document.body.appendChild(clipboarddiv);  
                    }  
                        clipboarddiv.innerHTML='<embed src="'+pSwfPath+'" FlashVars="clipboard='+  
                        encodeURIComponent(meintext)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';       
                }                                     
                return false;                
            },
            btnOverBO: function(Obj){
                $j("div:eq(0)",Obj).removeClass("hp_btn_blue1").addClass("hp_btn_orange1"); 
                $j("div:nth-child(2)",Obj).removeClass("BI316").addClass("BI318");
                $j("div:nth-child(3)",Obj).removeClass("hp_btn_blue2").addClass("hp_btn_orange2");    
                $j("div:nth-child(4)",Obj).removeClass("BI317").addClass("BI319");
                $j("div:nth-child(5)",Obj).removeClass("hp_btn_blue3").addClass("hp_btn_orange3");
            },
            btnOutBO: function(Obj){
                $j("div:eq(0)",Obj).removeClass("hp_btn_orange1").addClass("hp_btn_blue1"); 
                $j("div:nth-child(2)",Obj).removeClass("BI318").addClass("BI316");
                $j("div:nth-child(3)",Obj).removeClass("hp_btn_orange2").addClass("hp_btn_blue2");    
                $j("div:nth-child(4)",Obj).removeClass("BI319").addClass("BI317");
                $j("div:nth-child(5)",Obj).removeClass("hp_btn_orange3").addClass("hp_btn_blue3");
            },
            
            
            btnOverGB: function(Obj){
                $j("div:eq(0)",Obj).removeClass("hp_btn_gray1").addClass("hp_btn_blue1"); 
                $j("div:nth-child(2)",Obj).removeClass("hp_btn_gray2").addClass("BI316");
                $j("div:nth-child(3)",Obj).removeClass("hp_btn_gray3").addClass("hp_btn_blue2");    
                $j("div:nth-child(4)",Obj).removeClass("hp_btn_gray4").addClass("BI317");
                $j("div:nth-child(5)",Obj).removeClass("hp_btn_gray5").addClass("hp_btn_blue3");
            },
            btnOutGB: function(Obj){
                $j("div:eq(0)",Obj).removeClass("hp_btn_blue1").addClass("hp_btn_gray1"); 
                $j("div:nth-child(2)",Obj).removeClass("BI316").addClass("hp_btn_gray2");
                $j("div:nth-child(3)",Obj).removeClass("hp_btn_blue2").addClass("hp_btn_gray3");    
                $j("div:nth-child(4)",Obj).removeClass("BI317").addClass("hp_btn_gray4");
                $j("div:nth-child(5)",Obj).removeClass("hp_btn_blue3").addClass("hp_btn_gray5");
            },
            
            
            btnOverCO: function(Obj){
                $j("div:eq(0)",Obj).removeClass("hp_btn_cyan1").addClass("hp_btn_orange1"); 
                $j("div:nth-child(2)",Obj).removeClass("hp_btn_cyan2").addClass("BI318");
                $j("div:nth-child(3)",Obj).removeClass("hp_btn_cyan3").addClass("hp_btn_orange2");    
                $j("div:nth-child(4)",Obj).removeClass("hp_btn_cyan4").addClass("BI319");
                $j("div:nth-child(5)",Obj).removeClass("hp_btn_cyan5").addClass("hp_btn_orange3");
            },
            btnOutCO: function(Obj){
                $j("div:eq(0)",Obj).removeClass("hp_btn_orange1").addClass("hp_btn_cyan1"); 
                $j("div:nth-child(2)",Obj).removeClass("BI318").addClass("hp_btn_cyan2");
                $j("div:nth-child(3)",Obj).removeClass("hp_btn_orange2").addClass("hp_btn_cyan3");    
                $j("div:nth-child(4)",Obj).removeClass("BI319").addClass("hp_btn_cyan4");
                $j("div:nth-child(5)",Obj).removeClass("hp_btn_orange3").addClass("hp_btn_cyan5");
            },
            btnOverGrO: function(Obj){
                $j("div:eq(0)",Obj).removeClass("hp_btn_green1").addClass("hp_btn_orange1"); 
                $j("div:nth-child(2)",Obj).removeClass("hp_btn_green2").addClass("BI318");
                $j("div:nth-child(3)",Obj).removeClass("hp_btn_green3").addClass("hp_btn_orange2");    
                $j("div:nth-child(4)",Obj).removeClass("hp_btn_green4").addClass("BI319");
                $j("div:nth-child(5)",Obj).removeClass("hp_btn_green5").addClass("hp_btn_orange3");
            },
            btnOutGrO: function(Obj){
                $j("div:eq(0)",Obj).removeClass("hp_btn_orange1").addClass("hp_btn_green1"); 
                $j("div:nth-child(2)",Obj).removeClass("BI318").addClass("hp_btn_green2");
                $j("div:nth-child(3)",Obj).removeClass("hp_btn_orange2").addClass("hp_btn_green3");    
                $j("div:nth-child(4)",Obj).removeClass("BI319").addClass("hp_btn_green4");
                $j("div:nth-child(5)",Obj).removeClass("hp_btn_orange3").addClass("hp_btn_green5");
            },
            HideUsCitizenDlg : function(){
            $j("div[id$=wdwUSPerson]")[0].control.hide();
            },
            ViewCompanyBubble:function()
            {
                if(_BubbleWindow!=null)
                {
                    $j('div[id$='+_BubbleWindow+']').removeClass('DB').addClass('DN');
                }
                $j('div[id$=pnlCompany]').removeClass('DN').addClass('DB');
        
                _BubbleWindow="pnlCompany";
            },
            ViewAccountTypeBubble:function(pDivId)
            {
                if(_BubbleWindow!=null){
                $j('div[id$='+_BubbleWindow+']').removeClass('DB').addClass('DN');
                }
                $j('div[id$=pnlAccountType]').removeClass('DN').addClass('DB');
                var height=pDivId.offsetTop+30;
                $j('div[id$=pnlAccountType]').attr({style:'top:'+height+'px' });
                _BubbleWindow="pnlAccountType";
            },
            ViewBankRoutingBubble:function(pDivId)
            {
                if(_BubbleWindow!=null){
                $j('div[id$='+_BubbleWindow+']').removeClass('DB').addClass('DN');
                }
                $j('div[id$=pnlBankRoutingNumber]').removeClass('DN').addClass('DB');
                 var height=pDivId.offsetTop+30;
                $j('div[id$=pnlBankRoutingNumber]').attr({style:'top:'+height+'px' });
                _BubbleWindow='pnlBankRoutingNumber';
            },
            ViewBankAccountNumberBubble:function(pDivId)
            {
                if(_BubbleWindow!=null)
                {
                $j('div[id$='+_BubbleWindow+']').removeClass('DB').addClass('DN');
                }
                $j('div[id$=pnlBankAccountNumber]').removeClass('DN').addClass('DB');
                  var height=pDivId.offsetTop+30;
                $j('div[id$=pnlBankAccountNumber]').attr({style:'top:'+height+'px' });
                _BubbleWindow='pnlBankAccountNumber';
            },
            ViewTaxEntityBubble:function(pDivId)
            {
                if(_BubbleWindow!=null)
                {
                    $j('div[id$='+_BubbleWindow+']').removeClass('DB').addClass('DN');
                }
                $j('div[id$=pnlTaxEntity]').removeClass('DN').addClass('DB');
                 var height=pDivId.offsetTop+30;
                $j('div[id$=pnlTaxEntity]').attr({style:'top:'+height+'px' });
                _BubbleWindow='pnlTaxEntity';
            },
            ViewSSNBubble:function(pDivId)
            {
                if(_BubbleWindow!=null){
                    $j('div[id$='+_BubbleWindow+']').removeClass('DB').addClass('DN');
                }
                $j('div[id$=pnlSSN]').removeClass('DN').addClass('DB');
                var height=pDivId.offsetTop+30;
                $j('div[id$=pnlSSN]').attr({style:'top:'+height+'px' });
                _BubbleWindow='pnlSSN';
            },
            DisableStatusDD:function(pEvent,pDDl)
            {
            
                var lSelectedIndex;
                lSelectedIndex = pDDl.selectedIndex;
                if(lSelectedIndex ==1)
                {
                    pDDl.disabled=true;
       
                    Eduify.Alert("Confirm:: ","Are you sure you've completed this project?",EdButtons.YesNo, 
                    function(){setTimeout("__doPostBack('"+pDDl.name+"','')", 0);},function(){pDDl.disabled=false;pDDl.selectedIndex=0;return false;}); 
                    
                    pEvent.returnValue = false;
                    pEvent.cancelBubble = true;
                    if ($j.browser.mozilla){
                            pEvent.preventDefault(); 
                    }
                    return false;
                }
                else
                {
                
                   setTimeout("__doPostBack('"+pDDl.name+"','')", 0);            
                    pEvent.returnValue = true;
                    pEvent.cancelBubble = false;
                    return true;
                }
            }
            
        };
    }();
}
if(_IsRegisterAjaxPro){
    Object.extend(Array.prototype, {push: [].push}, false);
}
if(typeof Sys != "undefined" && Sys.Browser.agent == Sys.Browser.InternetExplorer) {
    Sys.UI.DomElement.getLocation = function(element) {
        if (element.self || element.nodeType === 9) return new Sys.UI.Point(0,0);
        var clientRect = element.getBoundingClientRect();
        if (!clientRect) {
            return new Sys.UI.Point(0,0);
        }

        try {
            var ownerDocument = element.document.documentElement;
            var offsetX = clientRect.left - 2 + ownerDocument.scrollLeft,
                offsetY = clientRect.top - 2 + ownerDocument.scrollTop;
        
            var f = element.ownerDocument.parentWindow.frameElement || null;
            if (f) {
                var offset = 2 - (f.frameBorder || 1) * 2;
                offsetX += offset;
                offsetY += offset;
            }
         
            return new Sys.UI.Point(offsetX, offsetY);
        }
        catch(ex) {
        }    
    }
}


//Client Side Alert for Eduify Application
var EdButtons = {
    OkOnly : 0,
    OkCancel : 1,
    YesNo : 2,
    YesNoCancel : 3
};


Eduify.Alert = function(pTitle,pMsg,pButtons,pOkYesCallBack,pCancelNoCallBack){
    
    var lDialogDiv = $j("#alert")[0];
    var lButtonsArray = new Array();
    var lMainButtonsContainer = null;
    if ( typeof lDialogDiv == "undefined")
    {
        lDialogDiv = $j("<div id=\"alert\"></div>")[0];
        document.body.appendChild(lDialogDiv);
    }
    
    lDialogDiv.className = "POA ZI2000 DN HA0 W400 BC2";
    lDialogDiv.Header = CreateHeader();
    lDialogDiv.BodyCont = CreateBody(pTitle,pMsg,pButtons);
    lDialogDiv.BodyCont.appendChild($j("<div class=\"CB\"></div>")[0]);
    lDialogDiv.Footer = CreateFooter();
    lDialogDiv.appendChild(lDialogDiv.Header);
    lDialogDiv.appendChild(lDialogDiv.BodyCont);
    lDialogDiv.appendChild(lDialogDiv.Footer);
    AttachEvents(pOkYesCallBack,pCancelNoCallBack);
    MakeModal();
    $j(lDialogDiv).removeClass("DN");
    AlignButtons();
    
    function CreateHeader(pCrossClickCallBack){
        var lHeader = $j("<div class=\"AL H35 BI69 spCRT WP100\"></div>")[0];
        var lLeftC = $j("<div class=\"AL W40 H40 BI69 spCCTL CUP\"></div>")[0];
        var lRightC= $j("<div class=\"AR W40 H40 BI69 spCCTR\"></div>")[0]
        lHeader.appendChild(lLeftC);
        lHeader.appendChild(lRightC);
        lHeader.LeftCorner = lLeftC;
        $j(lLeftC).click(function(){Eduify.HideAlert();});
        lHeader.RightCorner = lRightC;
        return lHeader;
    }
    
    function CreateBody(pTitle,pMsg,pButtons){
        var  lBodyLeftCont = $j("<div class=\"BI101 AL WP100 \"></div>")[0];
        lBodyRightCont = $j("<div class=\"BI78 WP100 AL\"></div>")[0];
        lBodyLeftCont.appendChild(lBodyRightCont);
        lBodyRightCont.appendChild($j("<div class=\"DB FAB2400 CO119 VT ML20 MR10 PL20 BB3130\" style=\"margin-top:-5px;\">"+pTitle+"</div>")[0]);
        lBodyRightCont.appendChild($j("<div class=\"ML20 FAB1400 MT20 CO119 PL20 PR10\">"+ pMsg+"</div>")[0]);
        AddButtons(pButtons,lBodyRightCont);
        return lBodyLeftCont;
    }
    
    function CreateFooter(){
        return  $j("<div class=\"DB H22 AL BI69 WP100 spBoxRB2\"><div class=\"AL DB W40 H22 BI69 spCCBLR\"></div><div class=\"AL DB TC HP100\"></div><div class=\"AR DB W23 H22 BI69 spBoxBRC2\"></div>")[0];
    }
    
    function AddButtons(pButtons,pContainer){
        var lButtonsContainer = $j("<div class=\"ML20 MT20 WP95\"></div>")[0];
        switch(pButtons){
            case EdButtons.OkCancel : 
                lButtonsContainer.appendChild(CreateButton("Cancel","grey_left44","grey_mid44","grey_right44"));
                lButtonsContainer.appendChild(CreateButton("Okay","blue_left44","blue_mid44","blue_right44"));
                break;
            case EdButtons.YesNo : 
                lButtonsContainer.appendChild(CreateButton("No","grey_left44","grey_mid44","grey_right44"));
                lButtonsContainer.appendChild(CreateButton("Yes","blue_left44","blue_mid44","blue_right44"));
                break;
            case EdButtons.YesNoCancel : 
                lButtonsContainer.appendChild(CreateButton("No","grey_left44","grey_mid44","grey_right44"));
                lButtonsContainer.appendChild(CreateButton("Yes","blue_left44","blue_mid44","blue_right44"));
                lButtonsContainer.appendChild(CreateButton("Cancel","grey_left44","grey_mid44","grey_right44"));
                break;
            case EdButtons.OkOnly: default : 
                lButtonsContainer.appendChild(CreateButton("Okay","blue_left44","blue_mid44","blue_right44"));
                break;
        }
        lMainButtonsContainer = lButtonsContainer;
        lButtonsContainer.appendChild($j("<div class=\"CB\"></div>")[0]);
        pContainer.appendChild(lButtonsContainer);
    }
    
    function CreateButton(pText,pLeftCss,pCenterCss,pRightCss){
        var lContainer = $j("<div class=\"AL DINI MR5\"></div>")[0];
        var lButtonLeft = $j("<div class=\"BAN BSN "+pLeftCss+" \"></div>")[0];
        var lButton = $j("<input value=\""+pText+"\" type=\"button\" class=\"TC W50 BAN FAB1500 CO02 "+pCenterCss+"\" />")[0];
        var lButtonRight = $j("<div class=\"BAN BSN "+pRightCss+"\"></div>")[0];
        lContainer.appendChild(lButtonLeft);
        lContainer.appendChild(lButton);
        lContainer.appendChild(lButtonRight);
        lContainer.appendChild($j("<div class=\"CB\">&nbsp;</div>")[0]);
        lButtonsArray.push(lButton);
        return lContainer;
    }
    
    function AttachEvents(pOkYesCallBack,pCancelNoCallBack){
        for(var lIndex = 0;lIndex < lButtonsArray.length ; lIndex++){
            if(lIndex == 0)
            {
               $j(lButtonsArray[lIndex]).click(function()
                {
                    if(typeof pCancelNoCallBack == "function" )
                    {
                        pCancelNoCallBack.call(); 
                    }
                        Eduify.HideAlert();
                });
            }else
            {
                $j(lButtonsArray[lIndex]).click(function()
                {
                    if(typeof pOkYesCallBack == "function" )
                    {
                        pOkYesCallBack.call(); 
                    }
                        Eduify.HideAlert();
                });
                
            }
        }
        if(lButtonsArray.length == 1)
        {
            $j(lButtonsArray[0]).click(function()
            {
                if(typeof pOkYesCallBack == "function" )
                {
                    pOkYesCallBack.call(); 
                }
                Eduify.HideAlert();
            });
        }
    }
    
    function AlignButtons(pContainer){
        var lButtonsWidth  = 0;
        var lWidth = -1;

        if( lMainButtonsContainer != null)
        {
            lWidth = $j(lMainButtonsContainer).innerWidth(true);
            for(var lIndex = 0;lIndex < lButtonsArray.length ; lIndex++)
            {
                lButtonsWidth += parseInt($j(lButtonsArray[lIndex]).outerWidth(false));
            } 
            
            $j(lButtonsArray[0].parentNode.parentNode).css("margin-left",((lWidth - lButtonsWidth)/2)+"px"); 
        }
        $j(lDialogDiv).css("top", ($j(window).height() - $j(lDialogDiv).outerHeight(true) ) / 2 + $j(window).scrollTop() + "px");
        $j(lDialogDiv).css("left", ($j(window).width() - $j(lDialogDiv).outerWidth(true) ) / 2 + $j(window).scrollLeft() + "px");
      if( lMainButtonsContainer != null)
      {
        lButtonsArray[0].focus();
      }
    }
    function MakeModal(){
        var lHeight = $j(document.body).height() + $j(window).scrollTop();
        var lWidth = $j(document.body).width() + $j(window).scrollLeft();
        Eduify.Utils.GrayOutOn(0,0,lWidth,lHeight,document,"55");
    }
};

Eduify.HideAlert = function(){
   if($j("#alert").length > 0 )
   {
        document.body.removeChild($j("#alert").addClass("DN")[0]);
        Eduify.Utils.GrayOutOff("55");
   }   
}

;(function($) {

   var helper = {},
		// the current tooltipped element
		current,
		// the title of the current element, used for restoring
		title,
		// timeout id for delayed tooltips
		tID,
		// IE 5.5 or 6
		IE = $.browser.msie && /MSIE\s(5\.5|6\.)/.test(navigator.userAgent),
		// flag for mouse tracking
		track = false;	
  $.etooltip = {
		blocked: false,
		defaults: {
			delay: 200,
			fade: false,
			showURL: false,
			extraClass: "",
			top: 15,
			left: 15,
			id: "tooltip",
			pos:"",
			bodyId: "",
			track:false
		},
		block: function() {
			$.etooltip.blocked = !$.etooltip.blocked;
		}
	};
	
   $.fn.extend({
       tooltip: function(settings) {
			settings = $.extend({}, $.etooltip.defaults, settings);
			createHelper(settings);
			return this.each(function() {
					$.data(this, "tooltip", settings);
					this.tOpacity = helper.parent.css("opacity");
					// copy tooltip into its own expando and remove the title
					this.tooltipText = this.title;
					$(this).removeAttr("title");
					// also remove alt attribute to prevent default tooltip in IE
					this.alt = "";
				})
				.mouseenter(save)
				.mouseleave(hide);
		}
   });
   
   
   function save(pEvent) {

		// if this is the current source, or it has no title (occurs with click event), stop
		if ( $.etooltip.blocked || this == current || (!this.tooltipText && !settings(this).bodyHandler && !settings(this).bodyId) )
			return;

		// save current
		current = this;
		title = this.tooltipText;
        helper.parent.hide();		
        
		if ( settings(this).bodyHandler ) {
			var bodyContent = settings(this).bodyHandler.call(this);
			if (bodyContent.nodeType || bodyContent.jquery) {
				helper.parent.empty().append(bodyContent)
				helper.body = bodyContent;
			} else {
				helper.parent.html( bodyContent );
			}
			
		}else if( settings(this).bodyId != '' ){
		    var bodyContent = $("#"+settings(this).bodyId).removeClass("DN");
			if (bodyContent.nodeType || bodyContent.jquery) {
				helper.parent.empty().append(bodyContent)
				helper.body = bodyContent;
			} else {
				helper.parent.html( bodyContent );
			}
		}else{
		    if(title != ''){
		        helper.parent.text(title);
			}
		}
		helper.parent.show();
		// if selected, update the helper position when the mouse moves
		track = !!settings(this).track;
		if(track){
		    $(document.body).bind('mousemove', update)
		}
		
		update(pEvent);
	}
   function hide(){
       helper.parent.hide();
       if(current != null && settings(current).bodyId != ''){
            if(helper.body != 'undefined' && helper.body != null){
                helper.body.addClass("DN").appendTo(document.body);
            }else{
                $(":first-child",helper.parent).addClass("DN").appendTo(document.body);
            }
       }
	   current = null;
   }
   function settings(element) {
		return $.data(element, "tooltip");
	}
   function createHelper(settings) {
		// there can be only one tooltip helper
		if( helper.parent )
			return;
		// create the helper, h3 for title, div for url
		document.body.appendChild($('<div id="' + settings.id + '"></div>')[0]);
			// add to document
			//.appendTo(document.body)
			// hide it at first
			//.hide();
        helper.parent = $("#"+settings.id).hide();
		// apply bgiframe if available
		if ( $.fn.bgiframe )
			helper.parent.bgiframe();
		
		// save references to title and url elements
//		helper.title = $('h3', helper.parent);
//		helper.body = $('div.body', helper.parent);
//		helper.url = $('div.url', helper.parent);
	}
	function update(event){
	    if($.etooltip.blocked)
			return;
		
		if (event && event.target.tagName == "OPTION") {
			return;
		}

		// stop updating when tracking is disabled and the tooltip is visible
		if ( !track && helper.parent.is(":visible")) {
			$(document.body).unbind('mousemove', update)
		}
		
		// if no current element is available, remove this listener
		if( current == null ) {
			$(document.body).unbind('mousemove', update);
			return;	
		}
		
		// remove position helper classes
		helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");
		
	    var left = helper.parent[0].offsetLeft;
		var top = helper.parent[0].offsetTop;
		if (event) {
			currSet = settings(current);
			// position the helper 15 pixel to bottom right, starting from mouse position
			left = event.pageX + settings(current).left;
			top = event.pageY + settings(current).top;
			var right='auto';
			if (currSet.positionLeft) {
				right = $(window).width() - left;
				left = 'auto';
			}
			if(currSet.pos == "fix"){
				left = currSet.left; 
				top = currSet.top;
			}
			helper.parent.css({
				left: left+'px',
				right: right,
				top: top+'px'
			});
		}
		
		var v = viewport(),
			h = helper.parent[0];
		// check horizontal position
		if (v.x + v.cx < h.offsetLeft + h.offsetWidth) {
			left -= h.offsetWidth + 20 + settings(current).left;
			helper.parent.css({left: left + 'px'}).addClass("viewport-right");
		}
		// check vertical position
		if (v.y + v.cy < h.offsetTop + h.offsetHeight) {
			top -= h.offsetHeight + 20 + settings(current).top;
			helper.parent.css({top: top + 'px'}).addClass("viewport-bottom");
		}
	}
	function viewport() {
		return {
			x: $(window).scrollLeft(),
			y: $(window).scrollTop(),
			cx: $(window).width(),
			cy: $(window).height()
		};
	}
   
})(jQuery);
