 //Disable select-text script (IE4+, NS6+)- By Andy Scott//Exclusive permission granted to Dynamic Drive to feature script//Visit http://www.dynamicdrive.com for this script function disableselect(e){return false} function reEnable(){return true} //if IE4+document.onselectstart=new Function ("return false") //if NS6if (window.sidebar){document.onmousedown=disableselectdocument.onclick=reEnable}// requires AjaxRequest.js, $()String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ""); };String.prototype.atMiddle = function( startSub, endSub ) {  var startPos = 0  var endPos = 0  var middle = "";  startPos = this.indexOf(startSub);    if ( startPos != -1 ) {    var rightOfStart = this.substring( startPos + startSub.length, this.length );    endPos = rightOfStart.indexOf(endSub);      if ( endPos == -1 ) {      middle = rightOfStart;         } else {      middle = rightOfStart.substring(0, endPos );    }  } else {    middle = "";  }  return middle;   }/* new array prototype for testing if an element is in an array */Array.prototype.inArray = function (value) {  var i;  for (i=0; i < this.length; i++) {    if (this[i] === value) {      return true;    }   }  return false;};function EmbeddedView(target, view, parameters, headers, colWidths, controls, popupParms, form,  title, createNew ) {      /* constants */  LOADING_HTML = "<img src=\"" + thisDb + "/msload.gif\" alt=\"loading\">";  popupParms = 'scrollbars=1,resizable=1,status=0,' + popupParms;   maxRecords = 9999;  if( target.style.height != "") {    SCROLL_AT = 600; // height at which to start scrolling  } else {    SCROLL_AT = 660; // height at which to start scrolling    }    // create random number (for forcing no cache)  function rndNo()  {    var d = new Date();     return '' + d.getMonth() + d.getDate() + d.getYear() + d.getHours() + d.getMinutes() +d.getSeconds() + '';  }  function construct() {    this.target = target;         // target div in which to create the table      this.view = view;             // full path to view    this.parameters = parameters; // url params to pass ?RVE    this.headers = headers;       // array of column headers    this.colWidths = colWidths;   // array of column widths    this.controls = controls;     // array of controls to display    this.count = 0;               // counters for data    this.interval = 0;    this.start = 0;    this.last = 0;    this.length = 0;    this.form = form;             // form used when creating new docs    this.createNew = createNew;   // bool - can we create new docs    this.rtc = null;              // restrictToCategory value    this.showAll = false;    // window.open parameters for edit,view and create    if ( popupParms ) this.popupParms = popupParms; else this.popupParms = "";        // make sure title is not null    if ( title ) this.title = title; else this.title = "";        this.construct = function() {     } // end construct        /* load the table into the target */    this.load = function(newParms) {      var o = this;      // allow user to override what's loaded using .load() method      if ( newParms ) p = parameters + newParms; else p = parameters;      if ( p.toLowerCase().indexOf("restricttocategory=") != -1 ) {        this.rtc = p.atMiddle( "&RestrictToCategory=","&");      }            if ( p.toLowerCase().indexOf("count=-1") != -1 ) {        this.showAll = true;      }            AjaxRequest.get(      {        'url':  view + '?ReadViewEntries&Preformat' +  p        ,'onSuccess':function(req){            var counts = o.getCounts(req.responseXML);           if ( counts[0] ) o.count = counts[0];           if ( counts[1] ) o.last = counts[1];           if ( counts[2] ) o.start = counts[2];           if ( o.interval == 0 ) o.interval = counts[0];                                 // get xml from the view and create a table out of it           var tableHTML = o.makeHTMLTableFromXML( req.responseXML );                      // place the html in the target element           target.innerHTML = tableHTML;             }            ,'onError':function(req){            alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);        }        ,'onLoading':function(){            target.innerHTML = LOADING_HTML;             }      }) // end AjaxRequest        }        // return an array containing count, last and start    this.getCounts = function( xml ) {      var root = xml.documentElement;      var rows = root.getElementsByTagName("viewentry")var sibs = root.childNodes;           var count = rows.length;                      if ( root.attributes[0] )        var last = parseInt(root.attributes[0].value, 10);      if ( rows[0] )            var start = parseInt(rows[0].attributes[0].value ,10);            return [count,last,start];          }        /* reload the embedded view */    this.reload = function() {      setTimeout( "window.embeddedViews['" + target.id + "'].load()", 300 );    }        /* navigate to the index that is i positions from the current index */    this.nav = function( i ) {      if (( this.start + i ) < 1 ) {        this.start = 1;        i = 0;      }      window.embeddedViews[target.id].load("&Start=" + (this.start + i) + "&Count=" + this.interval);    }    /* jump to index i */    this.startAt = function( i ) {      window.embeddedViews[target.id].load("&Start=" + i + "&Count=" + this.interval);    }        /* edit the record */    this.ed = function( id ) {      var url = thisDb + "/0/" + id + "?EditDocument";      window.open( url, 'ed', this.popupParms );    }    /* view the record (read) */    this.vw = function( id ) {      var url = thisDb + "/0/" + id + "?OpenDocument";      window.open( url, 'ad', this.popupParms );          }        /* target for "new" button - create a new doc using form */    this.create = function() {      if ( form )  {       var url = thisDb + "/" + form + "?Open";       window.open( url, 'cr', this.popupParms );            } else {       alert( "Please specify a form to use in the constructor." );      }    }        /* add a record to 'selected people' list  */    this.ad = function( id ) {      if ( confirm("Are you sure you want to add this record?") ) {        // call agent to erase this doc then execute the refersh functoin        AjaxRequest.get(        {          'url': thisDb + "/(upd)?Open&action=add&" + "&id=" + id + "&rnd=" + rndNo(),          'onSuccess':function(req){             if ( req.responseText.indexOf("Error") != -1 ) {               alert( req.responseText )             }                               reloadviews();           }         ,'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}         ,'onLoading':function(){  target.innerHTML = LOADING_HTML;}        }        );      }    }        /* remove a record from 'selected people' list */    this.rm = function( id ) {      if ( confirm("Are you sure you want to remove this record from the list?") ) {        // call agent to erase this doc then execute the refersh functoin        AjaxRequest.get(        {          'url': thisDb + "/(upd)?Open&action=rm&" + "&id=" + id + "&rnd=" + rndNo(),          'onSuccess':function(req){              if ( req.responseText.indexOf("Error") != -1 ) {               alert( req.responseText )             }                              reloadviews();           }         ,'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}         ,'onLoading':function(){  target.innerHTML = LOADING_HTML;}        }        );      }    }        /* draw the table */    this.makeHTMLTableFromXML = function( xml ) {              var root = xml.documentElement;      var rows = root.getElementsByTagName("viewentry");      var columnCount = 1 + this.controls.length;            if ( rows.length > 0)        columnCount = rows[0].getElementsByTagName("entrydata").length + this.controls.length;      else         columnCount = 1 + this.controls.length;      // start table html      var htm = "<table width=\"490\" style=\"padding:0px;\"><tr><td colspan=\"" + (columnCount) +  "\"><iframe id=\"adFrameMen\" name=\"adFrameMen\" src=\"http://www.controlscaddy.com/A55A69/bccaddyblog.nsf/iFrameAdsenseMen?OpenPage\" width=\"470\" height=\"68\" scrolling=\"no\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\"/></iframe></td></tr>";                  if ( headers ) columnCount += headers.length;            // add nav controls in first row      htm += "<tr><td colspan=\"" + (columnCount) +  "\">";      htm += "<table style=\"padding:0px;width:98%;\"><tr>";            htm += "<td style=\"width:2%;\">";      if ( createNew ) {        htm += "<img src=\"" + thisDb + "/new.gif\" style=\"cursor:pointer;\" onclick=\"embeddedViews['" + target.id + "'].create()\" alt=\"create new\">";        columnCount++;      } else         htm += "&nbsp;";              htm += "</td><td style=\"width:98%;text-align:right;\">" ;            htm += "<div style=\"display:inline;font-weight:bold;margin-right:10px;\"><H3>" + this.title+"</H3>"            var sibs= root.getElementsByTagName("viewentry")[0].getAttribute("siblings")        if ( this.start + this.count == 0 )         htm +=  " (" + this.start + " to " + (this.start + this.count)+ " of " + sibs+" games)</div>";      else         htm +=  " (" + this.start + " to " + (this.start + this.count - 1)+ " of " + sibs+" games)</div>";            if ( ! this.showAll ) {        if ( this.start != 1 && this.start != 0 ) {           htm += "<img src=\"" + thisDb + "/first.gif\" onclick=\"embeddedViews['" + target.id + "'].reload()\" style=\"cursor:pointer;\" alt=\"next\">";          htm += "<img src=\"" + thisDb + "/previous.gif\" onclick=\"embeddedViews['" + target.id + "'].nav(-" + this.interval + ")\" style=\"cursor:pointer;\" alt=\"next\">";        } else {          htm += "<img src=\"" + thisDb + "/first_off.gif\" alt=\"next\">";          htm += "<img src=\"" + thisDb + "/previous_off.gif\"  alt=\"next\">";         }          if (( (this.start + this.count - 1) < sibs )  && this.start != 0 ){          htm += "<img src=\"" + thisDb + "/next.gif\" onclick=\"embeddedViews['" + target.id + "'].nav(" + this.interval + ")\" style=\"cursor:pointer;\" alt=\"next\">";          htm += "<img src=\"" + thisDb + "/last.gif\" onclick=\"embeddedViews['" + target.id + "'].startAt(" + (sibs-this.interval+1) + ")\" style=\"cursor:pointer;\" alt=\"last\">";                              } else {          htm += "<img src=\"" + thisDb + "/next_off.gif\" alt=\"\">";          htm += "<img src=\"" + thisDb + "/last_off.gif\" alt=\"\">";                         }      }      htm += "</table></td></tr>";                  // add headers if necessary      htm += "<tr>"      if ( headers) {                 // headers        for ( var h = 0; h < headers.length; h++ ) {          if ( colWidths )            htm += "<th width=\"" + colWidths[h] + "%\">" + headers[h] + "</th>";               else           htm += "<th>" + headers[h] + "</th>";                       }      }            htm += "</table>";       htm += "<div style=\"height:" + SCROLL_AT + "px;overflow:auto;\"><table>";                 // add data as rows in html table            var dateCat      dateCat=""      if ( rows.length > 0 ) {        var cols = rows[0].getElementsByTagName("entrydata");        for ( var i = 0; i < rows.length;  i++ ) {                         var rowDocId = rows[i].attributes[1].value;                       // new row               htm += "<tr>";                      // cells containing action icons                             // cells containing data          for ( var j = 0; j < cols.length; j++ ) {          //alert (getInnerText(rows[i].getElementsByTagName("entrydata")[j]));            //alert (String(j));           if (j==0) {          if (getInnerText(rows[i].getElementsByTagName("entrydata")[j]) != dateCat) {          dateCat=getInnerText(rows[i].getElementsByTagName("entrydata")[j])          htm += "<td style=\"padding:6px; background-color:#FEF1B5; border-right:1px solid #c0c0c0;border-left:1px solid #c0c0c0;\" colspan='4'><b>"+ getInnerText(rows[i].getElementsByTagName("entrydata")[j]) + "</b></td></tr><tr>"			}          }                      if ( colWidths ) {   			if (j==0) {              htm += "<td style=\"padding:4px; border-left:1px solid #c0c0c0; border-top:1px solid #c0c0c0;border-bottom:1px solid #c0c0c0;\" width=\"" + colWidths[j] + "%\">&nbsp;&nbsp;&nbsp;</td>";       			} else if (j==4) {  			var strValue=getInnerText(rows[i].getElementsByTagName("entrydata")[j])  			//alert ("string value lenght is " +String(strValue.length))  			//alert ("j is " +getInnerText(rows[i].getElementsByTagName("entrydata")[j]))  			  if (strValue.length >= 5) {  			  //alert ("processing " +getInnerText(rows[i].getElementsByTagName("entrydata")[j]))             htm += "</tr><tr><td colspan=\"4\" style=\"padding:4px;border-top:0px solid #c0c0c0;border-bottom:1px solid #c0c0c0;border-right:1px solid #c0c0c0;\"><center>(Announcers: " + getInnerText(rows[i].getElementsByTagName("entrydata")[j]) + ")</center></td>";                                 } else {                 htm=htm               }             }else if (j==3) {              htm += "<td style=\"padding:4px;border-top:1px solid #c0c0c0;border-bottom:1px solid #c0c0c0;border-right:1px solid #c0c0c0;\" width=\"" + colWidths[j] + "%\">" + getInnerText(rows[i].getElementsByTagName("entrydata")[j]) + "</td>";     			             } else {             htm += "<td style=\"padding:4px;border-top:1px solid #c0c0c0;border-bottom:1px solid #c0c0c0;\" width=\"" + colWidths[j] + "%\">" + getInnerText(rows[i].getElementsByTagName("entrydata")[j]) + "</td>";     			}                   } else {                         htm += "<td style=\"padding:4px; border-right:1px solid #c0c0c0; \">" + getInnerText(rows[i].getElementsByTagName("entrydata")[j]) + "</td>";                                 }          }                     htm += "</tr>";          if ((i % (maxRecords-1) == 0) && ( i > 0) ) i = rows.length;        }            } else {        // no rows = no data        htm += "<tr><td colspan=\"" + columnCount + "\">No records found"         if ( this.rtc ) htm += " for " + this.rtc;        htm += "</td></tr>";      }            htm += "</table></div>";      return htm;    }             }    return new construct();} 