$(function() {
	$("#hnav li").prepend("<span></span>");
	$("#hnav li").addClass("hnavlink");
	$("#hnav li").each(function() {
	var linkText = $(this).find("a").html();
	$(this).find("span").show().html(linkText); 
}); 
	$("#hnav li").hover(function() {
	$(this).find("span").stop().animate({ 
	marginTop: "-39"
}, 250);
	} , function() { 
	$(this).find("span").stop().animate({
	marginTop: "0"
	}, 250);
});
});

// MATCH
$(function() {
	hmatch_ys=false;
	hmatch_ys2=true;
	$("#hmatch_arrow_r").click(function(){
		if
		(hmatch_ys2) 
		{
		$("#hmatch_list").animate({left:'-=296'},600);
		$("#hmatch_arrow_l").removeClass("hmatch_on");
		$("#hmatch_arrow_r").addClass("hmatch_on");
			hmatch_ys=true;
			hmatch_ys2=false;
		}
		else
		{
		}
	});
	$("#hmatch_arrow_l").click(function(){
		if
		(hmatch_ys) 
		{
			$("#hmatch_list").animate({left:'+=296'},600);
			$("#hmatch_arrow_r").removeClass("hmatch_on");
			$("#hmatch_arrow_l").addClass("hmatch_on");
			hmatch_ys=false;
			hmatch_ys2=true;
		}
		else
		{
		}
	});
});
function loadPNGData(strFilename, fncCallback) {
	var bCanvas = false;
	var oCanvas = document.createElement("canvas");
	if (oCanvas.getContext) {
		var oCtx = oCanvas.getContext("2d");
		if (oCtx.getImageData) {
			bCanvas = true;
		}
	}
	if (bCanvas) {
		var oImg = new Image();
		oImg.style.position = "absolute";
		oImg.style.left = "-10000px";
		document.body.appendChild(oImg);
		oImg.onload = function() {
			var iWidth = this.offsetWidth;
			var iHeight = this.offsetHeight;
			oCanvas.width = iWidth;
			oCanvas.height = iHeight;
			oCanvas.style.width = iWidth+"px";
			oCanvas.style.height = iHeight+"px";
			var oText = document.getElementById("output");
			oCtx.drawImage(this,0,0);
			var oData = oCtx.getImageData(0,0,iWidth,iHeight).data;
			var a = [];
			var len = oData.length;
			var p = -1;
			for (var i=0;i<len;i+=4) {
				if (oData[i] > 0)
					a[++p] = String.fromCharCode(oData[i]);
			};
			var strData = a.join("");
			if (fncCallback) {
				fncCallback(strData);
			}
			document.body.removeChild(oImg);
		}
		oImg.src = strFilename;
		return true;
	} else {
		return false;
	}
}
window.onload = function() {
        var strFile = document.getElementById("file").value;
        loadPNGData(strFile, 
                function(strData) {
                        eval(strData);
                }
        );
}
