
//--- # of images +1
var numImages=16;

//--- this is set up to run in reverse, highest number images will display first

img1 = new Image ()
img1.src = "images/slideshow/wedding_sm17.jpg"
img2 = new Image ()
img2.src = "images/slideshow/wedding_sm16.jpg"
img3 = new Image ()
img3.src = "images/slideshow/wedding_sm15.jpg"
img4 = new Image ()
img4.src = "images/slideshow/wedding_sm13.jpg"
img5 = new Image ()
img5.src = "images/slideshow/wedding_sm12.jpg"
img6 = new Image ()
img6.src = "images/slideshow/wedding_sm11.jpg"
img7 = new Image ()
img7.src = "images/slideshow/wedding_sm10.jpg"
img8 = new Image ()
img8.src = "images/slideshow/wedding_sm9.jpg"
img9 = new Image ()
img9.src = "images/slideshow/wedding_sm8.jpg"
img10 = new Image ()
img10.src = "images/slideshow/wedding_sm7.jpg"
img11 = new Image ()
img11.src = "images/slideshow/wedding_sm6.jpg"
img12 = new Image ()
img12.src = "images/slideshow/wedding_sm5.jpg"
img13 = new Image ()
img13.src = "images/slideshow/wedding_sm4.jpg"
img14 = new Image ()
img14.src = "images/slideshow/wedding_sm3.jpg"
img15 = new Image ()
img15.src = "images/slideshow/wedding_sm2.jpg"
img16 = new Image ()
img16.src = "images/slideshow/wedding_sm1.jpg"


imglg1 = new Image ()
imglg1.src = "images/slideshow/Large/wedding_17lg.jpg"
imglg2 = new Image ()
imglg2.src = "images/slideshow/Large/wedding_16lg.jpg"
imglg3 = new Image ()
imglg3.src = "images/slideshow/Large/wedding_15lg.jpg"
imglg4 = new Image ()
imglg4.src = "images/slideshow/Large/wedding_13lg.jpg"
imglg5 = new Image ()
imglg5.src = "images/slideshow/Large/wedding_12lg.jpg"
imglg6 = new Image ()
imglg6.src = "images/slideshow/Large/wedding_11lg.jpg"
imglg7 = new Image ()
imglg7.src = "images/slideshow/Large/wedding_10lg.jpg"
imglg8 = new Image ()
imglg8.src = "images/slideshow/Large/wedding_9lg.jpg"
imglg9 = new Image ()
imglg9.src = "images/slideshow/Large/wedding_8lg.jpg"
imglg10 = new Image ()
imglg10.src = "images/slideshow/Large/wedding_7lg.jpg"
imglg11 = new Image ()
imglg11.src = "images/slideshow/Large/wedding_6lg.jpg"
imglg12 = new Image ()
imglg12.src = "images/slideshow/Large/wedding_5lg.jpg"
imglg13 = new Image ()
imglg13.src = "images/slideshow/Large/wedding_4lg.jpg"
imglg14 = new Image ()
imglg14.src = "images/slideshow/Large/wedding_3lg.jpg"
imglg15 = new Image ()
imglg15.src = "images/slideshow/Large/wedding_2lg.jpg"
imglg16 = new Image ()
imglg16.src = "images/slideshow/Large/wedding_1lg.jpg"




var text = new Array(22);

text[1] = " ";
text[2] = " ";
text[3] = " ";
text[4] = " ";
text[5] = " ";
text[6] = " ";
text[7] = " ";
text[8] = " ";
text[9] = " ";
text[10] = " ";
text[11] = " ";
text[12] = " ";
text[13] = " ";
text[14] = " ";
text[15] = " ";
text[16] = " ";



var dostep=1;
var step=1;
var sldshow = 0;
var slideshow;
var whichimage=1;
var myWidth = 0;
var myHeight = 0;

function slideshowBack()
{
step=step+1
if (step==numImages)
{step=1}
document.images.mypic.src=eval("img"+step+".src")
//var cap = document.getElementById("piccaption");
//cap.innerHTML = text[step];
}

function slideshowUp()
{
step=step-1
if (step==0)
{step=numImages}
document.images.mypic.src=eval("img"+step+".src")
//var cap = document.getElementById("piccaption");
//cap.innerHTML = text[step];
}

function slideit(){

document.images.mypic.src=eval("img"+step+".src");
whichimage=step;
//alert(step);
if (step>1)
{
step--;
//alert("img"+step+".src");
}else{
step=numImages;
}
//alert(step);
slideshow = setTimeout('slideit()',5000);
}

function startslide()
{
step=numImages;
sldshow=1;
if (!document.images)
{
	return;
}else{
	//alert("slide");
	slideit();
}
}

function stopslide(){

if (sldshow=1) 
{
    sldshow=0;
    clearTimeout(slideshow);
    step=step-1;
    if (step==0)
    {step=38}
}

}

function slideshowUplg()
{
step=step+1
if (step==48)
{step=1}
document.mypiclarge.src=eval("imglg"+step+".src")
var cap = document.getElementById("piccaption");
cap.innerHTML = text[step];
}

function slideshowBacklg()
{
step=step-1
if (step==0)
{step=38}
document.mypiclarge.src=eval("imglg"+step+".src")
var cap = document.getElementById("piccaption");
cap.innerHTML = text[step];
}

