// JavaScript Document

function imagePopup(img,nothumb)
{
  if (!nothumb) {
    var separator = img.indexOf('-sm.');
    if (separator > -1) {
	  img = img.substr(0, separator) + img.substr(separator + 3, img.length);
    }
  }
  popupHTML = '<html><head><title>Appartement Kon-Tiki Jachtservice Den Helder</title></head><body style="padding:0px;margin:0px;height:100%;overflow:hidden;"><div style="width:100%;height:100%;overflow:hidden;"><img src="'+img+'" name="img" style="display:block;cursor:pointer;cursor:hand;" alt="" title="Klik om venster te sluiten" onload="var width=document.img.width;var height=document.img.height;if (window.innerWidth) {window.innerWidth=width;window.innerHeight=height;}else{window.resizeTo(width+10,height+30);}" onclick="window.close()"></div></body></html>';
  popupImage = window.open('','_blank','toolbar="no",scrollbars="no",location="no",resizeable="no",status="no"');
  popupImage.document.open();
  popupImage.document.write(popupHTML);
  popupImage.document.close();
}

//<![CDATA[
function rot13(input) {
	var coding = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMabcdefghijklmnopqrstuvwxyzabcdefghijklm';
	
	for (var text = '',i=0;i<input.length;i++) {
		character = input.charAt(i);
		position = coding.indexOf(character);
		if (position > -1) {
			character = coding.charAt(position + 13);
		}
		text += character;
	}
	
	return text;
}

function anti_spam(linkje) {
	if (linkje.href.indexOf('mailto:')!=0) {
		linkje.href=rot13(linkje.href);
	}
}
//]]>

function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
window.onload = externalLinks;
