
var curNumber;

if (document.images) 
{ 
  // Preloaded images

  demo1 = new Image();
  demo1.src = "zcode/images/ban_dako.jpg";

  demo2 = new Image();
  demo2.src = "zcode/images/ban_ati.jpg";

  demo3 = new Image();
  demo3.src = "zcode/images/ban_bora.jpg";

  demo4 = new Image();
  demo4.src = "zcode/images/ban_pili.jpg";

  demo5 = new Image();
  demo5.src = "zcode/images/ban_mayon.jpg";

  demo6 = new Image();
  demo6.src = "zcode/images/ban_sin.jpg";
}

function timeimgs(numb) 
{ 
  // Reusable timer
  thetimer = setTimeout("imgturn('" +numb+ "')", 5000);
}

function imgturn(numb) 
{ 
  // Reusable image turner
  if (document.images) 
  {
    curNumber = numb;
    elem = document.getElementById('ban_img');
    if (numb == "6") 
    { 
      // This will loop the image
      if (elem != null)
        elem.src = eval("demo6.src");
      timeimgs('1');
    }
    else 
    { 
      if (elem != null)
        elem.src = eval("demo" + numb + ".src");
      timeimgs(numb = ++numb);
    }
  }
}

function changePicUrl()
{
  var strUrl = 'main.php?show=place&with=curnumber_' + curNumber;
  switch (curNumber)
  {
    case '1':
      strUrl = 'main.php?show=place&with=siargao';
      break;
    case '2':
      strUrl = 'main.php?show=carnaval&with=atiatihan';
      break;
    case '3':
      strUrl = 'main.php?show=place&with=boracay';
      break;
    case '4':
      strUrl = 'main.php?show=carnaval&with=pili';
      break;
    case '5':
      strUrl = 'main.php?show=place&with=legaspi';
      break;
    case '6':
      strUrl = 'main.php?show=carnaval&with=sinulog';
      break;
    default:
      strUrl = 'main.php?show=place&with=siargao';
      break;
  }
  //window.open(strUrl);
  elem = document.getElementById('ban_ref');
  if (elem != null)
    elem.href = 'http://www.pilipino.ru/' + strUrl;
}

