        var seletected_photo_text = "Selected Photo"
        var selected_vt_text = "Selected Virtual Tour"
        var photos_text = "Photo(s)"
        var vts_text = "Virtual Tour(s)"
        var vts_text1 = "Virtual Tour"
        var previous_text = "Previous"
        var next_text = "Next"
        var select_virtual_tour = "Select a Virtual Tour"
        var selectacategory = "Select A Category:"
        var clickndrag = "Click and drag image to explore the scene."
        var downloadlink1=""
        var downloadlink2=""


  function updatePageSection(caller)
  {
    updateThumbs(caller.value)
    if (typeof dcs_ptr != 'undefined') {
      dcs_ReRun("wt_redirect","WT.photoAction=pTourCat&WT.photoCategory="+caller.value,false,true);
    }
  }

  function updatePreviousPageSection(caller)
  {
    current_section = caller.value
    group = getMaxGroup()
    max_group = getMaxGroup()
    rePopulateThumbs()
    updateMain(last_position)
    setCount()
  }

  function initThumbs()
  {
    updateThumbs(defaultCategory)
  }

  function updateThumbs(update_category)
  {
    group=1
    current_section = update_category
    rePopulateThumbs()
    max_group = getMaxGroup()
    setCount()
  }


  function setCount()
  {
    var e2 = document.all ? document.all('count') :
    document.getElementById ? document.getElementById('count') : null;
    if (e2) e2.innerHTML = getImageCount() + " "+photos_text+"&nbsp;&nbsp;";
  }

  function getImageCount()
  {
    imageCount = 0
    //for (var i = 0; i < photos.length; i++) {
    //  if(photos[i].section == current_section){
    //    imageCount = imageCount + 1;
    //  }
    //}
    imageCount = photos.length
    return imageCount
  }

  function recordConstuctor(position,path,thumb_path, alt, group, section, langalt,large_path,e_exists,width,heigt){
    this.position = position
    this.path = path
    this.thumb_path=thumb_path
    this.alt=alt
    this.group = group
    this.section = section
    this.langalt = langalt
    this.large_path = large_path
    this.e_exists = e_exists
    this.width = width
    this.heigt = heigt
    return this
  }

  function nextPicture()
  {
    if(photo_position != last_position)
    {
      setNextPosition(photo_position)
      updateMain(photo_position)
    } else {
      if(group != max_group)
      {
        nextGroup()
      } else {
        nextCategory()
      }
    }
  }

  function nextCategory()
  {
    var selectBox = document.getElementById('category_dd')
    var lastIndex = selectBox.length - 1
    var nextDdIndex = 0
    if(selectBox.selectedIndex != lastIndex)
    {
      nextDdIndex = selectBox.selectedIndex + 1
    }
    selectBox.selectedIndex = nextDdIndex
    updatePageSection(selectBox)
  }


  function setNextPosition(position)
  {
    for (var i = 1; i < list.length; i++)
    {
      if(list[i] == position)
      {
        photo_position = list[i+1]
        return
      }
    }
  }

  function previousPicture()
  {
    if(photo_position != first_position)
    {
      setPreviousPosition(photo_position)
      updateMain(photo_position)
    } else {
      if(group != min_group)
      {
        group = group - 1
        rePopulateThumbs()
        updateMain(last_position)
      } else {
        previousPicCategory()
      }
    }
  }

  function previousPicCategory()
  {
    var selectBox = document.getElementById('category_dd')
    var lastIndex = selectBox.length - 1
    var nextDdIndex = lastIndex
    if(selectBox.selectedIndex != 0)
    {
      nextDdIndex = selectBox.selectedIndex - 1
    }
    selectBox.selectedIndex = nextDdIndex
    current_section = selectBox.value
    group = getMaxGroup()
    max_group = getMaxGroup()
    rePopulateThumbs()
    updateMain(last_position)
    setCount()
    }

  function previousCategory()
  {
    var selectBox = document.getElementById('category_dd')
    var lastIndex = selectBox.length - 1
    var nextDdIndex = lastIndex
    if(selectBox.selectedIndex != 0)
    {
      nextDdIndex = selectBox.selectedIndex - 1
    }
    selectBox.selectedIndex = nextDdIndex
    current_section = selectBox.value
    group = getMaxGroup()
    max_group = getMaxGroup()
    rePopulateThumbs()
    updateMain(first_position)
    setCount()
  }

  function setPreviousPosition(position)
  {
    for (var i = 1; i < list.length; i++)
    {
      if(list[i] == position)
      {
        photo_position = list[i-1]
        return
      }
    }
  }

  function nextGroup()
  {
    if(group != getMaxGroup())
    {
      group = group + 1
      updateMain(first_position)
      rePopulateThumbs()
    } else {
        nextCategory()
    }
  }

  function previousGroup()
  {
    if(group != min_group)
    {
      group = group - 1
      updateMain(first_position)
      rePopulateThumbs()
    } else {
        previousCategory()
    }
  }

  function clearThumbs()
  {
    for (var i = 1; i < list.length; i++)
    {
      eval("document." + list[i] + ".src='http://images3.ichotelsgroup.com/cq/etc/media_library/hi/0/cn/nlbi.Par.0019.Image.gif'")
    }
  }

  function rePopulateThumbs()
  {
      clearThumbs()

      for (var i = 0; i < photos.length; i++) {
      if(photos[i].group == group && photos[i].section == current_section)
      {
        
        eval("document." + photos[i].position + ".src='http://www.ichotelsgroup.com/hotelmedia/repository/hotelimages/SHRWY/" + photos[i].thumb_path + "'")
        if(photos[i].langalt == "")
        {
          if(photos[i].position == "tn1_1")
          {
            document.tn1_1.alt = photos[i].alt;
          } else if(photos[i].position == "tn1_2")  {
            document.tn1_2.alt = photos[i].alt;
          } else if(photos[i].position == "tn1_3")  {
            document.tn1_3.alt = photos[i].alt;
          } else if(photos[i].position == "tn2_1")  {
            document.tn2_1.alt = photos[i].alt;
          } else if(photos[i].position == "tn2_2")  {
            document.tn2_2.alt = photos[i].alt;
          } else if(photos[i].position == "tn2_3")  {
            document.tn2_3.alt = photos[i].alt;
          }
        } else {
          if(photos[i].position == "tn1_1")
          {
            document.tn1_1.alt = photos[i].langalt;
          } else if(photos[i].position == "tn1_2")  {
            document.tn1_2.alt = photos[i].langalt;
          } else if(photos[i].position == "tn1_3")  {
            document.tn1_3.alt = photos[i].langalt;
          } else if(photos[i].position == "tn2_1")  {
            document.tn2_1.alt = photos[i].langalt;
          } else if(photos[i].position == "tn2_2")  {
            document.tn2_2.alt = photos[i].langalt;
          } else if(photos[i].position == "tn2_3")  {
            document.tn2_3.alt = photos[i].langalt;
          }
        }
        last_position = photos[i].position;
      }
    }
  }

