//<!--

//var DHTML  = (document.getElementById || document.all || document.layers);
var DHTML  = (document.getElementById);
// this determines which DOM and supplies correct properties for each
function getObj(name) {
    if (document.getElementById) {
       this.obj = document.getElementById(name);
       this.style = document.getElementById(name).style;
    } else if (document.all) {
       this.obj = document.all[name];
       this.style = document.all[name].style;
    } else if (document.layers) {
       if (document.layers[name])       {
           this.obj = document.layers[name];
           this.style = document.layers[name];
       }       else       {
        this.obj = document.layers.testP.layers[name];
        this.style = document.layers.testP.layers[name];
       }
    }
  }  

function getObjNN4(obj,name) {
  var x = obj.layers;
  var thereturn;
  for (var i=0;i<x.length;i++) {
    if (x[i].id == name)
      thereturn = x[i];
    else if (x[i].layers.length)
      var tmp = getObjNN4(x[i],name);
    if (tmp) thereturn = tmp;
  }
  return thereturn;
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
	  contact = newImage("images/main-contact-button_over.jpg");
	  story = newImage("images/main-story-button_over.jpg");
	  journal = newImage("images/main-journal-button_over.jpg");
	  mission = newImage("images/main-mission-button_over.jpg");
	  home = newImage("images/main-home-button_over.jpg");
	  donate = newImage("images/main-donate-button_over.jpg");
	  preloadFlag = true;
	}
}

function toggleElements(turnOn)
{
  var selectElements = document.getElementsByTagName('select');
  for (i=0; i<selectElements.length; i++) selectElements.item(i).style.visibility = (turnOn) ? "visible" : "hidden";
}

function hideDiv(divName) {
  if (divName!='') {
   if (document.getElementById) { // DOM3 = IE5, NS6
    document.getElementById(divName).style.visibility = 'hidden';
    document.getElementById(divName).style.display = 'none';
   }
   else {
    if (document.layers) { // Netscape 4
      document.divName.visibility = 'hidden';
      document.divName.display='none';
    }
    else { // IE 4
      document.all.divName.style.visibility = 'hidden';
      document.all.divName.style.display='none';
    }
   } 
  } 
}

function showDiv(divName) {
  if (divName!='') {
   if (document.getElementById) { // DOM3 = IE5, NS6
    document.getElementById(divName).style.visibility = 'visible'; 
    document.getElementById(divName).style.display = 'block'; 
   }
   else {
    if (document.layers) { // Netscape 4
      document.divName.visibility = 'visible';
      document.divName.display = 'block';
    }
    else { // IE 4
      document.all.divName.style.visibility = 'visible';
      document.all.divName.style.display = 'block';
    }
   }
  } 
} 

function hideAllWorks_NovelText() {
	hideDiv('detail-presidents');
	hideDiv('detail-ladies');
	hideDiv('detail-western');	
}

function hideAllWorksText() {
	hideDiv('works_novel');
	hideDiv('works_short');
	hideDiv('works_essay');	
}

var activePageDiv='';

function showPageDiv(divName) {
  if (divName!='' && DHTML) {
    
    var x = new getObj('link_'+divName);
    x.obj.style.textDecoration = 'underline';
    if (activePageDiv!='') {
      hideDiv(activePageDiv);
      var y = new getObj('link_'+activePageDiv);
      y.obj.style.textDecoration = 'none';
    }
    showDiv(divName);
    activePageDiv=divName;	
  }
}


var showcasePictureIndex = 1;

function nextShowcasePicture() {
  
  showcasePictureIndex++;	
  if  	( showcasePictureIndex > 5 ) { showcasePictureIndex = 1; }
  hideAllShowcasePictures();
  showDiv('showcasePicture'+showcasePictureIndex);	
}

function previousShowcasePicture() {

  showcasePictureIndex--;	
  if  	( showcasePictureIndex < 1 ) { showcasePictureIndex = 5; }
  hideAllShowcasePictures();
  showDiv('showcasePicture'+showcasePictureIndex);
  
	
}

// function to allow the moving of the window location by link
// to a location of 1/2 the screen from the left
// and 1/2 the screen from the top
function resizeAndCenterWindow() {
  // screen.height, screen.width
  self.resizeTo(500,500)
  self.moveTo((screen.width/2-250),200)
}

function openit(sURL){
newwindow=open(sURL,"newwin","scrollbars=yes, toolbar=no, directories=no, menu bar=no, resizable=yes, status=yes, width=880, height=800");
}


//-->