var editbutton = "eip-editbutton.png";
var loginbutton = "eip-loginbutton.png";

function editinplace(page, div){
  window.open("../eip/editinplace.php?page="+page+"&tag="+div,"Window1","menubar=no,location=0,width=700,height=400,toolbar=no");
  }

function loggedIn()
	{
	return(document.cookie.indexOf("user") > -1);
	}
    

if(loggedIn()){ // IF LOGGED IN
  // var path = window.location.pathname;
  // alert(document.location.href);
  // alert(document.location.pathname);
  var path = document.location;
  // alert("Path: " + path);
  // alert("Page: " + page);
  // var page = path.substring(path.lastIndexOf('/') + 1);
  var doc = document.getElementsByTagName("div");
  for (var i = 0; i < doc.length; i++){ // FOR ALL DIVS
    if(doc[i].id.substr(0, 4)=="EIP-"){
      doc[i].innerHTML = "<img src=" + editbutton + " onclick=\"editinplace('" + page + "', '" + doc[i].id + "');\">" + doc[i].innerHTML;
    }
  } // FOR ALL DIVS
} // IF LOGGED IN