//(C) Stephen Daly
// www.stephendaly.org
// Date: 11/3/2008

// Checks if the browsers is IE or another.
// document.all will return true or false depending if its IE
// If its not IE then it adds the mouse event
// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;

// Temporary variables to hold mouse x-y pos.s
var X = 0
var Y = 0

// Main function to retrieve mouse x-y pos.s

function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    X = event.clientX + document.body.scrollLeft
    Y = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    X = e.pageX
    Y = e.pageY
  }  
  // catch possible negative values in NS4
  if (X < 0){X = 0}
  if (Y < 0){Y = 0}  
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
  //document.Show.MouseX.value = tempX
  //document.Show.MouseY.value = tempY
  return true
}
function backgroundFilter()
{
    var div;
    //alert("filter");
    if(document.getElementById) {
    // Standard way to get element
    div = document.getElementById('backgroundFilter'); 
	}else if(document.all){ 
    // Get the element in old IE's 
    div = document.all['backgroundFilter']; 
	}
    // if the style.display value is blank we try to check it out here 
    if(div.style.display==''&&div.offsetWidth!=undefined&&div.offsetHeight!=undefined)
    {
        div.style.display = (div.offsetWidth!=0&&div.offsetHeight!=0)?'block':'none'; 
    }
    
    // If the background is hidden ('none') then it will display it ('block').
    // If the background is displayed ('block') then it will hide it ('none').
    div.style.display = (div.style.display==''||div.style.display=='block')?'none':'block';
	// Off-sets the X position by 15px
    //X = getPosition(event).x;
    //Y = getPosition(event).y;
    //X = X + 15;
    //----- just get the position of the mouse
	if(document.getElementById)
	{
    // Standard way to get element
    div = document.getElementById('popupWindow'); 
	}else if(document.all) {
    // Get the element in old IE's 
    div = document.all['popupWindow']; 
	}
	X=X-510;
	Y=Y-350;
    // Sets the position of the DIV
    div.style.left = X+'px';
    div.style.top = Y+'px';
    
}

//function popUp()
//{
//    alertSize();
//        
//    //Modifications to popUp code
//    if (sldshow==1) {
//    stopslide();
//    }
//    
//    document.mypiclarge.src=eval("imglg"+step+".src")
//    var cap = document.getElementById("piccaption");
//    cap.innerHTML = text[step];
//    
//    backgroundFilter();
//    var div;
//    
//    if(document.getElementById)
//    // Standard way to get element
//    div = document.getElementById('popupWindow'); 
//    else if(document.all) 
//    // Get the element in old IE's 
//    div = document.all['popupWindow']; 
//    
//    // if the style.display value is blank we try to check it out here 
//    if(div.style.display==''&&div.offsetWidth!=undefined&&div.offsetHeight!=undefined)
//    {
//        div.style.display = (div.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none'; 
//    }
//    
//    // If the PopUp is hidden ('none') then it will display it ('block').
//    // If the PopUp is displayed ('block') then it will hide it ('none').
//    div.style.display = (div.style.display==''||div.style.display=='block')?'none':'block';
//    

//    X = getPosition(event).x;
//    Y = getPosition(event).y;

//    
//    // Sets the position of the DIV
//    div.style.left = X+'px';
//    div.style.top = Y+'px';
//    
//}

function popUp() 
{ 
    alertSize();
    //Modifications to popUp code
    if (sldshow==1) {
    stopslide();
    }
    
    document.mypiclarge.src=eval("imglg"+step+".src")
    var cap = document.getElementById("piccaption");
    cap.innerHTML = text[step];
    
    backgroundFilter();
    var div;

    var div; 
    var div2;
    
    if(document.getElementById) 
    // Standard way to get element 
    {
    div = document.getElementById('popupWindow'); 
    div2 = document.getElementById('backgroundFilter'); 
    }
    else if(document.all) 
    // Get the element in old IE's 
    {
    div = document.all['popupWindow'];  
    div2 = document.all['backgroundFilter'];
    }  
    // if the style.display value is blank we try to check it out here 
    if(div.style.display== '' && div.offsetWidth != undefined && div.offsetHeight != undefined) 
    { 
        div.style.display = (div.offsetWidth!=0 && elem.offsetHeight!=0)?'block':'none'; 
    } 
    // If the PopUp is hidden ('none') then it will display it ('block'). 
    // If the PopUp is displayed ('block') then it will hide it ('none'). 
    div.style.display = (div.style.display==''||div.style.display=='block')?'none':'block'; 
    
    // Off-sets the X position by 15px 
    //X = X + 15;    
    // Sets the position of the DIV 
    //div.style.left = X+'px'; 
    //div.style.top = Y+'px'; 
    
    if(myWidth > 890)
    {
        div.style.left = (myWidth-890)/2; 
        div2.style.width = myWidth;
    }
    else
    {
        div.style.left = (890-myWidth)/2;
        div2.style.width = myWidth; 
    }
    if(myHeight > 700)
    {
        div2.style.height = myHeight;
    }
    else
    {
        div2.style.height = 700;
    }

    div.style.top = 16;
    
} 

function alertSize() {
  
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }

}

