﻿// JScript File

    // verifies only a number was typed into the form element
    function numbersonly(e){
        var unicode=e.charCode? e.charCode : e.keyCode
        // if (unicode!=8||unicode!=9)
        if (unicode<8||unicode>9)
            {
            //if the key isn't the backspace key or tab key (which we should allow)
            if (unicode<48||unicode>57) //if not a number
            return false //disable key press
        }
    }

    function GetURLParams(name)
    {
      name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
      var regexS = "[\\?&]"+name+"=([^&#]*)";
      var regex = new RegExp( regexS );
      var results = regex.exec( window.location.href);
      if(results == null) 
         return "";  
         else    
         return results[1];
    }
    
    
function GetDomainName()
{
    var url = window.location;
      var urlparts = url.href.split('//');
      var DomainName = urlparts[1].split('/');
      return DomainName[0];
}

 function loadjscssfile(filename, filetype)
 {
     if (filetype=="js"){ //if filename is a external JavaScript file
      var fileref=document.createElement('script')
      fileref.setAttribute("type","text/javascript")
      fileref.setAttribute("src", filename)
     }
     else if (filetype=="css"){ //if filename is an external CSS file
      var fileref=document.createElement("link")
      fileref.setAttribute("rel", "stylesheet")
      fileref.setAttribute("type", "text/css")
      fileref.setAttribute("href", filename)
     }
    
     if (typeof fileref!="undefined")
      document.getElementsByTagName("head")[0].appendChild(fileref)
 }
 

   
    
 function getCustomUrl()
{
  var url = window.location;
  var urlparts = url.href.split('//');
  var DomainName = urlparts[1].split('/');
  return DomainName[0];
}


function ReplaceAllWith(strFromText,strText,strWith)
{
var intIndexOfMatchNext = strFromText.indexOf(strText);
// Loop over the string value replacing out each matching
while (intIndexOfMatchNext != -1)
{
    // Relace out the current instance.
    strFromText = strFromText.replace(strText,strWith)
    // Get the index of any next matching substring.
   intIndexOfMatchNext = strFromText.indexOf(strText);
}
//End of repacing of <br />
return strFromText;
}


function GetImageUniqueId(GalFocusImg)
{
var strGId = GalFocusImg.split('.')[0];   	  
strGId =  ReplaceAllWith(strGId,"_","");
return strGId;
}




/*****************************************Vamshi*****************************************/


var strSetSession = AjaxUtilsMethods.CheckAndAssignPubValues(window.location).value;


 var arrPropConfig = AjaxUtilsMethods.GetPropConfigSettingsAll().value.split("$@$"); 
 arrPropConfig.unshift("DumpyFirstValue");//adding dumpy first value so that the value we pass will match with the property.config


//var  SITEURL =  getCustomUrl();
//AjaxUtilsMethods.setSession("strDomain",SITEURL);

//var x =AjaxUtilsMethods.getSession("strDomain").value;

var strPubDetails = AjaxUtilsMethods.GetPublicationDetails().value.split('_');


var strPublicationID=strPubDetails[0];
var Pub_RootPath  = strPubDetails[1];

// Pub_RootPath = Pub_RootPath.replace('/',''); added vamshi 04 Jan 09

var cssPath=arrPropConfig[81];// AjaxUtilsMethods.GetPropertyConfigSettingsNew('81',x).value;
//var Pub_RootPath = AjaxUtilsMethods.GetRootpath(getCustomUrl()).value;


if (!window.opener)
{
document.title=":: " + AjaxUtilsMethods.GetPublicationName().value+ " ePaper ::";
}

/*****************************************Vamshi*****************************************/

function openRSSFeed(strCat) {   

    open(VirtualPath + "/" + "RSSFeed.aspx?Category=" + strCat + "&EdId=" + strPublicationID); 
}

