//---------------------------------------------------[ INITIALIZE ]
addEvent(window, 'DOMContentLoaded', init);

function init()
{
	var userAgent = navigator.userAgent;
	var msIE6 = userAgent.indexOf('MSIE 6.0') != -1;
	var msIE55 = userAgent.indexOf('MSIE 5.5') != -1;
	
	if (msIE6 || msIE55)
	{
		var naviULID = 'link_list';
		fixDropDown(naviULID);
		findPNGs();
	}
}

//----------------------------------------[ fix: navigation DROP DOWN for ie6 ]
function fixDropDown( containerID, regex )
{
	var elementList = $(containerID);
	if (elementList)
	{
		var listObjects = elementList.select('.dropdown');
		listObjects.each( function (element)
		{
			var elementParent = element.up('LI');
			addEvent(elementParent, 'mouseenter', function() { this.addClassName('over'); });
			addEvent(elementParent, 'mouseleave', function() { this.removeClassName('over'); });
		});
	}
}

//-----------------------------------------[ find: all PNG images ]
function findPNGs()
{
	if (!document.getElementsByTagName) return; 
	var images = $A(document.getElementsByTagName("IMG")); 
	images.each( function(image)
	{ 
		//var image = images[i];
		var imageSrc = image.src;
		var regex = /.png/
		var foundPNG = regex.test(imageSrc);
		if (foundPNG)
		{
			fixPNG(image);
		}
	});
}

//----------------------------------------[ fix: PNG display ]
function fixPNG(imageRef)
{
	var imgID = (imageRef.id) ? "id='" + imageRef.id + "' " : "";
	var imgClass = (imageRef.className) ? "class='" + imageRef.className + "' " : "";
	var imgTitle = (imageRef.title) ? "title='" + imageRef.title + "' " : "title='" + imageRef.alt + "' ";
	var imgStyle = "display: block;" + imageRef.style.cssText;
	var strNewHTML = "<span " + imgID + imgClass + imgTitle;
	strNewHTML += " style=\"" + "width:" + imageRef.width + "px; height:" + imageRef.height + "px;" + imgStyle; // + ";";
	strNewHTML += "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
	strNewHTML += "(src=\'" + imageRef.src + "\', sizingMethod='image');\"></span>";
	imageRef.outerHTML = strNewHTML;
}

//-------------------------[ SETUP: train connection from passed index value. ]
function mystery( indexValue, subjectText )
{
	var mystery ="109,97,105,108,116,111,58,"; // setup code.
	var train = "?subject=" + subjectText; // setup subject as string.
	var coming = "&body=";
	
	mystery += return2sender(indexValue * 1); // get required code.
	var decode = mystery.split(","); // setup array from encoded.
	mystery = ""; // setup source variable as string.
	for (var e = 0; e < decode.length; e++)
	{
		mystery += String.fromCharCode(decode[e]); // decode as string.
	}
	document.location = mystery + train + coming; // Write call.
}


