﻿/** 
* ======================================================
* $Workfile:   SitePageProperties.js  $
* $Revision:   1.28  $
* $Date:   Aug 18 2010 09:32:20  $
* $Author:   ulaganlx  $
* $Archive:   //legal.regn.net/npv/Dev-Archives/Development_Area/archives/LargeLaw/PageDesigner/Phoenix/FrontEnd/Code/LexisNexis/Website/Assets/js/ContentEditor/SitePageProperties.js-arc  $
* ======================================================
* Change History:
* 1.00 initial revision
**/

var IsHidden = false;
var winPagePropertiesObj = null;
    
    function IschkChanged(chkID)
    {
        IsHidden = true;
    }
    
    function IsChanged() 
    {
        IsHidden = true;
    }
    
    function CancelEvent()
    {
        if(IsHidden==true)
        var pos = confirm("Changes not saved. Do you want to continue?");
        else
        window.close();
        if (pos)
        {
            window.close();        
        }
        else if(IsHidden==false && pos==true)
        {
        window.close();
        }
        else
        return false;
    }
    
    function SitePopup()
    {
      var  guidID=document.getElementById("hidGuidID").value;
   
      window.open("/Modules/CMS/SiteProperties.aspx?GuidID="+ guidID,"sitepropeties","width=705,height=575,location=no,scrollbars=no,left=300,Top=350"); 
      return false;
    }

   function PagePopup()
    {
      var  guidID=document.getElementById("hidGuidID").value;  
      winPagePropertiesObj = window.open("/Modules/CMS/PageProperties.aspx?GuidID="+ guidID,"pagepropeties","width=705,height=625,location=no,scrollbars=no,left=300,Top=350"); 
      return false;
    }
    
    function ElmoBarPagePopup()
    {
      var  guidID=document.getElementById("rightClickHidGuidID").value;  
      window.open("/Modules/CMS/PageProperties.aspx?GuidID="+ guidID,"pagepropeties","width=705,height=625,location=no,scrollbars=no,left=300,Top=350"); 
      return false;
    }
    
function SelectImage()
{
    var  guidID= window.opener.document.getElementById("hidGuidID").value;
    var url = "/Modules/CMS/ImageManager.aspx?placement=pageproperties&itemid="+ guidID;
    
    if(document.getElementById("hdnAttorneyImageID"))
    url = url + "&mediaid=" + document.getElementById("hdnAttorneyImageID").value;
    
     //Anand on 23th June 2010: Modified code to open media manager as modal window
     if(!window.opener.parent.closed)
        window.opener.parent.openModalWindow(url, "dialogPagePropertiesMediaManager", "690", "520"); // calls global method from \Assets\js\ContentEditor\modalOverlay.js
        self.blur();
}

    
//    function validator() 
//    {
//       
//        var re = new RegExp("<meta name=\"[A-Za-z0-9]+\" content=\"[A-Za-z0-9\\s]+\"");
//	    var metaTag=document.getElementById("txtPageCustomMetaTags");
//        
//	    if(metaTag.value!="")
//	    {
//	        if(!metaTag.value.match(re)|| metaTag.value.lastIndexOf(">")<0)
//	        {
//                alert("The CustomMetaTag field should be an HTML meta tag.EX: <meta name=\"mycustomtag\" content=\"my custom data\" >");
//                return false;
//            }
//        }
//      
//  }
 
function ParentRefresh()
{
   
    var parentURL=window.opener.location.href;
    if(!isNullorEmpty(parentURL))
    {
        parentURL=parentURL.replace("#","");
        try
        {
            window.opener.location.href = parentURL; 
        }
        catch(Error)
        {
        }
    }
    if (window.opener.progressWindow)
     {
        window.opener.progressWindow.close()
     }
    window.close();
}

function isNullorEmpty(parentURL)
{
    if(parentURL==null ||parentURL =="")return true;
    else return false ;
}


//Added by Praveen to set the GUID when IFrame refreshes
function SetGUID(guid)
{
   if(parent.document.getElementById("hidGuidID"))
   {
      parent.document.getElementById("hidGuidID").value=guid;
   }
}
