// Name:     MetaTagsBody.js
// Purpose:  Read Title, security, author and last modification date, and put them in the correct location in the page.
// History
// Jaap wieringa - Create.



var tit = "Missing";
var bre = "Missing";
var des = "Missing";
var hel = "Missing";

// Last modification date
myDate = new Date(document.lastModified);
myMonth = myDate.getMonth()+1;
myDay = myDate.getDate();
myHour = myDate.getHours();
myMin = myDate.getMinutes();
if (myMonth < 10) myMonth = "0" + myMonth;
if (myDay < 10)   myDay = "0" + myDay;
if (myHour < 10)  myHour = "0" + myHour;
if (myMin < 10)   myMin = "0" + myMin;
var lmd = myDate.getFullYear() + "-" + myMonth + "-" + myDay + "&nbsp;" + myHour + ":" + myMin;

// Title
var tit = document.title;
var mti = document.title.replace (' ', '%20');
// Author
var mymetatags = document.getElementsByTagName("meta");
for (i=0;i < mymetatags.length;i++)
{
  if ( mymetatags[i].getAttribute("name") ) {
	  txt = mymetatags[i].getAttribute("name").toLowerCase();
	  txt2 = mymetatags[i].getAttribute("content");
	  if (txt.match(/description/)) {
	    var des = txt2;
	  }
          if (txt.match(/author/)) {
	    var aut = txt2;
	  }
	  if (txt.match(/email/)) {
	    var ema = txt2;
	  }
	  if (txt.match(/help/)) {
	    var hel = txt2;
	  }
	  if (txt.match(/mrp/)) {
  	  var mrp = txt2.split(/;/);
    	var mru = mrp[0];
	    var mrt = mrp[1];
  	  if (bre == "Missing") {
   			bre = '<a href="' + mru + '">&nbsp;' + mrt + '&nbsp;</a>';
	    } else {
  	  	bre = bre + ' &gt; <a href="' + mru + '">&nbsp;' + mrt + '&nbsp;</a>';
    	}
		}
  }
}
// Security
	var docURL 		= document.URL;
	var sec 	= " ";
	
	

	
//  Combine all collected info in standard header and write it to the page

	var Hdr = '<table class="pageheader" width="100%" cellpadding="2px" cellspacing="0px">';
	var Hdr = Hdr + '<tr class="breadcrumb"><td>' + bre +  '</td><td align="right">';
	var Hdr = Hdr + 'Last modified ' + lmd + '</td></tr>';
	var Hdr = Hdr + '<tr style="background-image:url(Prowebsite_files/Images/patroon_prowebsite.jpg);background-position:right;background-repeat:no-repeat;"><td colspan="2"><h1>' + tit + '</h1></td></tr>';
	var Hdr = Hdr + '<tr class="navigate"><td>&nbsp;<a href="organisation.htm"> Organisatie </a>&nbsp;<a href="producten.htm"> Produkten </a>&nbsp;</td><td align="right"><a href="contact.htm">&nbsp;Contact&nbsp;</a>&nbsp;<a href="disclaimer.htm">&nbsp;Disclaimer&nbsp;</a>&nbsp;<a href="links.htm">&nbsp;links&nbsp;</a>';
	if (hel != "Missing") {
	   var Hdr = Hdr + '<a target="_blank" href=' + hel + '> Help&nbsp;</a>';
	}
	var Hdr = Hdr + '</td></tr></table>';

	document.write(Hdr);

    

