location.pathname.match(/\/item_([\d]+)\.html$/);
var id = RegExp.$1;
var xhr = new Xhr();
xhr.request( "XhrSetItemId.php", {'id': id },null,null,false);

window.onload= function()
{
    var xhr = new Xhr();
    xhr.request(
        "XhrGetItem.php"
        ,{'id': id }
        ,success = function(res)
        {
            var data = eval(res);

            var rec = data[0];

            setNaviMenu(rec);

            var ga = new googleAnalytics();
			var val = rec.item? rec.category + ' ' + rec.item + '/' + rec.color : null;
            ga.trackPageView( val ? "item="+val : null );

        }
    );

    var xhr = new Xhr();
    xhr.request(
        "XhrMarkAccesslog.php"
        ,null
        ,null
        ,null
		,true
		,10
		,timeout = function(res)
		{
			return false;
		}
    );

}

function setNaviMenu(rec)
{
	var img = document.getElementById("navi_"+rec.item_category);
	var src = img.src;
	img.src =  src.replace(/\.gif$/,"_over.gif");
//	alert(img.src);
}
/*
function setColorList(rec)
{
    var xhrItemColorListSheeker = new Xhr();
    xhrItemColorListSheeker.request(
        "XhrItemColorListSheeker.php"
        ,{
            item:rec.item,
            item_category:rec.item_category,
            color:rec.color
        }
        ,success = function(res)
        {
//alert(res);
            var data = eval(res);
            var p = document.getElementById("item_colorlist");
            for(i in data)
            {
                var rec = data[i];
                var c = document.createElement('div');
                c.id = "colorbox";
                c.innerHTML = data[i].html;
                p.appendChild(c);
            }
        }
        ,faulure = function(res)
        {
        	//
        }
		,false
		,15
		,timeout = function()
		{
			//
		}
    );
}
*/
function HeadToUpper(str)
{
    var h = str.charAt(0).toUpperCase();
    return h + str.substr(1);
}

function addFigure(str)
{
    var num = new String(str).replace(/,/g, "");
    while(num != (num = num.replace(/^(-?\d+)(\d{3})/, "$1,$2")));
    return num;
}

function trim(argValue)
{
    return String(argValue).replace(/^[ 　\n]*/gim, "").replace(/[ 　\n]*$/gim, "");
}

