/* Global constants */
alb_timedelay_string='<font class="alb_font">&nbsp;&nbsp;Delay by<select id="timedelay" onchange="alb_change_timedelay()"><option value=1>1</option><option value=2 selected>2</option><option value=5>5</option><option value=10>10</option><option value=15>15</option><option value=20>20</option><option value=25>25</option><option value=30>30</option><option value=35>35</option><option value=40>40</option><option value=45>45</option><option value=50>50</option><option value=55>55</option><option value=60>60</option></select>Sec.</font>';
img_idx=0;
onesec = 1000;
default_delay = 2;
alb_default_delay();
/* end Global constants */

/* bulding pulldown to change image */
function alb_buldimageselection(){
document.writeln ("View");
document.writeln ("<select id='viewimgno' onchange='alb_jump_selected()'>");
document.writeln ("<option value=0 selected>1</option>");

for (i=1; i<img_max+1; i++){
document.writeln ("<option value="+i+">"+ (i+1) +"</option>");
}

document.writeln ("</select>");
document.writeln ("Image");
}
/* end bulding pulldown to change image */

/* main function to change images */
function alb_chgimg(i){
img_idx=i;
alb_check_prv_next_link();
alb_change_pulldown();

document.getElementById("albImage").src=img_arr[img_idx];

var cell_content=document.getElementById('album_image_table').rows[0].cells;
cell_content[0].innerHTML=img_title[img_idx];

var cell_content=document.getElementById('album_image_table').rows[2].cells;
cell_content[0].innerHTML=img_desc[img_idx];
}
/* end main function to change images */

/* jump to selected images based on change in pulldown */
function alb_jump_selected(){
img_selected=0;
img_selected=eval(document.getElementById("viewimgno").value);
alb_chgimg(img_selected);
}
/* end jump to selected images based on change in pulldown */

/* to show change in pulldown based on previous, next button selection */
function alb_change_pulldown(){
document.getElementById("viewimgno").selectedIndex=img_idx;
}
/* end to show change in pulldown based on previous, next button selection */

/* prevous next controls */
function alb_check_prv_next_link(){
tmp_prv_idx=0;
tmp_prv_idx = img_idx - 1;
if (tmp_prv_idx < 0)
	{
	document.getElementById("alb_prv_img").src="/site_includes/photo_album_includes/alb_first.gif";
	document.getElementById("alblink_previous").href="javascript:alb_chgimg(0);";
	}
else
	{
	document.getElementById("alb_prv_img").src="/site_includes/photo_album_includes/alb_prv.gif";
	document.getElementById("alblink_previous").href="javascript:alb_chgimg(tmp_prv_idx);";
	}

tmp_nxt_idx=0;
tmp_nxt_idx = img_idx + 1;
if (tmp_nxt_idx > img_max)
	{
	document.getElementById("alb_next_img").src="/site_includes/photo_album_includes/alb_last.gif";
	document.getElementById("alblink_next").href="javascript:alb_chgimg(img_max);";
	}
else
	{
	document.getElementById("alb_next_img").src="/site_includes/photo_album_includes/alb_next.gif";
	document.getElementById("alblink_next").href="javascript:alb_chgimg(tmp_nxt_idx);";
	}
}
/* end prevous next controls */

/* slide show functions start */
function alb_slide_show(){

var cell_content=document.getElementById('album_navigation_table').rows[0].cells;
cell_content[1].innerHTML=alb_timedelay_string;
document.getElementById('alblink_slideshow').innerHTML="Stop";
document.getElementById('alblink_slideshow').href="javascript:alb_stopCount();";
alb_timedCount();

}

function alb_timedCount(){

alb_chgimg(img_idx);
ss=setTimeout("alb_timedCount()",slide_delay)
img_idx = img_idx + 1;
if (img_idx > img_max)
	{
	img_idx=0;
	}
}

function alb_stopCount(){

document.getElementById('alblink_slideshow').innerHTML="Start Slide Show";
document.getElementById('alblink_slideshow').href="javascript:alb_slide_show();";

var cell_content=document.getElementById('album_navigation_table').rows[0].cells;
cell_content[1].innerHTML="";
alb_default_delay();

clearTimeout(ss)
}

function alb_change_timedelay(){
new_delay=eval(document.getElementById("timedelay").value);
slide_delay = onesec * new_delay;
}

function alb_default_delay(){
slide_delay = onesec * default_delay;
}
/* end slide show functions start */