pic1= new Image(658,390); 
pic1.src="images/mainbg.gif"; 

function preloadImages(imgs) {
var imgURLs=['"'+imgs+'"'];

 var x=new Array();
 for(var i=0;i<imgURLs.length;i++){
  x[i]=new Image();
  x[i].src=imgURLs[i];
 }
}

// var newwindow = '';
function popitup(url,wi,hi,scrollbar) {
	if (scrollbar == 'yes') { 
		scrollbar = 'yes';
	} 
	if (scrollbar == 'no') {
		scrollbar = 'no';
	}

//if (newwindow.location && !newwindow.closed) {
//    newwindow.location.href = url;
//    newwindow.focus(); 
// } else {
  window.open(url,'','height='+hi+',width='+wi+',toolbar=no,directories=no,location=no,menubar=no,status=no,scrollbars='+scrollbar+',left=5,top=5');
// }
}

function LoadNextPic(url) {
 window.location = url;
}

var duration = 4;
function SlideShow(url) {
 setTimeout("LoadNextPic('"+url+"')",duration*1000);
}

function showHide(targetName) {
 if( document.getElementById ) { // NS6+
  target = document.getElementById(targetName);
 } else if( document.all ) { // IE4+
  target = document.all[targetName];
 }
 if( target ) {
  if( target.style.display == "none" ) {
   target.style.display = "inline";
  } else {
   target.style.display = "none";
  }
 }
} 
function show(ttName) {
 if( document.getElementById ) { // NS6+
  tt = document.getElementById(ttName);
 } else if( document.all ) { // IE4+
  tt = document.all[ttName];
 }

 tt.style.display = "inline";
}

function hide(targetName) {
 if( document.getElementById ) { // NS6+
  target = document.getElementById(targetName);
 } else if( document.all ) { // IE4+
  target = document.all[targetName];
 }
 target.style.display = "none";
}

isNS4 = (document.layers) ? true : false;
isIE4 = (document.all && !document.getElementById) ? true : false;
isIE5 = (document.all && document.getElementById) ? true : false;
isNS6 = (!document.all && document.getElementById) ? true : false;

function switchDiv(strDivName,bolVisible){

 //identify the element based on browser type
 if (isNS4) {
   objElement = document.layers[strDivName];
 } else if (isIE4) {
   objElement = document.all[strDivName];
 } else if (isIE5 || isNS6) {
   objElement = document.getElementById(strDivName);
 }
 
 if(isNS4){
     if(!bolVisible) {
       //objElement.style.visibility = "hidden";
       objElement.visibility ="hidden"
     } else {
       //objElement.style.visibility = "visible";
       objElement.visibility ="visible"
     }     
 }else{
     if(!bolVisible) {
       objElement.style.visibility = "hidden";
       //document.layers[strDivName].visibility ="hidden"
     } else {
       objElement.style.visibility = "visible";
       //document.layers[strDivName].visibility ="visible"
     }
 }
}

// enable scrolling for overflow:auto elements in Mozilla
function scrollMe(event) {
	var st = event.currentTarget.scrollTop + (event.detail * 12);
	event.currentTarget.scrollTop = st < 0 ? 0 : st;
	event.preventDefault();
}

function scrollDiv(what) { 
	if (document.body.addEventListener) {
		var divs = document.getElementsByTagName('DIV');
		for (var d in divs) {
			if (divs[d].className && divs[d].className == what) {
				try {
					divs[d].addEventListener('DOMMouseScroll', scrollMe, false);
				} catch (ex) {}
			}
		}
	}
}

/*
function keyread(evt,enable_nav,enable_zoom_close,b,t,f)
{
	var keyCode = 
	    document.layers ? evt.which :
	    document.all ? event.keyCode :
	    document.getElementById ? evt.keyCode : 0;
		
	if (enable_zoom_close != 1) { 
		if (enable_nav == 1) {  // enable prev/next etc buttons
			if (keyCode == 37 || keyCode == 112 || keyCode == 80) {  // left arrow or p
				window.location = '/' + b;
			}
			if (keyCode == 39 || keyCode == 110 || keyCode == 78) { // right arrow or n
				window.location = '/' + f;
			}
			if (keyCode == 122 || keyCode == 90) { // z = zoom
				popitup('/zoom.php?id='+t,'500','400','yes');
			}
			if (keyCode == 67 || keyCode == 99) { // c = comments
				popitup('/comments.php?c='+t,'500','400','yes');
			}
		}
		if (keyCode == 71 || keyCode == 103) { // g = goto number
				JumpTo();
		}
		if (keyCode == 72 || keyCode == 104) {  // h = home
			window.location = '/';
		}
		if (keyCode == 65 || keyCode == 97) { // a = about
			window.location = '/about';
		}
		if (keyCode == 83 || keyCode == 115) { // s = search
			window.location = '/search';
		}	
		if (keyCode == 114 || keyCode == 82) { // r = archive
			window.location = '/archive';
		}
		if (keyCode == 76 || keyCode == 108) { // ? = help page
			window.location = '/help';
		}
		if (keyCode == 118 || keyCode == 86) { 
			window.location = 'http://photoblogs.org/profile/';
		}
	} else { 
		if (keyCode == 120 || keyCode == 88) {
				window.close();
		}
	}
}

function JumpTo(url) {

 var str = prompt("Enter image number:","");

    if (str == null) {
        return;
    }

    if ( str.match(/^[0-9]+$/) ) {
		window.location = '/' + str;
    }
}
*/