var keep,xval;

//URL to link

//var lnk=new Array('#1','building/02/','#3','#4', '#5', '#6');

//img path

var img=new 

Array('images/main_image_1.jpg','images/main_image_2.jpg','images/main_image_3.jpg','images/main_image_4.jpg','images/main_image_5.jpg','images/main_image_6.jpg','images/main_image_7.jpg');

//alt

var alt=new Array(
				  'Feel right at home &mdash; Superior luxury rental apartments in Tokyo&rsquo;s finest locations',
				  'The ideal location &mdash; Superior luxury rental apartments in Tokyo&rsquo;s finest locations',
				  'More than a view &mdash; Superior luxury rental apartments in Tokyo&rsquo;s finest locations',
				  'Luxury experience &mdash; Superior luxury rental apartments in Tokyo&rsquo;s finest locations',
				  'Lifestyle Excellence &mdash; Superior luxury rental apartments in Tokyo&rsquo;s finest locations',
				  'Your comfort zone &mdash; Superior luxury rental apartments in Tokyo&rsquo;s finest locations',
				  'Home Entertainment &mdash; Superior luxury rental apartments in Tokyo&rsquo;s finest locations'
				  );

var maxlink=img.length;

function InitCookie(){

//read Cookie

  val=new Array();

  val= document.cookie.split("; ");

  valbase="sumitomolatourtopimg="; // Cookie's variable name

  len=valbase.length;

  keep=0;

  for(i=0;val[i];i++){

    if (val[i].substr(0,len) == valbase){

      keep = 1 * val[i].substr(len,val[i].length);

      break;

    }

  }

//modiry the read value

  if(!keep)keep=0;

  xval=keep;

  keep=(keep+1)%maxlink;

//write a Cookie

  exp=new Date();

//Cookie is available for a week

  exp.setTime(exp.getTime()+24*3600*1000*7);

  document.cookie = valbase + keep + "; expires=" + exp.toGMTString();

}
