// JavaScript Document

function handleHttpResponse1() {
  if (http.readyState == 4) {
    document.getElementById('waiter').src="http://www.protonotes.com/images/spacer.gif";
    // Split the comma delimited response into an array
    results = http.responseText.split(",");
	DL_oLayer.getElementsByTagName('input')[6].value=results[0];
  }
}

function handleHttpResponse2() {
  if (http.readyState == 4) {
	 document.getElementById('waiter').src="http://www.protonotes.com/images/spacer.gif";
    // Split the comma delimited response into an array
	//alert(http.responseText);
    results = http.responseText.split("`");
	arrayLength=results.length;
	numberOfNotes=(arrayLength-1)/8;
	//alert(numberOfNotes);
	noteCounter=0;
	for (var i = 0; i < numberOfNotes; i++) {
		//setTimeout('insertNote()',1000);
		insertNote("no");
		textContainer = newNote.getElementsByTagName('textarea')[0];
		dragBar=newNote.getElementsByTagName('div')[0];
		textContainer.value=results[noteCounter];
		iframeBuffer=newNote.getElementsByTagName('iframe')[0];
		newNote.style.left=results[noteCounter+1];
		//newNote.style.top=parseInt(results[noteCounter+2]) - window.frames['webFrame'].document.documentElement.scrollTop*1 + "px";
		newNote.style.top=parseInt(results[noteCounter+2]) + "px";
		newNote.getElementsByTagName('input')[6].value=results[noteCounter+7];
		newNote.style.width=results[noteCounter+3];
		dragBar.style.width=results[noteCounter+3];
		iframeBuffer.style.width=results[noteCounter+3];
		if(results[noteCounter+3] != ""){
			iframeBuffer.style.width=parseInt(results[noteCounter+3])-0+"px";
		} else {
			iframeBuffer.style.width="200px";
		}
		textContainer.style.height=results[noteCounter+4];
		if(results[noteCounter+4] != ""){
			fullNoteHeight=parseInt(results[noteCounter+4]) + 52 + "px";
		} else {
			fullNoteHeight="252px";
		}
		iframeBuffer.style.height=fullNoteHeight;
		newNote.getElementsByTagName('input')[0].value=results[noteCounter+1];
		newNote.getElementsByTagName('input')[1].value=results[noteCounter+2];
		if (results[noteCounter+5]==1) newNote.getElementsByTagName('input')[4].checked=true;
		if (results[noteCounter+6]==1) newNote.getElementsByTagName('input')[5].checked=true;
		noteCounter+=8;
		newNote.style.visibility="visible";
	}
	allDivs =document.getElementsByTagName('div');
	numOfDivs = allDivs.length;
	// get all notes DIVS
  }
}

function handleHttpResponse3() {
  if (http.readyState == 4) {
	//DL_oLayer.removeNode(true);
  }
}

function setNoteData() {
}


function deleteNote(deletedNoteId) {
	alert();
}

function gup(name)
{
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var tmpURL = window.location.href;
  var results = regex.exec( tmpURL );
  if( results == null )
    return "";
  else
    return results[1];
}

function getHTTPObject() {
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}
var http = getHTTPObject(); // We create the HTTP Object