// ---- Functions for KML Bookmarking ----
// This file depends on thickbox-compressed.js which must be included in the HTML before this file.

// Do not diplay loading animation when loading boomark confirmation window
var tb_pathToImage = "http://commons.carnegiefoundation.org/images/nothing.gif";

function linkToIdeabank()
{
    document.location.href="http://commons.carnegiefoundation.org/ideabank/";
}

function bookmark_separate_page(ex_author, ex_title, ex_url)
{
  var bmTitle = encodeURIComponent(ex_title);
  bmTitle = bmTitle.replace(/'/,"&#39;");
  var bmUrl = encodeURIComponent(ex_url);
  var bmProcessor = "http://commons.carnegiefoundation.org/ideabank/bookmark_tracker.php"
  var bmReq = bmProcessor+ "?title=" +bmTitle+ "&url=" +bmUrl+ "&keepThis=true&TB_iframe=true&height=100&width=350";
  tb_show("", bmReq,"");
  autoClose();    
}

// Opens bookmark confirmation / result PHP page.  Update the variable bmProcessor with URL of the target PHP file 
function bookmark() {
  var bmTitle = encodeURIComponent(document.title);
  bmTitle = bmTitle.replace(/'/,"&#39;");
  var bmUrl = encodeURIComponent(location.href);
  var bmProcessor = "http://commons.carnegiefoundation.org/ideabank/bookmark_tracker.php"
  var bmReq = bmProcessor+ "?title=" +bmTitle+ "&url=" +bmUrl+ "&keepThis=true&TB_iframe=true&height=100&width=350";
  tb_show("", bmReq,"");
  autoClose();
}

function bookmark_test() {
	
  for (i = 0; i < document.form.status.length; i++ ) {
	  if( document.form.status[i].checked == true )
	  testStatus = document.form.status[i].value;
  }
    
  var bmTitle = encodeURIComponent(document.title);
  var bmUrl = encodeURIComponent(location.href);
  var bmProcessor = "http://commons.carnegiefoundation.org/ideabank/bookmark_tracker.php"
  var bmReq = bmProcessor+ "?title=" +bmTitle+ "&url=" +bmUrl+ "&test=" +testStatus+ "&keepThis=true&TB_iframe=true&height=110&width=350";
  tb_show("", bmReq,"");
  autoClose();
}

var timer1;

// Closes the bookmark confirmation / result page after a set delay.  Change the setTimeout parameter with number of miliseconds
function autoClose(){
	clearTimeout(timer1);
	timer1=setTimeout("tb_remove()",4000);
	return true;
}

