//=============================================================
// make email address
//=============================================================
function getemailaddress(xxx)
{
	if ( xxx == 1 ) var a1 = 'devmail' ;
	else var a1 = 'ads' ;
	var a2 = 'devtouch' ;
	var a3 = 'net' ;
	var a4 = a1 + '@' + a2 + '.' + a3 ;
	return a4 ;
}
//=============================================================
// print email address
//=============================================================
function writeemailaddress(xxx)
{
	document.write ( getemailaddress(xxx) ) ;
}
//=============================================================
// make email link
//=============================================================
function writeemaillink(xxx)
{
	document.write ( '<a href="mailto:' + getemailaddress(xxx) + '?subject=via DevTouch.net&body=Enter your message here.">' + getemailaddress(xxx) + '</a>' ) ;
}
//=============================================================
// cross browser getElementById
//=============================================================
function getElem ( eee )
{
	if ( document.getElementById ) return document.getElementById ( eee ) ;
	else if ( document.all ) return document.all[eee] ;
	else if ( document.layers ) return document.layers[eee] ;
}
//=============================================================
// toggle text borders in forms
//=============================================================
function textsel ( eee , vvv )
{
	if ( vvv == 1 ) eee.className = "textsel" ;
	else eee.className = "" ;
}
//=============================================================
// put i-beam on search box when clicking magnifying glass
//=============================================================
function searchfocus()
{
	document.getElementById("searchtext").focus() ;
}
//=============================================================
// trackback info popup
//=============================================================
function pingmsg()
{
	alert ( 'A trackback is a reciprocal link. You link to my post and I\'ll link back to yours here.\n\nRead the popup for details on how to get your page listed here.' ) ;
	return false ;
}
//=============================================================
// hide trackbacks
//=============================================================
function hidetrackbacks()
{
	getElem("trackbackpanel").style.display = "none" ;
}
//=============================================================
// show trackbacks - uses google jquery
//=============================================================
function showtrackbacks()
{	
	$('#trackbackpanel').slideDown() ;
	$('#trackbackshow').slideUp() ;
}
//=============================================================
// reply to comment
//=============================================================
function commentreply ( aaa , nnn )
{
	getElem("comment").focus() ;
	getElem("comment").value += '<a href="#comment-' + nnn + '" title="In response to ' + aaa + '">@' + aaa + "</a>:" ;
	setTimeout ( 'getElem("comment").focus() ; ' , 100 ) ;
}
//=============================================================
// scroll to top - adapted from inove neoease.com
//=============================================================
function goTop(acceleration, time) 
{
	acceleration = acceleration || 0.1;
	time = time || 16;

	var dx = 0;
	var dy = 0;
	var bx = 0;
	var by = 0;
	var wx = 0;
	var wy = 0;

	if (document.documentElement)
	{
		dx = document.documentElement.scrollLeft || 0;
		dy = document.documentElement.scrollTop || 0;
	}
	if (document.body) 
	{
		bx = document.body.scrollLeft || 0;
		by = document.body.scrollTop || 0;
	}
	var wx = window.scrollX || 0;
	var wy = window.scrollY || 0;

	var x = Math.max(wx, Math.max(bx, dx));
	var y = Math.max(wy, Math.max(by, dy));

	var speed = 1 + acceleration;
	window.scrollTo(Math.floor(x / speed), Math.floor(y / speed));
	if(x > 0 || y > 0) 
	{
		var invokeFunction = "goTop(" + acceleration + ", " + time + ")"
		window.setTimeout(invokeFunction, time);
	}
}