﻿/* written by Christopher Younan */

/* variables */
var ie=document.all;
﻿var vPlayTrans=true;
var banner;

/* element visibility handler */
function cmdShow(obj)
{
  if (ie && vPlayTrans)
  {
    document.getElementById(obj).filters.blendTrans.apply();
    document.getElementById(obj).style.visibility='visible';
    document.getElementById(obj).filters.blendTrans.play();
  }
  else
    document.getElementById(obj).style.visibility='visible';
}
function cmdHide(obj)
{
  document.getElementById(obj).style.visibility='hidden';
}

function AdvancedOptions()
{
  if (document.getElementById('advancedoptions').style.display=='none')
  {
    document.getElementById('advancedoptions').style.display='block';
    document.getElementById('advancedoptionslink').innerHTML='hide options -<span style=\"padding-right:10px;\"></span>';
    document.getElementById('newsticker').style.margin='70px 0px 0px 0px';
  }
  else
  {
    document.getElementById('advancedoptions').style.display='none';
    document.getElementById('advancedoptionslink').innerHTML='more options +';
    document.getElementById('newsticker').style.margin='163px 0px 0px 0px';
  }
}
function backToTop() {
  var x1 = x2 = x3 = 0;
  var y1 = y2 = y3 = 0;
  if (document.documentElement) {
    x1 = document.documentElement.scrollLeft || 0;
    y1 = document.documentElement.scrollTop || 0;
  }
  if (document.body) {
    x2 = document.body.scrollLeft || 0;
    y2 = document.body.scrollTop || 0;
  }
  x3 = window.scrollX || 0;
  y3 = window.scrollY || 0;
  var x = Math.max(x1, Math.max(x2, x3));
  var y = Math.max(y1, Math.max(y2, y3));
  window.scrollTo(Math.floor(x / 2), Math.floor(y / 2));
  if (x > 0 || y > 0) {
    window.setTimeout("backToTop()", 25);
  }
}
var newimg="";
function cmdSwapIMG(newimgurl, out)
{
  newimg=newimgurl
  if (out == "true")
  {
    tmeChangeImg=setTimeout("document.images.imgSwap.src=newimg;document.getElementById('imgSwap').filters.blendTrans.apply();document.getElementById('imgSwap').filters.blendTrans.play();", 300);
  }
  else 
  {
    if (typeof tmeChangeImg!="undefined")
      clearTimeout(tmeChangeImg);
    document.images.imgSwap.src=newimg;
    if (ie)
    {
      document.getElementById('imgSwap').filters.blendTrans.apply();
      document.getElementById('imgSwap').filters.blendTrans.play();
    }
  }
}

// photo page stuff
var vTR = 'yes';

var playimg=new Image();
playimg.src='images/play.gif';

var pauseimg=new Image();
pauseimg.src='images/pause.gif';

function slideit(){
document.getElementById('photonum').innerHTML=step
document.getElementById('photocnt').innerHTML=photocount
if (!document.images)
return
//If the browser is IE 4.x
if (document.all)
document.images.ssimg.filters.blendTrans.apply()
document.images.ssimg.src=eval("image"+step+".src")
//If the browser is IE 4.x
if (document.all)
document.images.ssimg.filters.blendTrans.play()
whichimage=step
if (step<photocount)
step++
else
step=1
delaytimer=setTimeout("slideit()",5000)
vTR = 'yes';
}

