/*
 * Sikap-Bundok
 * $Id: scripts.js,v 1.1.1.1 2008/01/30 00:01:29 scastillo Exp $
 * $Name:  $
 *
 */

/*-----------------------------------------------------------------------------------------*/
/* Navigation for IE */

sfHover = function() {
	var sfEls = document.getElementById("navlist").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

/*-----------------------------------------------------------------------------------------*/
/* Slideshow */

function showOverview()
{
        document.getElementById("actions").style.visibility="hidden";
	switchSlides("overview", "slideshow");
}

function showSlideshow()
{
        document.getElementById("actions").style.visibility="visible";
	switchSlides("slideshow", "overview");
}

function showThisSlide(thisSlide)
{
//	showSlideshow();
	currentSlide = thisSlide;
	document.slideimage.src = imgbig[thisSlide];
	document.slideimage.src.filter = 'progid:DXImageTransform.Microsoft.Fade()';
        document.getElementById("captionsText").value=captions[thisSlide];
        slidenum = " Image # " + currentSlide + " of " + numSlides + " ";
	document.actions.slideSeq.value=slidenum;
	document.forCaptions.captionsText.value=captions[thisSlide]; 
}

function switchSlides(newSlide, oldSlide)
{
        document.getElementById(oldSlide).style.visibility="hidden";
        document.getElementById(newSlide).style.visibility="visible";
}


function changeImage(direction) {
	if (document.images) {

		currentSlide = parseInt(currentSlide) + direction;
		if (currentSlide > numSlides) {
			currentSlide = 1;
		}
		if (currentSlide < 1) {
			currentSlide = numSlides;
		}
		document.slideimage.src = imgbig[currentSlide];
                slidenum = " Image # " + currentSlide + " of " + numSlides + " "
		document.actions.slideSeq.value=slidenum
 		document.forCaptions.captionsText.value=captions[currentSlide]; 
	}
}


function startSlide()
{
	if (document.actions.slideButton.value=="SLIDESHOW"){
		document.actions.slideButton.value="STOP Slide"
	}
	else {
		document.actions.slideButton.value="SLIDESHOW"
	}
	if (lock == true) {
		lock = false;
		window.clearInterval(run);
	}
	else if (lock == false) {
		lock = true;
		run = setInterval("changeImage(1)", delay);
	}
}

function loadPics() {
	document.write("<div id=\"slideshow\" CLASS=\"slides\"><img src=" + imgbig[0] + 
               " name=\"slideimage\" " + "style=\"filter:progid:DXImageTransform.Microsoft.Fade()\"" + " > "  + 
               "<form name=\"forCaptions\" id=\"forCaptions\" style=\"width:400px\">" + 
               "<textarea id=\"captionsText\" name=\"captionsText\" wrap=\"virtual\"  rows=4 cols=70 readonly onFocus=\"javascript:blur()\">" +
               captions[picnum] + "</textarea></form></div>");
	var ctr = 1;

        while (ctr <= 32) { 
           /* this is a FireFox hack to provide spaces to fully show the logo plus extra spaces so
              space is allocated for the background image*/
           document.write("<br>");
           ctr = ctr + 1
        }
}


function loadPicsList() {
	document.write("<p>Click Image to Enlarge... ");
	document.write("<a href=photos.html>");
        document.writeln("Click here to go back to Photos Main Page</a></p>");
	var ctr = 1;
 	while (ctr <= numSlides)
	{
		document.write("<div class=\"pic ls\">");
		document.write("   <a href=\"photo_load.html?" + filearg + "?" + ctr + "\" class=\"tn\">");
	        document.write("   <img src=" + imgsml[ctr] + "></a>");
	        document.write("   <ul><li class=\"title\">" + "<a href=\"photo_load.html?" + filearg + "?" + ctr + "\" class=\"tn\">" + captionsBrief[ctr] + "</a></li></ul>");
		document.write("</div>");
		ctr = ctr + 1;
	}

	/* add image link to go back to index */
//	document.write("<div class=\"pic ls\">");
//	document.write("   <a href=photos.html>");
//        document.write("   <img src=images/back2index.gif></a>");
//        document.write("   <ul><li class=\"title\">" + "<a href=photos.html>Back to Index</a>" + "</li></ul>");
//	document.write("</div>");
	ctr = ctr + 1;

        /* this is a Firefox hack to provide spaces to fully show the logo plus extra spaces so
           space is allocated for the background image*/
	var agt=navigator.userAgent.toLowerCase();
	var is_gecko = (agt.indexOf('gecko') != -1);
	
	if (is_gecko) {
		var ctr2 = 1;
	        while (ctr2 <= (ctr * 2.5)) { 
	           document.write("<br>");
	           ctr2 = ctr2 + 1
	        }
	}
}


function loadIndexPics() {
	var ctr = 1;
 	while (ctr <= numIndeces)
	{
		document.write("<div class=\"pic ls\">");
		document.write("<a href=" + urlLink[ctr] + " class=\"tn\">");
	        document.write("<img src=" + imgidx[ctr] + "></a>");
	        document.write("<ul><li class=\"title\">" + captionsBrief[ctr] + "</li></ul>");
		document.write("</div>");
		ctr = ctr + 1;
	}
        while (ctr <= 2) { 
           /* this is to provide spaces to fully show the logo */
           document.write("<br>");
           ctr = ctr + 1
        }

}


//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com


///////////////////////////////////
function clickIE4(){
	if (event.button==2){
		alert(message);
		return false;
	}
}

function clickNS4(e){
	if (document.layers||document.getElementById&&!document.all){
		if (e.which==2||e.which==3){
			alert(message);
			return false;
		}
	}
}

function disableRightClick() {

	if (document.layers){
		document.captureEvents(Event.MOUSEDOWN);
		document.onmousedown=clickNS4;
	}
	else if (document.all&&!document.getElementById){
		document.onmousedown=clickIE4;
	}

	document.oncontextmenu=new Function("alert(message);return false")

}

