/*try {
	document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}
*/

function smartRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");

		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match("_off."))
			{
				images[i].onmouseover = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
				}
				images[i].onmouseout = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
				}
			}
		}
	}
}

if(window.addEventListener) {
	window.addEventListener("load", smartRollover, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", smartRollover);
}

//preload
jQuery.preloadImages = function()
{
	for(var i = 0; i<arguments.length; i++)
	{
		jQuery("<img>").attr("src", arguments[i]);
	}
};

var path = "";
$.preloadImages(
path+"/images/cmn_gnavi_top_on.gif", path+"/images/cmn_gnavi_fir_on.gif", path+"/images/cmn_gnavi_com_on.gif", path+"/images/cmn_gnavi_ass_on.gif",
path+"/images/cmn_sch_mapA.gif", path+"/images/cmn_sch_mapB.gif", path+"/images/cmn_sch_mapC.gif", path+"/images/cmn_sch_mapD.gif", path+"/images/cmn_sch_mapE.gif",
path+"/images/cmn_sch_mapF.gif", path+"/images/cmn_sch_mapG.gif", path+"/images/cmn_sch_mapH.gif", path+"/images/cmn_sch_mapI.gif", path+"/images/cmn_sch_mapJ.gif",
path+"/images/cmn_head_smallbtn_boff.gif", path+"/images/cmn_head_largebtn_bon.gif"
);

//map hover
$(function(){
	var isEnglish = $('#english').length;
	var target = $('#areaimage');
	$('area[id!="area_getadobe"]').each(function(){
		var idstr = $(this).attr('id');
		$(this).mouseover(function(){
			var path = 'images/cmn_sch_' + idstr + '.gif';
			target.attr('src', path);
		});
		$(this).mouseout(function(){
			if(isEnglish)
			{
				target.attr('src', 'images/cmn_sch_en_map.gif');
			}
			else
			{
				target.attr('src', 'images/cmn_sch_map.gif');	
			}
		});
	});
});


//form hover
$(function(){
	var inputs = $('input');
	inputs.each(function(){
		if($(this).attr('type') == 'text')
		{
			$(this).focus(function(){
				$(this).attr('class', 'textbox_hover');					   
			});	
		}
	});
	inputs.each(function(){
		if($(this).attr('type') == 'text')
		{
			$(this).blur(function(){
				$(this).attr('class', 'textbox');					   
			});	
		}
	});
});
