/*
 * common.js
 */

//---------------------------------------------------------------------------
// 初期処理
//---------------------------------------------------------------------------
function init(path) {

	//共通スワップ画像の先読み込み
	MM_preloadImages(path+"common/images/gnavi_freeuse-o.gif",
                   path+"common/images/gnavi_parking-o.gif",
                   path+"common/images/gnavi_bicycle_parking-o.gif",
                   path+"common/images/gnavi_merit-o.gif",
                   path+"common/images/gnavi_case-o.gif",
                   path+"common/images/gnavi_company-o.gif"
	                 );
}


//---------------------------------------------------------------------------
// 画像先読み込み
//---------------------------------------------------------------------------
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


//---------------------------------------------------------------------------
// HTMLオブジェクト取得
//---------------------------------------------------------------------------
function getObj( id )
{
	return document.all && document.all(id) || document.getElementById && document.getElementById(id);
}

//---------------------------------------------------------------------------
// 画像置換
//---------------------------------------------------------------------------
function changeImage(d, type){

	// 画像ファイル形式判定
	if(d.src.indexOf(".jpg") > -1)
	{
		ext = ".jpg";
	}
	else if(d.src.indexOf(".gif") > -1)
	{
		ext = ".gif";
	}
	else if(d.src.indexOf(".png") > -1)
	{
		ext = ".png";
	}
	else
	{
		return;
	}

	d.src=d.src.substring(0,d.src.length-5)+type+ext;
}


//---------------------------------------------------------------------------
// ポップアップ
//---------------------------------------------------------------------------
function popup(theURL,W,H,BAR){
	option = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars="+BAR+",resizable=1,width=" +  W +",height=" + H;
	nw=window.open(theURL,'pic',option,true);
	nw.focus();
}


