var DHTML = false, DOM = false, MSIE4 = false, NS4 = false, OP = false;

if (document.getElementById) {
  DHTML = true;
  DOM = true;
} 
else {
  if (document.all) {
    DHTML = true;
    MSIE4 = true;
  } 
  else {
    if (document.layers) {
      DHTML = true;
      NS4 = true;
    }
  }
}

function maxTextDivs()
{
 	nheight=screen.availHeight;
  if((nheight>800)&&(nheight<900)){
  	sen_SetStyle("id","textbody","height","440px");  // 300 + 150
  	sen_SetStyle("id","sideboardimages","height","414px");  // 274px +150
  	sen_SetStyle("id","sideboardannotations","height","414px"); // 274px +150
  	sen_SetStyle("id","sideboard","height","458px");   // 318px +150 
  	sen_SetStyle("id","pager","top","710px");  // 580px +180
	sen_SetStyle("id","sideboardindex","height","414px");
  }
  if(nheight>=900){
  	sen_SetStyle("id","textbody","height","550px");  // 300 + 150
  	sen_SetStyle("id","sideboardimages","height","524px");  // 274px +150
  	sen_SetStyle("id","sideboardannotations","height","524px"); // 274px +150
  	sen_SetStyle("id","sideboard","height","568px");   // 318px +150 
  	sen_SetStyle("id","pager","top","820px");  // 580px +180
		sen_SetStyle("id","sideboardindex","height","524px");
  }
	
  // Set the Style for the index ankers
  var loc=window.location.hash;
  if(loc.indexOf("#anker")!=-1){
    // Set the style for all index words
    // Set the style of current index word
    nr=loc.split("#anker");
    sen_SetStyle("ankername",nr[1],"backgroundColor","#99FF00");
    sen_SetStyle("id","sideboardindex","display","block");
	  sen_SetStyle("id","sideboardimages","display","none");
  }
  if(loc.indexOf("#fanker")!=-1){
    // Set the style for all index words
    // Set the style of current index word
    nr=loc.split("#fanker");
    sen_SetStyle("ankername",nr[1],"backgroundColor","#99FF00");
    sen_SetStyle("id","sideboardindex","display","none");
	  sen_SetStyle("id","sideboardimages","display","none");
	  sen_SetStyle("id","sideboardannotations","display","block");
  }
}



if (window.opera) {
  OP = true;
}

function sen_SetStyle(Mode, Identifier, StyleKey, StyleVal)
{
  // DOM SYNTAX
   if(DOM) 
   {
     if (Mode.toLowerCase() == "id") 
     {
       Element = document.getElementById(Identifier);
       if (Element) 
       {
 		Element.style[StyleKey] = StyleVal;
       }
     }
     if (Mode.toLowerCase() == "name") 
     { 
       ElementList = document.getElementsByName(Identifier);
       for (var i = 0; i < ElementList.length; i++) 
       { 
		  document.getElementsByName(Identifier)[i].style[StyleKey] = StyleVal;
       }
     }
     if (Mode.toLowerCase() == "tagname") {
       ElementList = document.getElementsByTagName(Identifier);
       for (var i = 0; i < ElementList.length; i++) 
       {
 		  document.getElementsByTagName(Identifier)[i].style[StyleKey] = StyleVal;
       }
     }
     if (Mode.toLowerCase() == "ankername") {
       ElementList = document.getElementsByTagName("span");
       for (var i = 0; i < ElementList.length; i++) 
       {
    	  if(ElementList[i].className == "a"+Identifier){
       		ElementList[i].style[StyleKey] = StyleVal;	
       	}
       }
     }     
     
  }
  // (try) ALL SYNTAX
  else 
  {
    if(document.all && document.all.Identifier.style)
    {
      document.all.Identifier.style.StyleKey = StyleVal;
    }
  }
}

function showAnnotations(annotationnum)
{
	sen_SetStyle('id', 'sideboardannotations', 'display', 'block');
	sen_SetStyle('id', 'sideboardimages', 'display', 'none');
	sen_SetStyle('id', 'sideboardindex', 'display', 'none');
	self.location.href='#annotationsanchor_' + annotationnum;
}

function showImages()
{
	sen_SetStyle('id', 'sideboardannotations', 'display', 'none');
	sen_SetStyle('id', 'sideboardimages', 'display', 'block');
	sen_SetStyle('id', 'sideboardindex', 'display', 'none');
}


function showIndex()
{
	sen_SetStyle('id', 'sideboardannotations', 'display', 'none');
	sen_SetStyle('id', 'sideboardimages', 'display', 'none');
  sen_SetStyle('id', 'sideboardindex', 'display', 'block');
}




/*
** COOKIES
*/

function createCookie(name,value,days)
{
	return;
}

function readCookie(name)
{
	return;
}

function eraseCookie(name)
{
	return;
}

/*
**	IMAGES POP-UP
*/

function openLargeImage(completegetquery)
{

	/* get size and image name */
	var splitstring = completegetquery.split(",");
	
	var winwidth  = splitstring[0];
	var winheight = splitstring[1];
	var imgname   = splitstring[2];


	ml_ext =  "location=no,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,";
	ml_ext += "width=" + winwidth + ",height=" + winheight + ","; 
	ml_ext += "left=10,top=10";

	ml_url = "imgsl.htm?" + completegetquery;
	ml_win = window.open(ml_url,'ml_window',ml_ext);
}
