// JavaScript Document

<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_dragLayer(objName,x,hL,hT,hW,hH,toFront,dropBack,cU,cD,cL,cR,targL,targT,tol,dropJS,et,dragJS) { //v4.01
  //Copyright 1998 Macromedia, Inc. All rights reserved.
  var i,j,aLayer,retVal,curDrag=null,curLeft,curTop,IE=document.all,NS4=document.layers;
  var NS6=(!IE&&document.getElementById), NS=(NS4||NS6); 
  if (!IE && !NS) return false;
  retVal = true; 
  if(IE && event) event.returnValue = true;
  if (MM_dragLayer.arguments.length > 1) {
    curDrag = MM_findObj(objName); 
    if (!curDrag) return false;
    if (!document.allLayers) { document.allLayers = new Array();
      with (document) if (NS4) { for (i=0; i<layers.length; i++) allLayers[i]=layers[i];
        for (i=0; i<allLayers.length; i++) if (allLayers[i].document && allLayers[i].document.layers)
          with (allLayers[i].document) for (j=0; j<layers.length; j++) allLayers[allLayers.length]=layers[j];
      } else {
        if (NS6) { var spns = getElementsByTagName("span"); var all = getElementsByTagName("div"); 
          for (i=0;i<spns.length;i++) if (spns[i].style&&spns[i].style.position) allLayers[allLayers.length]=spns[i];}
        for (i=0;i<all.length;i++) if (all[i].style&&all[i].style.position) allLayers[allLayers.length]=all[i]; 
    } }
    curDrag.MM_dragOk=true; 
    curDrag.MM_targL=targL; 
    curDrag.MM_targT=targT;
    curDrag.MM_tol=Math.pow(tol,2); 
    curDrag.MM_hLeft=hL; 
    curDrag.MM_hTop=hT;
    curDrag.MM_hWidth=hW; 
    curDrag.MM_hHeight=hH; 
    curDrag.MM_toFront=toFront;
    curDrag.MM_dropBack=dropBack; 
    curDrag.MM_dropJS=dropJS;
    curDrag.MM_everyTime=et; 
    curDrag.MM_dragJS=dragJS;
    curDrag.MM_oldZ = (NS4)?curDrag.zIndex:curDrag.style.zIndex;
    curLeft= (NS4)?curDrag.left:(NS6)?parseInt(curDrag.style.left):curDrag.style.pixelLeft; 
    if (String(curLeft)=="NaN") curLeft=0; 
    curDrag.MM_startL = curLeft;
    curTop = (NS4)?curDrag.top:(NS6)?parseInt(curDrag.style.top):curDrag.style.pixelTop; 
    if (String(curTop)=="NaN") curTop=0; 
    curDrag.MM_startT = curTop;
    curDrag.MM_bL=(cL<0)?null:curLeft-cL; 
    curDrag.MM_bT=(cU<0)?null:curTop-cU;
    curDrag.MM_bR=(cR<0)?null:curLeft+cR; 
    curDrag.MM_bB=(cD<0)?null:curTop+cD;
    curDrag.MM_LEFTRIGHT=0; 
    curDrag.MM_UPDOWN=0; 
    curDrag.MM_SNAPPED=false; //use in your JS!
    document.onmousedown = MM_dragLayer; 
    document.onmouseup = MM_dragLayer;
    
    if (NS) document.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
    
  } else {
    var theEvent = ((NS)?objName.type:event.type);
	
    if (theEvent == 'mousedown') {
      var mouseX = (NS)?objName.pageX : event.clientX + document.body.scrollLeft;
      var mouseY = (NS)?objName.pageY : event.clientY + document.body.scrollTop;
      var maxDragZ=null; document.MM_maxZ = 0;
      for (i=0; i<document.allLayers.length; i++) { aLayer = document.allLayers[i];
        var aLayerZ = (NS4)?aLayer.zIndex:parseInt(aLayer.style.zIndex);
        if (aLayerZ > document.MM_maxZ) document.MM_maxZ = aLayerZ;
        var isVisible = (((NS4)?aLayer.visibility:aLayer.style.visibility).indexOf('hid') == -1);
        if (aLayer.MM_dragOk != null && isVisible) with (aLayer) {
          var parentL=0; var parentT=0;
          if (NS6) { parentLayer = aLayer.parentNode;
            while (parentLayer != null && parentLayer.style.position) {             
              parentL += parseInt(parentLayer.offsetLeft); 
		  parentT += parseInt(parentLayer.offsetTop);
              parentLayer = parentLayer.parentNode;
          } } else if (IE) { parentLayer = aLayer.parentElement;       
            while (parentLayer != null && parentLayer.style.position) {
              parentL += parentLayer.offsetLeft; parentT += parentLayer.offsetTop;
              parentLayer = parentLayer.parentElement; } }
          var tmpX=mouseX-(((NS4)?pageX:((NS6)?parseInt(style.left):style.pixelLeft)+parentL)+MM_hLeft);
          var tmpY=mouseY-(((NS4)?pageY:((NS6)?parseInt(style.top):style.pixelTop) +parentT)+MM_hTop);
          if (String(tmpX)=="NaN") tmpX=0; 
	    if (String(tmpY)=="NaN") tmpY=0;
          var tmpW = MM_hWidth;  if (tmpW <= 0) tmpW += ((NS4)?clip.width :offsetWidth);
          var tmpH = MM_hHeight; if (tmpH <= 0) tmpH += ((NS4)?clip.height:offsetHeight);
          if ((0 <= tmpX && tmpX < tmpW && 0 <= tmpY && tmpY < tmpH) && (maxDragZ == null
              || maxDragZ <= aLayerZ)) { curDrag = aLayer; maxDragZ = aLayerZ; } } }
      if (curDrag) {
        document.onmousemove = MM_dragLayer; 
	  if (NS4) document.captureEvents(Event.MOUSEMOVE);
        curLeft = (NS4)?curDrag.left:(NS6)?parseInt(curDrag.style.left):curDrag.style.pixelLeft;
        curTop = (NS4)?curDrag.top:(NS6)?parseInt(curDrag.style.top):curDrag.style.pixelTop;
        if (String(curLeft)=="NaN") curLeft=0; 
	  if (String(curTop)=="NaN") curTop=0;
        MM_oldX = mouseX - curLeft; 
	  MM_oldY = mouseY - curTop;
        document.MM_curDrag = curDrag;  
	  curDrag.MM_SNAPPED=false;
        if(curDrag.MM_toFront) {
          eval('curDrag.'+((NS4)?'':'style.')+'zIndex=document.MM_maxZ+1');
          if (!curDrag.MM_dropBack) document.MM_maxZ++; }
        retVal = false; if(!NS4&&!NS6) event.returnValue = false;
    } 
	document.getElementById("dropdown").style.zIndex =document.MM_maxZ+1;
	} else if (theEvent == 'mousemove') {
		if(highon==false){
		
      if (document.MM_curDrag) with (document.MM_curDrag) {
		  style.cursor = "move";
        var mouseX = (NS)?objName.pageX : event.clientX + document.body.scrollLeft;
        var mouseY = (NS)?objName.pageY : event.clientY + document.body.scrollTop;
        newLeft = mouseX-MM_oldX; 
	  newTop  = mouseY-MM_oldY;
        if (MM_bL!=null) newLeft = Math.max(newLeft,MM_bL);
        if (MM_bR!=null) newLeft = Math.min(newLeft,MM_bR);
        if (MM_bT!=null) newTop  = Math.max(newTop ,MM_bT);
        if (MM_bB!=null) newTop  = Math.min(newTop ,MM_bB);
        MM_LEFTRIGHT = newLeft-MM_startL; 
	  MM_UPDOWN = newTop-MM_startT;
        if (NS4) {left = newLeft; top = newTop;}
        else if (NS6){style.left = newLeft; style.top = newTop;}
        else {style.pixelLeft = newLeft; style.pixelTop = newTop;}
        if (MM_dragJS) eval(MM_dragJS);
        retVal = false; if(!NS) event.returnValue = false;
    } 
	
		}
	} else if (theEvent == 'mouseup') {
      document.onmousemove = null;
      if (NS) document.releaseEvents(Event.MOUSEMOVE);
      if (NS) document.captureEvents(Event.MOUSEDOWN); //for mac NS
      if (document.MM_curDrag) with (document.MM_curDrag) {
		  style.cursor = "pointer";
        if (typeof MM_targL =='number' && typeof MM_targT == 'number' &&
            (Math.pow(MM_targL-((NS4)?left:(NS6)?parseInt(style.left):style.pixelLeft),2)+
             Math.pow(MM_targT-((NS4)?top:(NS6)?parseInt(style.top):style.pixelTop),2))<=MM_tol) {
          if (NS4) {left = MM_targL; top = MM_targT;}
          else if (NS6) {style.left = MM_targL; style.top = MM_targT;}
          else {style.pixelLeft = MM_targL; style.pixelTop = MM_targT;}
          MM_SNAPPED = true; MM_LEFTRIGHT = MM_startL-MM_targL; MM_UPDOWN = MM_startT-MM_targT; }
        if (MM_everyTime || MM_SNAPPED) eval(MM_dropJS);
        if(MM_dropBack) {if (NS4) zIndex = MM_oldZ; else style.zIndex = MM_oldZ;}
        retVal = false; if(!NS) event.returnValue = false; }
      document.MM_curDrag = null;
    
	
	}
	
    if (NS) document.routeEvent(objName);
  } return retVal;
}
function drag(kk) { //v6.0
	var i;
	for (i=0;i<=kk;i++)
	{
		MM_dragLayer('lr-'+i,'',0,0,0,0,true,false,-1,-1,-1,-1,false,false,0,'',false,'');
	}
}
function showhide(szDivID, iState) // 1 visible, 0 hidden
{
    if(document.layers)	{
       document.layers[szDivID].visibility = iState ? "show" : "hide";  }
    else if(document.getElementById){
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";  } 
    else if(document.all)	{
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";   }
}
function popupWindow(url,xx,yy) { //v6.0
   var features = "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=1, height=1";
	var parts = url.split('.');
	 //alert(parts[1]);
	 
     win = window.open ("","mywin",features);
	 win.resizeTo(200,200);
	 win.document.open("text/html","replace")
	if(parts[1]=='jpg' || parts[1]=='gif' || parts[1]=='png'){
	 win.document.writeln('<html>');
	 win.document.writeln('<head>');
	 win.document.writeln('<title>Preview</title>');
	 win.document.writeln('</head>');
	 if(xx=='9999'){
	 win.document.writeln('<body onmousedown="if (event.button==2){alert(&#34;Functions Disabled&#34;)}" background="'+url+'" oncontextmenu="return false;">');
	 }else{
	 win.document.writeln('<body background="'+url+'">');
	 }
	 win.document.writeln('<div id="layer1" style="position:absolute; z-index:46; left:0px; top:0px; visibility:hidden"><img id="image1" src="'+url+'"/></div>');
	 win.document.writeln('</body >');
	 win.document.writeln('</html>');
	 win.document.close()
	 win.focus()
	 lay = win.document.getElementById('image1')
	 lay.onload=function() {
     	win.resizeTo(lay.width,lay.height+50);
	 }
}
	 if(parts[1]=='swf'){
		 win.document.writeln('<html><title>Prview</title></head><body><body><div id="layer1" style="position: absolute; z-index: 46; left: 0px; top: 0px;"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+xx+'" height="'+yy+'"><param name="movie" value="'+url+'"><param name="quality" value="high"><embed src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+xx+'" height="'+yy+'"></embed></object></div></body></html>')
	 win.document.close()
	 //win.document.getElementById('image1').focus()
	 win.focus()
     win.resizeTo(Number(xx)+6,Number(yy)+54);
	 
	}
}
function makeLayer(name,ext,x,y,z,border,popup,url,text,k,l,xx,yy) {
	//creates the layer
	
	var newdiv = document.createElement('div');
	newdiv.setAttribute('id','lr-'+name);
	newdiv.style.left = x+"px";
	newdiv.style.top = y+"px";
	newdiv.style.position = "absolute";
	//if(border== '1' ){ newdiv.style.border= "1px solid #333333"; }
	newdiv.style.zIndex = z;
	if(popup == '1'){
	newdiv.onmouseover = function() {showhide('lr-10'+name,1);}
	newdiv.onmouseout = function() {showhide('lr-10'+name,0);}
	}
	//creates image
	var newa = document.createElement('a');
	var newimg = document.createElement('img');	

	var kati = newdiv.appendChild(newa);
	var eikona = kati.appendChild(newimg);
	if(ext== 'jpg' || ext== 'png' ){ eikona.src = "thumb/thumb"+name+"."+ext; }
	if(ext== 'gif' ){	eikona.src = "anim/anim"+name+"."+ext; }
	
	if(text!=''){
	if(popup == '1'){
		var innerdiv = document.createElement('div');
		var innera = document.createElement('a');
		
		innerdiv.setAttribute('id','lr-10'+name);
		innerdiv.setAttribute("class", "arttitles2");
		innerdiv.setAttribute("className", "arttitles2");
		innerdiv.style.position = "absolute";
		innerdiv.style.right = Number(k)+"px";
		innerdiv.style.bottom = Number(l)+"px";
		innerdiv.style.zIndex = '32';
		innerdiv.style.visibility = 'hidden';
		
		innera.style.backgroundColor = "#caf3e5";
		innera.style.textDecoration = "none";
		innera.style.color = "#333333";
		innera.href = "../"+url;
		innera.target = "_self";
		innera.innerHTML = text;
		innerdiv.appendChild(innera);
		newdiv.appendChild(innerdiv);
	}
	if(popup == '2' || popup == ''){
		var spasm = url.split(".");
		if(spasm[1] == "swf"){
			kati.ondblclick = function() {return hs.htmlExpand(this, { src: [url], objectType: 'swf', width: [k], objectWidth: [k],                                          objectHeight: [l], maincontentText: 'You need to upgrade your Flash player',                                          wrapperClassName: 'draggable-header no-footer no-controls' } );}
		}else{
			if(popup == ''){
				if(ext== 'jpg' || ext== 'png' ){ url = "thumb/thumb"+name+"."+ext; }
				if(ext== 'gif' ){	url = "anim/anim"+name+"."+ext; }
			}
			kati.ondblclick = function() {return hs.expand(this, { src: [url] });}
			
		}
		kati.setAttribute('class', 'highslide');
		kati.setAttribute('className', 'highslide');
		kati.setAttribute('rel', 'highslide');
		eikona.setAttribute("title", "Drag to move, Double click to enlarge");
		//creates legend 
		var leg = document.createElement('div');
		var legend = newdiv.appendChild(leg);
		legend.setAttribute("class", "highslide-caption");
		legend.setAttribute("className", "highslide-caption");
		var newa = document.createElement('a');
		var newb = legend.appendChild(newa);
		var newc = document.createElement('span');
		newc.setAttribute("class", "arttitles2");
		newc.setAttribute("className", "arttitles2");
		newc.innerHTML = text;
		newb.appendChild(newc);	
	}
	}
	document.body.appendChild(newdiv);
}
function changeLink(id,keimeno)
{
id.innerHTML=keimeno;
}
function makefootnote(name,keimeno,theclass,thecolor){
	var newdiv = document.createElement('div');
	newdiv.setAttribute('id', name);
	newdiv.style.zIndex = "253";
	if(theclass==null){
	newdiv.setAttribute('class', 'footnotes');
	newdiv.setAttribute('className', 'footnotes');
	}else{
	newdiv.setAttribute('class', theclass);
	newdiv.setAttribute('className', theclass);
	}
	var innera = document.createElement('span');
	innera.style.cursor = "pointer";
	innera.onclick = function() {showhide(name,0);};
	innera.style.textAlign = "left";
	innera.style.fontSize = "9px";
	if(thecolor==null){
	innera.style.color = "#999999";
	}else{
	innera.style.color = thecolor;
	}
	innera.innerHTML = '[close]<br/>';
	newdiv.appendChild(innera);
	var innerdiv = document.createElement('span');
	innerdiv.innerHTML =keimeno;
	newdiv.appendChild(innerdiv);
	
	
	document.body.appendChild(newdiv);
}
function fnshowhide(event,name){
	if(document.getElementById(name).style.visibility=='visible'){
		document.getElementById(name).style.visibility='hidden'
	}else{
		document.getElementById(name).style.visibility='visible'
	}
}
function cursor(event,name)
{
document.getElementById(name).style.left=event.clientX+10+document.body.scrollLeft;
document.getElementById(name).style.top=event.clientY-5+document.body.scrollTop;
}
function increaseDecrease(state,thenode){
	var cssRules;
	if (document.all) {
		cssRules = 'rules';
	}
	else if (document.getElementById) {
	  	cssRules = 'cssRules';
	}

	var theobj = thenode.parentNode.parentNode;
	//var theobjtitle = document.getElementById("title")
	
	var change = 1;
	if(state==2){
		change=-change;
	}
	
	if(!theobj.style.fontSize){
		for (var R = 0; R < document.styleSheets[1][cssRules].length; R++) {
			if(document.styleSheets[1][cssRules][R].selectorText == "."+theobj.className){
				if((parseInt(document.styleSheets[1][cssRules][R].style.fontSize)+change<17) && (parseInt(document.styleSheets[1][cssRules][R].style.fontSize)+change>10)){
					
				theobj.style.fontSize = parseInt(document.styleSheets[1][cssRules][R].style.fontSize)+change+"px";
				theobj.style.lineHeight = parseInt(document.styleSheets[1][cssRules][R].style.lineHeight)+change+"px";
				theobj.style.letterSpacing = parseFloat(document.styleSheets[1][cssRules][R].style.letterSpacing)+change/10+"px";
				//theobjtitle.style.fontSize = parseInt(theobj.style.fontSize)+4+"px";
				}
			}
		}
	}else{
		if((parseInt(theobj.style.fontSize) +change<17) && (parseInt(theobj.style.fontSize) +change>10)){
			
		theobj.style.fontSize = parseInt(theobj.style.fontSize) +change+"px" ;
		theobj.style.lineHeight = parseInt(theobj.style.lineHeight)+change+"px";
		theobj.style.letterSpacing = parseFloat(theobj.style.letterSpacing)+change/10+"px";	
		//theobjtitle.style.fontSize = parseInt(theobj.style.fontSize)+4+"px";
		}
	}			
}
