var commonURL = "http://www.edsteps.org"

if("https:" == document.location.protocol)
{
    commonURL = commonURL.replace(new RegExp("http://"), "https://");
}

/* ---------------- JS Code Block for Google Analytics Starts HERE --------- */

function gaSSDSLoad (acct) {
  var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."),
      pageTracker,
      s;
  s = document.createElement('script');
  s.src = gaJsHost + 'google-analytics.com/ga.js';
  s.type = 'text/javascript';
  s.onloadDone = false;
  function init () {
    pageTracker = _gat._getTracker(acct);
    pageTracker._trackPageview();
  }
  s.onload = function () {
    s.onloadDone = true;
    init();
  };
  s.onreadystatechange = function() {
    if (('loaded' === s.readyState || 'complete' === s.readyState) && !s.onloadDone) {
      s.onloadDone = true;
      init();
    }
  };
  document.getElementsByTagName('head')[0].appendChild(s);
}

gaSSDSLoad("UA-15337409-1");

/* -----------------------------End Of Code ---------------------------------- */

function openPopupWindow(url, name, height, width, openParams)
{
    var iWidth = width;
    var iHeight = height + 25;
    var iLeft = (screen.width - iWidth) / 2;
    var iTop = (screen.height - iHeight) / 2;
    var objWin;
    
   
    if(Trim(openParams)=='')
    {       
        objWin = window.open(url, name, 'resizable=1, status=0, toolbar=0, scrollbars=1, width=' + iWidth + ', height=' + iHeight + ', ' + 'left=' + iLeft + ', top=' + iTop);
    }
    else
    {
        objWin = window.open(url, name, 'resizable=1,directories=1,location=1,toolbar=1,menubar=1,width=' + iWidth + ', height=' + iHeight + ', ' +'left=' + iLeft + ', top=' + iTop);
    }
     
    if(objWin == null) 
    { 
        alert('Could not open new window.\n\nYou may be blocking pop-ups.'); 
        return false;
    }
    else
    {
        /*Just in case width and height are ignored 
        objWin.resizeTo(iWidth, iHeight);
        Just in case left and top are ignored
        objWin.moveTo(iLeft, iTop);*/
        objWin.focus();
        return false;
    }
}



/*Date 16-April-2009
Function is used to validate date in format 'mm/dd/yyyy'.
Just pass STRING in date formate and it will check the date. */
function validateDateWithFormat(strDate) 
{
    var RegExPattern = /^(?=\d)(?:(?:(?:(?:(?:0?[13578]|1[02])(\/|-|\.)31)\1|(?:(?:0?[1,3-9]|1[0-2])(\/|-|\.)(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})|(?:0?2(\/|-|\.)29\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))|(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\.)(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|[2-9]\d)?\d{2}))($|\ (?=\d)))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}(\ [AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$/;
    if ((strDate.match(RegExPattern)) && (strDate !='')) 
    {
        /*Date is Valid, now check it for format (mm/dd/yyyy)*/
        var arrDate = strDate.split("/");
        return((arrDate.length==3)&&(arrDate[0].length<=2)&&(arrDate[1].length<=2)&&(arrDate[2].length==4));
    } 
    else 
    {
        /*Date is not in correct formate.*/
        return false;
    } 
}

/*Function used to trim string, Basically usefull while removeing space and then checking. */
function Trim(strValue)
{
    var ichar, icount;
    ichar = strValue.length - 1;
    icount = -1;
    while (strValue.charAt(ichar)==' ' && ichar > icount)
     --ichar;
    if (ichar!=(strValue.length-1))
     strValue = strValue.slice(0,ichar+1);
    ichar = 0;
    icount = strValue.length - 1;
    while (strValue.charAt(ichar)==' ' && ichar < icount)
     ++ichar;
    if (ichar!=0)
     strValue = strValue.slice(ichar,strValue.length);
    return strValue;
}