﻿var no="";

window.onload = function() {
    getGalleryList();
}

function getGalleryList() {
  document.getElementById("divPhotoSlide").innerHTML = '<center><img src="'+rootPath+'webTemplate/images/ajax/loading1.gif"></center>';
        WCFContent.JSON_getTrSlideShowHome(1, getGalleryListOnComplete);
} 



function getGalleryListOnComplete(StringResult) {
    var temp = "";
    var result ="";
    eval("result = " + StringResult)
    total = result.data[0].total;
    pageNo = result.data[0].pageNo;
    rowNum = result.data[0].rowNum;
    if (total ==0){
        temp=temp + "<div class=\"noGallery\">";
        temp=temp + "no gallery";
        temp=temp + "</div>";        
   }
    if (no == ""){
        no = result.data[1].ref
        getImageBig(no);
    }
    temp=temp + "<div class=\"imageThumb\">"; 
    temp=temp + "<div class=\"imageSpace\">&nbsp;</div>"; 
    temp=temp + "<div class=\"imageFrame\" align=\"center\">"; 
    temp=temp + "<div class=\"imageVert\">&nbsp;</div>"; 
    for (var i = 1; i < result.data.length  ; i++) {
        temp=temp + "<a href=\"javascript:getImageBig("+result.data[i].ref+")\"><img src=\"" + rootPath + "images/customModule/gallery/" + result.data[i].ref + "/P\"  width=\"50\" height=\"70\" alt=\"\" border=\"0\" hspace=\"1\" vspace=\"3\"></a>";                     
    }
    temp=temp + "</div>";                     
    temp=temp + "</div>";                     
                 

    document.getElementById("divPhotoSlide").innerHTML = temp;
    
    
   
    var tempPaging="";
    if (result.data[0].total != 0){
             
        tempPaging += "<div class=\"imagePrevNext\"><br>"
        tempPaging += "<a href=\"javascript:getGalleryList()\"><img src=\"" + rootPath + "webTemplate/images/button_prevnext.gif\" width=\"14\" height=\"14\" alt=\"\" border=\"0\" id=\"prev\" onmouseover=\"MM_swapImage('prev','','" + rootPath + "webTemplate/images/button_prevnext_o.gif',1)\" onmouseout=\"MM_swapImgRestore()\"></a>";
        tempPaging += "&nbsp;&nbsp;";
        tempPaging += "<a href=\"javascript:getGalleryList()\"><img src=\"" + rootPath + "webTemplate/images/button_prevnext.gif\" width=\"14\" height=\"14\" alt=\"\" border=\"0\" id=\"next\" onmouseover=\"MM_swapImage('next','','" + rootPath + "webTemplate/images/button_prevnext_o.gif',1)\" onmouseout=\"MM_swapImgRestore()\"></a>";
        tempPaging += "</div>"
        
        document.getElementById("photoPaging").innerHTML = tempPaging;
    }
}

function getImageBig(num){
var html = "";
    html=html + "<div class=\"imageSpace\">&nbsp;</div>";
    html=html + "<div class=\"imageBigIsi\" id =\"imageBigDesigner\">";
    html=html + "<div style=\"overflow:hidden; width:325px; height:470px;\"><img src=\"" + rootPath + "images/customModule/gallery/" + num + "/P\" width=\"325\" alt=\"\" border=\"0\"><br></div>";
    html=html + "</div>"; 
    document.getElementById("divPhotoBig").innerHTML = html;

}