// JavaScript Document
//画像のランダム表示用


//----------s.kato add function. analysis and adjustment on path----------
function stringCounter(str1,str2){
  var strlength=str2.length;
  var ans=0;
  var i=0;
  while((i=str1.indexOf(str2,i)) != -1){
    i+=strlength; //この行は目的によってはi++;を使う
    ans++;
  }
  return ans;
}

//alert(location.pathname);
//alert(stringCounter(location.pathname,'/'));

var count = stringCounter(location.pathname,'/');

if((count%2)==0){
	path_adjustment = '../';
}else{
	path_adjustment = './';
}
//-----------------------------------------------------------------

line = 9;
mes = new Array(9);
mes[0] ='<img src="' + path_adjustment + 'common_images/ph_header_01.jpg">';
mes[1] ='<img src="' + path_adjustment + 'common_images/ph_header_02.jpg">';
mes[2] ='<img src="' + path_adjustment + 'common_images/ph_header_03.jpg">';
mes[3] ='<img src="' + path_adjustment + 'common_images/ph_header_04.jpg">';
mes[4] ='<img src="' + path_adjustment + 'common_images/ph_header_05.jpg">';
mes[5] ='<img src="' + path_adjustment + 'common_images/ph_header_06.jpg">';
mes[6] ='<img src="' + path_adjustment + 'common_images/ph_header_07.jpg">';
mes[7] ='<img src="' + path_adjustment + 'common_images/ph_header_08.jpg">';
mes[8] ='<img src="' + path_adjustment + 'common_images/ph_header_09.jpg">';
Rnd = Math.floor(Math.random()*line);
document.write(mes[Rnd]);
