// to despam

// <![CDATA[
var textNodeType;

function erase_subject(n){
var where = n.indexOf('?',0);
var new_n;
if (where == -1) {
new_n = n;
}
else { 
new_n = n.substring(0,where);
};
return new_n;
}


function textContent(n) {
    if ( n.nodeType == textNodeType ) {
	return n.data;
    } else {
	var children = n.childNodes;
	var t = "";
	for ( var i=0 ; i<children.length ; i++ ) {
	    t = t.concat(textContent(children.item(i)));
	}
	return t;
    }
}
function despam() {
    // MSIE seems to barf...  Deactivate for now
    if ( (/MSIE/).test(navigator.userAgent) )
	return;
    // Now replace as appropriate.
    var elts = document.getElementsByTagName("span");
    for ( var i=0 ; i<elts.length ; i++ ) {
	var elt = elts.item(i);
	if ( elt.className == "replace-commercial-at" ) {
	    elt.parentNode.replaceChild(document.createTextNode("@"),elt);
	    i--;  // Semi-bugware
	} else if ( elt.className == "replace-full-stop" ) {
	    elt.parentNode.replaceChild(document.createTextNode("."),elt);
	    i--;  // Semi-bugware
	} else if ( elt.className == "replace-subject" ) {
	    elt.parentNode.replaceChild(document.createTextNode(("?subject=".concat(textContent(elt))).replace('.html','')),elt);
//	    elt.parentNode.replaceChild(document.createTextNode(("<span class=\"subject\">?subject=".concat(textContent(elt)))).concat("</span>"),elt);
	    i--;  // Semi-bugware
	}
    }
    // Merge adjacent text nodes.
    try {
	document.normalize();  // Your DOM is BROKEN!
    } catch (exn) {
	document.documentElement.normalize();
    }
    // Next, process all <a> elements having class="despammed-address".
    elts = document.getElementsByTagName("a");
    for ( var i=0 ; i<elts.length ; i++ ) {
	var elt = elts.item(i);
	if ( elt.className == "despammed-address" ) {
	    var addr = "mailto:".concat(textContent(elt));
	    elt.setAttribute("href", addr);  // (abstract)
	    elt.href = addr;  // (semantic)
	    elt.innerHTML = erase_subject(elt.innerHTML); // do not display subject
	}
    }
}
function onLoad() {
    // Start with some bugware...
    try {
	textNodeType = Node.TEXT_NODE;
    } catch (exn) {  // Your DOM is BROKEN!
	textNodeType = 3;
    }
    // Now despam email adresses.
    despam();
}
// ]]>


// to avoir right clicking on pictures
// Disable right click script II (on images)- By Dynamicdrive.com
// For full source, Terms of service, and 100s DTHML scripts
// Visit http://www.dynamicdrive.com

// var clickmessage="You can't download images on this page !"

// function disableclick(e) {
// if (document.all) {
// if (event.button==2||event.button==3) {
// if (event.srcElement.tagName=="IMG"){
// alert(clickmessage);
// return false;
// }
// }
// }
// else if (document.layers) {
// if (e.which == 3) {
// alert(clickmessage);
// return false;
// }
// }
// else if (document.getElementById){
// if (e.which==3&&e.target.tagName=="IMG"){
// alert(clickmessage);
// return false;
// }
// }
// }

// function associateimages(){
// for(i=0;i<document.images.length;i++)
// document.images[i].onmousedown=disableclick;
// }

// function protect_picts () {
// if (document.all)
// document.onmousedown=disableclick
// else if (document.getElementById)
// document.onmouseup=disableclick
// else if (document.layers)
// associateimages()
// }
var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {
	 if (document.layers||(document.getElementById&&!document.all)) {
	 if (e.which==2||e.which==3) {(message);return false;}}}
function protect_picts () {
	 if (document.layers) 
	 {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
	 else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;};
	 document.oncontextmenu=new Function("return false");
}

// toolbar ie 2 choices
// <META HTTP-EQUIV="imagetoolbar" CONTENT="no">
// or
// <img src="test.gif" GALLERYIMG="no">
