// ======================================== //
// Script routines for the sentient-website //
// ======================================== //

function changePage(destination) {
	var ValidTitle = "Sentient - powerful data mining for everyone"
	if (self.top.document.title != ValidTitle){
		alert ("This page will be loaded inside original framed version.");
		//alert ("This page will be loaded inside original framed version.\n[" + ConvertToAsciiCodes(self.top.document.title) + "](gevonden)\n[" + ConvertToAsciiCodes(ValidTitle) + "](bedoeld)x");
		self.top.location=destination;
	}
};

function ConvertToAsciiCodes(theString){
	var result = '';
	var NrChars = theString.length;
	var aChar;
	for (var i=1;i<=NrChars;i++){
		aChar = theString.charCodeAt(i-1);
		result = result + theString.substring(i-1,i) + '_' + aChar + '  ';
	};
	return result;

};

function ShowPiresSteps(thePage){
var HW
	HW = window.open(thePage, "PiresSteps", "directories=no,height=670,width=750,scrollbars=yes, resizable=yes, location=no,menubar=no,status=no,titlebar=no,toolbar=no");
	HW.focus();
	return;
};

function ShowFaceAnSteps(thePage){
var HW
	HW = window.open(thePage, "Steps", "directories=no,height=600,width=550,scrollbars=yes, resizable=yes, location=no,menubar=no,status=no,titlebar=no,toolbar=no");
	HW.focus();
	return;
};


// Tracker code
function Tracking(n) {
	var an=navigator.appName;
	var sr='http://x3.extreme-dm.com/';
	var srw="na";var srb="na";var d=document;r=41;
	var s=screen;srw=s.width;
	an!="Netscape"?srb=s.colorDepth:srb=s.pixelDepth;
	//(""+n)==""?n=d.title:n=n;
	//alert (d.location);
	//d.write("<div style='line-height: 1px;'><img src=\""+sr+"n\/?tag=sentient&p=http%3A%2F%2Fwww.smr.nl%2F" + "Sentient_" + d.title + "&j=y&srw="+srw+"&srb="+srb+"&l="+escape(parent.document.referrer)+"&rs="+r+"\" height=1 width=1></div>");
	d.write("<div style='line-height: 1px;'><img src=\""+sr+"n\/?tag=sentient&p=http%3A%2F%2Fwww.smr.nl%2F" + "Sentient_" + n + "&j=y&srw="+srw+"&srb="+srb+"&l="+escape(parent.document.referrer)+"&rs="+r+"\" height=1 width=1></div>");
};

function InsertEmailAddress(user, domain) {
	//alert('user: ' + ConvertToAsciiCodes(user) + '\ndomain: ' + ConvertToAsciiCodes(domain));
	document.write('<a href="mailto:' + user + '@' + domain + '">' + user + '@' + domain + '</a>');

};

function InsertEmailAddressExtra(user, domain, subject, body, title) {
	if (title == ''){
		document.write('<a href="mailto:' + user + '@' + domain + '?subject=' + subject + ' &body=' + body + '">' + user + '@' + domain + '</a>');
	} else {
		document.write('<a href="mailto:' + user + '@' + domain + '?subject=' + subject + ' &body=' + body + '">' + title + '</a>');
	};

};

