function sendEmail( email ) {
	document.getElementById('showemail').innerHTML = email;
	document.email.to.value = email;
	if ( email == "" ) { document.getElementById('user').innerHTML = label_urlto; } else { document.getElementById('user').innerHTML = label_user; }
	if ( content_type != "contact" ) {
		var e =  document.getElementById('sendmail_bg');
		e.style.display= 'block';
		var e =  document.getElementById('sendmail');
		e.style.display= 'block';
		e.style.left = (( getWindowWidth() / 2 ) - ( e.offsetWidth / 2 )) + "px";
		e.style.top = (( getWindowHeight() / 2 ) - ( e.offsetHeight / 2 )) + "px";
	} else {
		document.location.href = "#sendmailform";
	}
}


function close_sendEmail() {
	document.getElementById('sendmail_bg').style.display= 'none';
	document.getElementById('sendmail').style.display= 'none';
}


function set_sendEmail() {
		var e =  document.getElementById('sendmail');
		e.style.left = (( getWindowWidth() / 2 ) - ( e.offsetWidth / 2 )) + "px";
		e.style.top = (( getWindowHeight() / 2 ) - ( e.offsetHeight / 2 )) + "px";
}


function sendURL( url ) {
	document.email.subject.value = url;
	sendEmail('');
}

function submitEmail() {
	if ( document.email.to.value == '' ) { document.email.to.value = document.email.user.value; }	
	return true;
}


function convertEmails() {
	captcha();
	var e= document.getElementById('showemail'); 
	var reg = new RegExp( "_" + email_at + "_" );
	e.innerHTML = e.innerHTML.replace(reg,"@"); 
	var reg = new RegExp( "_" + email_point + "_" );
	e.innerHTML = e.innerHTML.replace(reg,".");
	document.email.to.value = document.getElementById('showemail').innerHTML; 
	var e = document.getElementsByTagName('span');
	for( var i=0; i<e.length; i++ ) {
		if ( e.item(i).className == 'email' ) {
			var reg = new RegExp( "_" + email_at + "_" );
			e.item(i).innerHTML = e.item(i).innerHTML.replace(reg,"@"); 
			var reg = new RegExp( "_" + email_point + "_" );
			e.item(i).innerHTML = e.item(i).innerHTML.replace(reg,".");
			e.item(i).title = e.item(i).innerHTML;
			e.item(i).onclick = function() { sendEmail( this.innerHTML ) }
			e.item(i).style.cursor = "pointer";
		}
	}
	var e = document.getElementsByTagName('a');
	for( var i=0; i<e.length; i++ ) {
		if ( e.item(i).href.substring( 0, 7 ) == "mailto:" ) {
			var reg = new RegExp("_"+email_at+"_");
			e.item(i).href = e.item(i).href.replace(reg,"@"); 
			var reg = new RegExp("_"+email_point+"_");
			e.item(i).title = e.item(i).href.replace(reg,".").substring( 7, e.item(i).href.length-5 );
			if ( content_type != "contact" ) { e.item(i).href = "#";	} else { e.item(i).href = "#sendmailform"; }
			e.item(i).onclick = function() { sendEmail( this.title ) }
		} 
	}
}

