try {
    document.domain = "cboe.com";
} catch(Error) {}


if ( top == self) { 
    var extraParms = SetParentProperties();
    window.location.replace('http://www.cboe.com/AboutCBOE/PR/prPage1-1.aspx?url=' + escape(window.location.href) + extraParms);
}
else {
  VerifyNavigation();
}


function SetParentProperties() {
    var retVal = '';
    if (typeof(frmHeight)!='undefined' && frmHeight != '') {
        retVal = escape('&frmHeight=' + frmHeight);
    }
    if (typeof(frmTitle)!='undefined' && frmTitle != '') {
        retVal = retVal + escape('&frmTitle=' + frmTitle);
    }
    else {
        retVal = retVal + escape('&frmTitle=www.cboe.com');
    }
    return retVal;
}

//this function was added as a trap for IE.  if you navigate down to 2nd level
// (say) Mr. Brodsky's bio, then hit the back arrow IE appears to be focussed on the iframe
// and the user is returned to the mainpage not 1st level


//JBP a try catch was added because IE is now getting domain problems w/ the BlueCoat proxy software

function VerifyNavigation() {
    try {
      //get Parent URL Argument from QueryString
      var pthParent = top.location.search.substring(1);
      var qStrParentURL = querySt("url", pthParent.toLowerCase());

      //TESTING ALERTS
      //try {
      //alert ('IFramePath:' + pthIFrame +  ' --------IFramePage:' + pgIFrameIsOn + ' --------ParentURL:' + qStrParentURL + ' --------ParentPageForIframe:' + pgParentIsOn);
      //} catch(Error) {}
      //TESTING ALERTS

      //get Page iFrame is on
      var pthIFrame = location.href.toLowerCase();
      var pgIFrameIsOn = pthIFrame.substring(pthIFrame.lastIndexOf('/') + 1);
      var pgParentIsOn = '';
      if (typeof(qStrParentURL)!='undefined') {
          pgParentIsOn = qStrParentURL.substring(pthIFrame.lastIndexOf('/') + 1);
      }

      //if the iFrame page is not in the parent URL, it's 99% a backbutton key
      if ((typeof(qStrParentURL)!='undefined' && qStrParentURL.indexOf(pgIFrameIsOn) < 0) || 
	      (pgParentIsOn != ''  && pgParentIsOn != pgIFrameIsOn)) {
          parent.history.back()
      }
    } catch(Error2) {}

}


//called by VerifyNavigation
function querySt(qArg, szPath) {
    qStr = unescape(szPath);
    aArgs = qStr.split("&");
    for (i=0;i<aArgs.length;i++) {
        aTemp = aArgs[i].split("=");
        if (aTemp[0] == qArg) {
            return aTemp[1];
        }
    }
}

