﻿function getQueryVariable(variable) 
    {
      var query = window.location.search.substring(1);
      var vars = query.split("&");
      
      for (var i=0;i<vars.length;i++) {
        var pair = vars[i].split("=");
        if (pair[0].toUpperCase() == variable.toUpperCase() ) {          
          return pair[1];
        }
      } 
      return "";
    }	
    
function OpenWindowComments(PageDate, SupplementId, ID, PageID, BodyID)
{
  
    var strViewURL = '/Pages/frmViewComment.aspx?PageDate=' + PageDate + '&PageID=' + PageID + '&BodyID=' + BodyID + '&ID=' + ID;    
	
	if((SupplementId != null) && (SupplementId != 'undefined') && (SupplementId != '') && (SupplementId != '0'))
    { 
		strViewURL += '&SupplementId=' + SupplementId;		
	}
	
	window.open(strViewURL,'ViewComments','scrollbars=yes,resizable=yes,fullscreen=YES,location=yes');        
}

function ShowProcess()
{
    
    if (Page_ClientValidate() == true)
    {
        document.body.style.cursor='wait';
        
        for(i=0;i<document.forms[0].elements.length;i++)
        {
            var elm = document.forms[0].elements[i];
            if(typeof(elm)!='undefined' && (elm.type=='submit' || elm.type=='button'))
            {
                
                elm.style.display="none";
            }
        }
    }
    else
    {
        document.body.style.cursor='auto';
    }
    return true;
}

function OpenSupplementDetail(PassedDate, SupplementID, BodyID)
{    
    var PVI = window.open('/Pages/SupplementDetail.aspx?dt=' + PassedDate + '&SupplementID=' + SupplementID + "&BodyID=" + BodyID, 'SupplementDetailPage','scrollbars=yes,resizable=yes,fullscreen=YES,location=yes' );
	if(PVI)
    {
        
    }     
	    
}

function OpenNewsSection(PassedDate, PaginaId, BodyID)
{
    window.open('/Pages/NewsDetail.aspx?dt=' + PassedDate + '&PaginaId=' + PaginaId + "&BodyID=" + BodyID, 'NewsDetailPage','scrollbars=yes,resizable=yes,fullscreen=YES,location=yes' );
}

function OpenExternalLinks(URL)
	{
	    window.open(URL,'ExternalSite','scrollbars=yes,resizable=no,fullscreen=yes,location=yes' );	            
	}
	
function OpenMailWindow(NewsID, PageNo, SupplementId, NewspaperDate, BodyID)
{
    window.open("/Pages/NewsEmail.aspx?NewsId=" + NewsID + "&pgID=" + PageNo + "&SupplementId=" + SupplementId + "&BodyId=" + BodyID + "&EditionDt=" + NewspaperDate, "Email", "scrollbars=no,resizable=no,status=1,width=625,height=430");
}

function OpenCJMailWindow(NewsID, PageNo, SupplementId, NewspaperDate, BodyID, NewsType)
{
    window.open("/Pages/NewsEmail.aspx?NewsId=" + NewsID + "&pgID=0&SupplementId=0&BodyId=" + BodyID + "&EditionDt=" + NewspaperDate + "&NewsType=" + NewsType, 
        "Email", "scrollbars=no,resizable=no,status=1,width=625,height=430");
}
