/**
 * @Name     
 * @Desc    サイト全般に使用
 * @Author  Y.Okuyama
 * @Date    2007/06/13 16:16
 **/

/*--Page Link Setting(Host Root)--*/
var HOST_ROOT = ("/");


/*--Page Guide Script--*/
function pageBack() {
	history.back();	
}


/*--Flash Images Layout Script--*/
function loadFlashFile(str)
{
	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='550' height='255' id='topFlash' align='middle'>");
	document.write("<param name='allowScriptAccess' value='sameDomain' />");
	document.write("<param name='movie' value='flash/" + str + ".swf' />");
	document.write("<param name='quality' value='high' />");
	document.write("<param name='bgcolor' value='#000000' />");
	document.write("<param name='wmode' value='transparent' />");
	document.write("<embed src='flash/" + str + ".swf' quality='high' wmode='transparent' bgcolor='#000000' width='550' height='255' name='topFlash' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
	document.write("</object>");
}

function loadFlashStory(str)
{
	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='330' height='285' id='topFlash' align='middle'>");
	document.write("<param name='allowScriptAccess' value='sameDomain' />");
	document.write("<param name='movie' value='flash/" + str + ".swf' />");
	document.write("<param name='quality' value='high' />");
	document.write("<param name='bgcolor' value='#000000' />");
	document.write("<param name='wmode' value='transparent' />");
	document.write("<embed src='flash/" + str + ".swf' quality='high' wmode='transparent' bgcolor='#000000' width='330' height='285' name='topFlash' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
	document.write("</object>");
}

function loadFlashMap()
{
	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='479' height='355' id='topFlash' align='middle'>");
	document.write("<param name='allowScriptAccess' value='sameDomain' />");
	document.write("<param name='movie' value='flash/map.swf' />");
	document.write("<param name='quality' value='high' />");
	document.write("<param name='bgcolor' value='#000000' />");
	document.write("<param name='wmode' value='transparent' />");
	document.write("<embed src='flash/map.swf' quality='high' wmode='transparent' bgcolor='#000000' width='479' height='355' name='topFlash' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
	document.write("</object>");
}


/*--CSS Control Script--*/
function elementDisplay(str)
{
	document.getElementById(str).style.visibility = "visible";
}

function elementHidden(str)
{
	document.getElementById(str).style.visibility = "hidden";
}

function listVisible(str)
{
	document.getElementById(str).className = "qaListOn";
}

function listHidden(str)
{
	document.getElementById(str).className = "qaListOff";
}


/*--Rollover Image Control--*/
function initRollovers()
{
	if (!document.getElementById) return;
	
	var aPreLoad = new Array();
	var defaultSrc;
	var targetImage = document.getElementsByTagName('img');

	for (var i = 0; i < targetImage.length; i++)
	{	
		if (targetImage[i].className == 'rollover')
		{
			var src = targetImage[i].getAttribute('src');
			var extension = src.substring(src.lastIndexOf('.'), src.length);
			var changeSrc = src.replace(extension, '_over'+extension);
			targetImage[i].setAttribute('changeSrc', changeSrc);
			aPreLoad[i] = new Image();
			aPreLoad[i].src = changeSrc;
			targetImage[i].onmouseover = function()
			{
				defaultSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('changeSrc'));
			}	
			targetImage[i].onmouseout = function()
			{
				if (!defaultSrc) defaultSrc = this.getAttribute('src').replace('_over'+extension, extension);
				this.setAttribute('src', defaultSrc);
			}
		}
	}
}
window.onload = initRollovers;



/*--Pop Up Window Control--*/
function openEstimate(number)
{
	window.open("estimate.php?number="+number,"new","width=800,height=700,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no");
}

function openPage(pageLink,pageHeight)
{
	window.open( pageLink + ".html","new","width=640,height=" + pageHeight + ",toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no");
}

function openPage2(pageLink,pageHeight)
{
	window.open( pageLink + ".php","new","width=640,height=" + pageHeight + ",toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no");
}



/*--Other Window Controll--*/
function otherWinCtr(url)
{
	window.opener.location.href = url;
}



/*--Bookmark--*/
function bookMark(pageName)
{
	window.external.addFavorite(location.href,pageName);
}

function addSidebar(pageName) 
{
	window.sidebar.addPanel(pageName,location.href,"");
}