function gotofirst()
{
if (document.all)
document.images.ssimg.filters.blendTrans.apply();
document.images.ssimg.src=eval("image1.src");
step = 1;
            
if (document.all)
document.images.ssimg.filters.blendTrans.play();
            
document.getElementById('photonum').innerHTML=step;
document.getElementById('photocnt').innerHTML=photocount;
            
window.clearTimeout(delaytimer);
vTR = 'no';
document.images.playpauseimg.src=eval("playimg.src");
}
function gotolast()
{
if (document.all)
document.images.ssimg.filters.blendTrans.apply();
document.images.ssimg.src=eval("image" + photocount +".src");
step = photocount;
            
if (document.all)
document.images.ssimg.filters.blendTrans.play();
            
document.getElementById('photonum').innerHTML=step;
document.getElementById('photocnt').innerHTML=photocount;
            
window.clearTimeout(delaytimer);
vTR = 'no';
document.images.playpauseimg.src=eval("playimg.src");
}
function goforwardone()
{
    if (vTR == 'yes')
    {
    var tmpNum = step;
    if (document.all)
    document.images.ssimg.filters.blendTrans.apply();
    document.images.ssimg.src=eval("image" + tmpNum +".src");
    step = tmpNum;
                
    if (document.all)
    document.images.ssimg.filters.blendTrans.play();
                
    document.getElementById('photonum').innerHTML=step;
    document.getElementById('photocnt').innerHTML=photocount;
    
    window.clearTimeout(delaytimer);
    vTR = 'no';
    document.images.playpauseimg.src=eval("playimg.src");
    }
    else
    {
        if (step == photocount)
        {
            step = 0;
        }
    var tmpNum = step + 1;
    if (document.all)
    document.images.ssimg.filters.blendTrans.apply();
    document.images.ssimg.src=eval("image" + tmpNum +".src");
    step = tmpNum;
                
    if (document.all)
    document.images.ssimg.filters.blendTrans.play();
                
    document.getElementById('photonum').innerHTML=step;
    document.getElementById('photocnt').innerHTML=photocount;
    }
}
function gobackone()
{
    if (vTR == 'yes')
    {
        if (step == 2)
        {
            step = photocount + 2;
        }
        if (step == 1)
        {
            step = photocount + 1;
        }
    var tmpNum = step - 2;
    if (document.all)
    document.images.ssimg.filters.blendTrans.apply();
    document.images.ssimg.src=eval("image" + tmpNum +".src");
    step = tmpNum;
                
    if (document.all)
    document.images.ssimg.filters.blendTrans.play();
               
    document.getElementById('photonum').innerHTML=step;
    document.getElementById('photocnt').innerHTML=photocount;
    
    window.clearTimeout(delaytimer);
    vTR = 'no';
    document.images.playpauseimg.src=eval("playimg.src");
    }
    else
    {
        if (step == 1)
        {
            step = photocount + 1;
        }
    var tmpNum = step - 1;
    if (document.all)
    document.images.ssimg.filters.blendTrans.apply();
    document.images.ssimg.src=eval("image" + tmpNum +".src");
    step = tmpNum;
                
    if (document.all)
    document.images.ssimg.filters.blendTrans.play();
               
    document.getElementById('photonum').innerHTML=step;
    document.getElementById('photocnt').innerHTML=photocount;
    }
}
function pauseplay()
{
    if (vTR == 'yes')
    {
        window.clearTimeout(delaytimer);
        step=step-1;
        vTR = 'no';
        document.images.playpauseimg.src=eval("playimg.src");
    }
    else
    {
        slideit();
        vTR = 'yes';
        document.images.playpauseimg.src=eval("pauseimg.src");
    }
}
function previousFP()
{
  if (typeof slidetimer != 'undefined')
    clearTimeout(slidetimer);
  stepFP=((stepFP == 2) ? imgtotal : ((stepFP == 1) ? imgtotal -1 : stepFP - 2));
  slideFP();
}
function nextFP()
{
  if (typeof slidetimer != 'undefined')
    clearTimeout(slidetimer);
  stepFP=((stepFP == imgtotal + 1) ? 1 : stepFP++);
  slideFP();
}
function showProfile(divID, anchorID)
{
  var theDIV = document.getElementById(divID);
  var theANCHOR = document.getElementById(anchorID);
  if (theDIV.style.display == 'none')
  {
    theDIV.style.display='inline';
    theANCHOR.innerHTML='hide profile <img src="images/collapse.gif" alt="" />';
  }
  else
  {
    theDIV.style.display='none';
    theANCHOR.innerHTML='show profile <img src="images/expand.gif" alt="" />';
  }
}