

      function loadAlbum(albumId){
        if (albumId == '') return false;

        window.location=pageName+"?albid="+albumId;
      }

      function loadPhoto(url){
        document.getElementById('mainpic').src="images/loading.jpg";
        document.getElementById('mainpic').src=photoUrls[url];
      }

      function prevPage(){
        currentPage = currentPage - perPage;
        lastPage = false;
        if (currentPage < 0) currentPage = 0;

        var output = '';

        for (var cont = 0; cont < perPage; cont++){
          output += "<div class=\"frame-thumb\">\n";
          output += "\t<img id=\"thumb_"+cont+"\" onclick=\"loadPhoto("+(currentPage+cont)+")\" src=\""+thumbUrls[currentPage+cont]+"\" width=\"45\" height=\"39\">\n";
          output += "</div>\n";
        }

        document.getElementById("thumbs").innerHTML = output;

      }

      function nextPage(){
        if (lastPage) return false;


        if (currentPage + perPage >= photoUrls.length){
          lastPage = true;
          return false;
        }

        var output = '';
        currentPage = currentPage + perPage;

        for (var cont = 0; cont < perPage; cont++){
          output += "<div class=\"frame-thumb\">\n";

          if ((cont + currentPage) < thumbUrls.length){
            output += "\t<img id=\"thumb_"+cont+"\" onclick=\"loadPhoto("+(currentPage+cont)+")\" src=\""+thumbUrls[currentPage+cont]+"\" width=\"45\" height=\"39\">\n";
          } else {
            output += "\t<img id=\"thumb_"+cont+"\" src=\"images/black-thumb.jpg\" width=\"45\" height=\"39\">\n";
          }

          output += "</div>\n";


        }
        document.getElementById("thumbs").innerHTML = output;
      }

      // show the correct order or dropdown event or location
      function changeTo(formType){
        var input = document.getElementById("form-control-"+formType);
        var output = document.getElementById("form-control");
        var objectHtml = input.innerHTML;
        var re = /replace_/g;

        // remove the "replace_" from ids to not take mistaken
        objectHtml = objectHtml.replace(re,"");

        // just apply it!
        output.innerHTML = objectHtml;
      }

