function hide(elementId) {
	if (document.getElementById) {
		document.getElementById(elementId).style.visibility = "hidden"
	} else if (document.layers) {
		document.layers[elementId].visibility = "hide"
	} else if (document.all) {
		document.all[elementId].style.visibility = "hidden"
	}
}

function show(elementId) {
	if (document.getElementById) {
		document.getElementById(elementId).style.visibility = "visible"
	} else if (document.layers) {
		document.layers[elementId].visibility = "show"
	} else if (document.all) {
		document.all[elementId].style.visibility = "visible"
	}
}


function start_show(startGroup)
{
	currentGroup = startGroup;
	if(currentGroup != 0){
		picture_num = maxSlideNum[currentGroup];
	}
	
	if(showPlaying == false){
		
		// Time is in seconds X 1000
		timerID = setInterval("slideshow()", 3000);
		showPlaying = true;
	}
}

function stop_show(){
	if(showPlaying == true){
		clearInterval(timerID);
		showPlaying = false;
	}
}

function previousSlide(){
	picture_num--;
	if (picture_num < 0){
		picture_num = pictures[currentGroup].length - 1;
	}
	current_picture.src = pictures[currentGroup][picture_num];
	document["rotating_picture"].src = current_picture.src;
}

function nextSlide(){
	picture_num++;
	if (picture_num >= pictures[currentGroup].length){
		picture_num = 0;
	}
	current_picture.src = pictures[currentGroup][picture_num];
	document["rotating_picture"].src = current_picture.src;
}

function slideshow()
{
	if (document.all){
	   document.images.rotating_picture.style.filter="blendTrans(duration=2)"
	   document.images.rotating_picture.style.filter="blendTrans(duration=crossFadeDuration)"
	   document.images.rotating_picture.filters.blendTrans.Apply()      
	}
	
	picture_num++;
	if (picture_num >= pictures[currentGroup].length){
		picture_num = 0;
	}
	current_picture.src = pictures[currentGroup][picture_num];
	document["rotating_picture"].src = current_picture.src;
	
	if (document.all){
		document.images.rotating_picture.filters.blendTrans.Play()
	}
}

function randomSlide()                                                        
{      
	if (document.all){
	   document.images.rotating_picture.style.filter="blendTrans(duration=2)"
	   document.images.rotating_picture.style.filter="blendTrans(duration=crossFadeDuration)"
	   document.images.rotating_picture.filters.blendTrans.Apply()      
	}

	picture_num = (Math.round((Math.random()*maxSlideNum[0])))                                                                                  
	if (picture_num >= pictures[0].length){
		picture_num = 0;
	}
	current_picture.src = pictures[0][picture_num];   
	document["rotating_picture"].src = current_picture.src;        
	
	if (document.all){
		document.images.rotating_picture.filters.blendTrans.Play()
	}
	
	//alert(picture_num); 
}


function changeLoginTab(){
	showLoginOption(document.loginSelect.loginMethod.value);
}
	
function showLoginOption(obj){
	//show('cLoginSelect');
	//hide('cLoginSelect');
	switch(obj){
		case "album":
			show('visitorLogin');   
			hide('cachelanLogin');
			hide('pinLogin');
			document.loginSelect.loginMethod.value = "album";
			break;
		case "cachelan":
			hide('visitorLogin');  
			show('cachelanLogin'); 
			hide('pinLogin');
			document.loginSelect.loginMethod.value = "cachelan";
			break;
		case "webcard":
			hide('visitorLogin');   
			hide('cachelanLogin');  
			show('pinLogin');
			document.loginSelect.loginMethod.value = "webcard";
			break;
		default:
			hide('visitorLogin');   
			hide('cachelanLogin');  
			show('pinLogin');
			document.loginSelect.loginMethod.value = "webcard";
			break;
	}
	randomSlide();
	
}

function enableLoginSelect(){
	document.loginSelect.loginMethod.disabled = false;
}


function boxSubmit(){
	// IE Only!
	if (document.all) {
		if((event.which && event.which == 13) || (event.keyCode && event.keyCode == 13)){
			document.all["accessCodeLogin"].focus();
		} 
	}
}	

function pageOnLoad(obj){
	MM_preloadImages('Cachelan/site_image/nav_over_r1_c1.gif','Cachelan/site_image/nav_over_r1_c2.gif','Cachelan/site_image/nav_over_r1_c3.gif','Cachelan/site_image/nav_over_r1_c4.gif','Cachelan/site_image/try_over.jpg','Cachelan/site_image/tour_over.jpg');
	enableLoginSelect();
	showLoginOption(obj);
	window.setTimeout('start_show(currentGroup)', 10000);
}