//  function updateMain(position)
//  {
//    document.main_photo.src = "http://images3.ichotelsgroup.com/cq/etc/media_library/hi/0/cn/nlbi.Par.0016.Image.gif"
//
//    for (var i = 0; i < photos.length; i++) {
//
//      if(photos[i].group == group && photos[i].section == current_section)
//      {
//
//        if(photos[i].position == position)
//        {
//
//          var e3 = document.all ? document.all('seeLargerPhoto') :
//          document.getElementById ? document.getElementById('seeLargerPhoto') : null;
//          if(photos[i].e_exists == "false")
//          {
//            if (e3) e3.innerHTML = "";
//            document.main_photo.className = "no_finger"
//          } else {
//            if (e3) e3.innerHTML = see_larger_photo+" >>";
//            document.main_photo.className = "the_finger"
//          }
//          
//          document.main_photo.src = "http://www.ichotelsgroup.com/hotelmedia/repository/hotelimages/SHRWY/" + photos[i].path;
//          current_photo = i;
//          if(photos[i].langalt == "")
//          {
//            document.main_photo.alt = photos[i].alt;
//          } else {
//            document.main_photo.alt = photos[i].langalt;
//          }
//
//          photo_position = photos[i].position;
//
//          var el = document.all ? document.all('alt') :
//          document.getElementById ? document.getElementById('alt') : null;
//
//      if(photos[i].langalt != "null" && photos[i].alt != "null") {
//            if(photos[i].langalt == "")
//            {
//              if (el) el.innerHTML = "&nbsp;"+seletected_photo_text+": " + photos[i].alt;
//            } else {
//              if (el) el.innerHTML = photos[i].langalt;
//            }
//        }
//
//
//        
//        var nextButton = getByNameThenId("next_button");
//        if (nextButton) {
//          if (nextButton.src) {
//            nextButton.src = "#"
//          } else {
//            nextButton.href = "#"
//          }
//        }
//        var prevButton = getByNameThenId("prev_button");
//        if (prevButton) {
//          if (prevButton.src) {
//            prevButton.src = "#"
//          } else {
//            prevButton.href = "#"
//          }
//        }
//
//          if(group == min_group && photos.length > 1)
//          {
//            var el = document.all ? document.all('previous_group') :
//            document.getElementById ? document.getElementById('previous_group') : null;
//            if (el) el.innerHTML = "<< " + previous_text;
//          }
//          if(group == getMaxGroup() && photos.length > 1)
//          {
//            var el = document.all ? document.all('next_group') :
//            document.getElementById ? document.getElementById('next_group') : null;
//            if (el) el.innerHTML = next_text + " >>";
//          }
//
//        }
//      }
//    }
//    if (typeof dcs_ptr != 'undefined') {
//      dcs_ReRun("wt_redirect","WT.photoAction=image",false,true);
//    }
//  }

  function getMaxGroup()
  {
    maxGroup = 1
    for (var i = 0; i < photos.length; i++)
    {
      if(current_section == photos[i].section)
      {
        maxGroup = photos[i].group
      }
    }
    return maxGroup
  }

  
  function getByNameThenId(nameOrId) {
      var button = document.getElementsByName(nameOrId);
      if (typeof button == "undefined" || button == null) {
        button = document.getElementById(nameOrId);
      } else if (button.length > 0) {
        button = button[0];
      }
      return button;
  }



  var list = new Array()
  list[1] = "tn1_1"
  list[2] = "tn2_1"
  list[3] = "tn1_2"
  list[4] = "tn2_2"
  list[5] = "tn1_3"
  list[6] = "tn2_3"

  var group = 1
  var photo_position = list[1]

  
        
          var defaultCategory = "WELCM"
          var photos = new Array()
          
            
              
                
                  photos[photos.length] = new recordConstuctor("1","FEATR_POOL_01_C.jpg","FEATR_POOL_01_F.jpg","Pool, Sauna, Whirlpool",1,"FEATR","Pool, Sauna, Whirlpool","FEATR_POOL_01_E.jpg","true","500","334")
                
              
                
                  photos[photos.length] = new recordConstuctor("2","FEATR_RECR_02_C.jpg","FEATR_RECR_02_F.jpg","Putting Green",1,"FEATR","Putting Green","FEATR_RECR_02_E.jpg","true","334","500")
                
              
                
                  photos[photos.length] = new recordConstuctor("3","FEATR_POOL_03_C.jpg","FEATR_POOL_03_F.jpg","Swimming Pool and Whirlpool",1,"FEATR","Swimming Pool and Whirlpool","FEATR_POOL_03_E.jpg","true","500","334")
                
              
                
                  photos[photos.length] = new recordConstuctor("4","FEATR_HLTH_04_C.jpg","FEATR_HLTH_04_F.jpg","Personal Trainer",1,"FEATR","Personal Trainer","FEATR_HLTH_04_E.jpg","true","334","500")
                
              
                
                  photos[photos.length] = new recordConstuctor("5","FEATR_HLTH_05_C.jpg","FEATR_HLTH_05_F.jpg","Fitness Center",1,"FEATR","Fitness Center","FEATR_HLTH_05_E.jpg","true","500","334")
                
              
                
                  photos[photos.length] = new recordConstuctor("6","FEATR_HLTH_06_C.jpg","FEATR_HLTH_06_F.jpg","Masseuse",1,"FEATR","Masseuse","FEATR_HLTH_06_E.jpg","true","500","375")
                
              
                
                  photos[photos.length] = new recordConstuctor("7","FEATR_RECR_07_C.jpg","FEATR_RECR_07_F.jpg","Computer Kiosk",1,"FEATR","Computer Kiosk","FEATR_RECR_07_E.jpg","true","500","334")
                
              
                
                  photos[photos.length] = new recordConstuctor("8","GROOM_ROOM_01_C.jpg","GROOM_ROOM_01_F.jpg","Guest Room",1,"GROOM","Guest Room","GROOM_ROOM_01_E.jpg","true","500","500")
                
              
                
                  photos[photos.length] = new recordConstuctor("9","GROOM_ROOM_02_C.jpg","GROOM_ROOM_02_F.jpg","Double-Bedded Guest Room",1,"GROOM","Double-Bedded Guest Room","GROOM_ROOM_02_E.jpg","true","500","372")
                
              
                
                  photos[photos.length] = new recordConstuctor("10","GROOM_ROOM_03_C.jpg","GROOM_ROOM_03_F.jpg","King Guest Room",1,"GROOM","King Guest Room","GROOM_ROOM_03_E.jpg","true","334","500")
                
              
                
                  photos[photos.length] = new recordConstuctor("11","GROOM_ROOM_04_C.jpg","GROOM_ROOM_04_F.jpg","Atrium King",1,"GROOM","Atrium King","GROOM_ROOM_04_E.jpg","true","500","334")
                
              
                
                  photos[photos.length] = new recordConstuctor("12","GROOM_SUIT_05_C.jpg","GROOM_SUIT_05_F.jpg","King Parlor",1,"GROOM","King Parlor","GROOM_SUIT_05_E.jpg","true","500","333")
                
              
                
                  photos[photos.length] = new recordConstuctor("13","MTGEV_BALL_01_C.jpg","MTGEV_BALL_01_F.jpg","Geneva Solitude",1,"MTGEV","Geneva Solitude","MTGEV_BALL_01_E.jpg","true","500","334")
                
              
                
                  photos[photos.length] = new recordConstuctor("14","MTGEV_MEET_02_C.jpg","MTGEV_MEET_02_F.jpg","Chaparral U-Shape",1,"MTGEV","Chaparral U-Shape","MTGEV_MEET_02_E.jpg","true","500","334")
                
              
                
                  photos[photos.length] = new recordConstuctor("15","MTGEV_MEET_03_C.jpg","MTGEV_MEET_03_F.jpg","Diamond Sibley Classroom",1,"MTGEV","Diamond Sibley Classroom","MTGEV_MEET_03_E.jpg","true","334","500")
                
              
                
                  photos[photos.length] = new recordConstuctor("16","MTGEV_BALL_04_C.jpg","MTGEV_BALL_04_F.jpg","Ballroom",1,"MTGEV","Ballroom","MTGEV_BALL_04_E.jpg","false","224","168")
                
              
                
                  photos[photos.length] = new recordConstuctor("17","RSTLN_REST_01_C.jpg","RSTLN_REST_01_F.jpg","Restaurant",1,"RSTLN","Restaurant","RSTLN_REST_01_E.jpg","false","224","168")
                
              
                
                  photos[photos.length] = new recordConstuctor("18","RSTLN_REST_02_C.jpg","RSTLN_REST_02_F.jpg","LeGourmet",1,"RSTLN","LeGourmet","RSTLN_REST_02_E.jpg","true","436","500")
                
              
                
                  photos[photos.length] = new recordConstuctor("19","RSTLN_REST_03_C.jpg","RSTLN_REST_03_F.jpg","The Greenery",1,"RSTLN","The Greenery","RSTLN_REST_03_E.jpg","true","500","334")
                
              
                
                  photos[photos.length] = new recordConstuctor("20","RSTLN_REST_04_C.jpg","RSTLN_REST_04_F.jpg","Restaurant",1,"RSTLN","Restaurant","RSTLN_REST_04_E.jpg","true","500","333")
                
              
                
                  photos[photos.length] = new recordConstuctor("21","RSTLN_LNGE_05_C.jpg","RSTLN_LNGE_05_F.jpg","Billiards Scooters",1,"RSTLN","Billiards Scooters","RSTLN_LNGE_05_E.jpg","true","500","333")
                
              
                
                  photos[photos.length] = new recordConstuctor("22","RSTLN_LNGE_06_C.jpg","RSTLN_LNGE_06_F.jpg","Scooters",1,"RSTLN","Scooters","RSTLN_LNGE_06_E.jpg","true","500","333")
                
              
                
                  photos[photos.length] = new recordConstuctor("23","RSTLN_LNGE_07_C.jpg","RSTLN_LNGE_07_F.jpg","Scooters Bar & Grill",1,"RSTLN","Scooters Bar & Grill","RSTLN_LNGE_07_E.jpg","true","500","333")
                
              
                
                  photos[photos.length] = new recordConstuctor("24","WELCM_EXTR_01_C.jpg","WELCM_EXTR_01_F.jpg","Exterior View B",1,"WELCM","Exterior View B","WELCM_EXTR_01_E.jpg","true","500","334")
                
              
                
                  photos[photos.length] = new recordConstuctor("25","WELCM_EXTR_02_C.jpg","WELCM_EXTR_02_F.jpg","Exterior View",1,"WELCM","Exterior View","WELCM_EXTR_02_E.jpg","false","224","168")
                
              
                
                  photos[photos.length] = new recordConstuctor("26","WELCM_EXTR_03_C.jpg","WELCM_EXTR_03_F.jpg","Exterior View",1,"WELCM","Exterior View","WELCM_EXTR_03_E.jpg","true","500","334")
                
              
                
                  photos[photos.length] = new recordConstuctor("27","WELCM_EXTR_04_C.jpg","WELCM_EXTR_04_F.jpg","Exterior View Convention Center",1,"WELCM","Exterior View Convention Center","WELCM_EXTR_04_E.jpg","true","500","334")
                
              
                
                  photos[photos.length] = new recordConstuctor("28","WELCM_LBBY_05_C.jpg","WELCM_LBBY_05_F.jpg","Atrium Lunch",1,"WELCM","Atrium Lunch","WELCM_LBBY_05_E.jpg","true","334","500")
                
              
                
                  photos[photos.length] = new recordConstuctor("29","WELCM_LBBY_06_C.jpg","WELCM_LBBY_06_F.jpg","Atrium Luncheon",1,"WELCM","Atrium Luncheon","WELCM_LBBY_06_E.jpg","true","500","334")
                
              
                
                  photos[photos.length] = new recordConstuctor("30","WELCM_LBBY_07_C.jpg","WELCM_LBBY_07_F.jpg","Atrium Waterfall",1,"WELCM","Atrium Waterfall","WELCM_LBBY_07_E.jpg","true","334","500")
                
              
                
                  photos[photos.length] = new recordConstuctor("31","WELCM_LBBY_08_C.jpg","WELCM_LBBY_08_F.jpg","Brew Garden...Proudly Brewing Starbucks",1,"WELCM","Brew Garden...Proudly Brewing Starbucks","WELCM_LBBY_08_E.jpg","true","500","334")
                
              
                
                  photos[photos.length] = new recordConstuctor("32","WELCM_LBBY_09_C.jpg","WELCM_LBBY_09_F.jpg","Front Desk",1,"WELCM","Front Desk","WELCM_LBBY_09_E.jpg","true","334","500")
                
              
                
                  photos[photos.length] = new recordConstuctor("33","WELCM_LBBY_10_C.jpg","WELCM_LBBY_10_F.jpg","Pet Friendly",1,"WELCM","Pet Friendly","WELCM_LBBY_10_E.jpg","true","334","500")
                
              
                
                  photos[photos.length] = new recordConstuctor("34","WELCM_LBBY_11_C.jpg","WELCM_LBBY_11_F.jpg","Computer Kiosk",1,"WELCM","Computer Kiosk","WELCM_LBBY_11_E.jpg","true","500","334")
                
              
            
          
        
      

  var last_position
  var first_position

  last_position = list[list.length - 1]
  first_position = list[1]
  /*if(photos.length < 6)
  {
    max_group = 1;
  } else {
    max_group = Math.ceil(photos.length/6);
  }*/
  current_section = photos[0].section
  max_group = getMaxGroup();
  min_group = 1

    start_position = 1;
    array_section = "";
    for (var i = 0; i < photos.length; i++)
    {


      if(photos[i].section != array_section) // started another sections
      {
        start_position = photos[i].position
      }
      array_section = photos[i].section
      if((photos[i].position-start_position + 1) < 6)
      {
        group = 1
      } else {
        group = Math.ceil((photos[i].position-start_position + 1)/6)
      }
      photos[i].group = group
    }
    group = 1

    start_position = 1;
    array_section = "";
    for (var i = 0; i < photos.length; i++)
    {
      if(photos[i].section != array_section) // started another sections
      {
        start_position = photos[i].position
      }
      array_section = photos[i].section

      if((photos[i].position-start_position) < 0)
      {
        position = list[1];
      } else {
          position = list[((photos[i].position-start_position)%6) + 1]
      }
      photos[i].position = position
    }



clearThumbs();
  initThumbs();
  setCount();
  getByNameThenId("prev_button").alt = previous_text;
  getByNameThenId("next_button").alt = next_text;
  updatePageSection(getByNameThenId("category_dd_name"));

  var error="Right click disabled on images";
  function disableclick(e) {
  if (document.all) {
    if (event.button==2||event.button==3) {
        if (event.srcElement.tagName=="IMG"){
        alert(error);
        return false;
        }
    }
  }
  else if (document.layers) {
      if (e.which == 3) {
      alert(error);
      return false;
      }
  }
  else if (document.getElementById){
      if (e.which==3&&e.target.tagName=="IMG"){
      alert(error)
      return false
      }
    }
  }

  function disqualify(){
    for(i=0;i<document.images.length;i++){
      document.images[i].onmousedown=disableclick;
    }
  }

  if (document.all){
    document.onmousedown=disableclick
  }
  else if (document.getElementById){
    document.onmouseup=disableclick
  }
  else if (document.layers){
    //disqualify()
  }

