﻿
/**********************************************************************************/





function popUpImg(URL, msg) {

	if (URL.match("^file")) {
		alert(msg);
		return;
	}

	day = new Date();
	id = day.getTime();
	w = document.body.clientWidth;
	h = document.body.clientHeight;

	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width="+w+",height="+h+",left=0,top=0');");
}


function popupImgSrc(im, msg) {
	if (im.src.match("^file")) {
		alert(msg);
		return;
	}

	day = new Date();
	id = day.getTime();
	w = document.body.clientWidth;
	h = document.body.clientHeight;

	eval("page" + id + " = window.open(im.src, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width="+w+",height="+h+",left=0,top=0');");
}



function chooseCollection ( collID ) {
	/*
	a = document.getElementsByName("collectionForm")[0].elements[1];
	if (!(a.value == 'act_1' || a.value == 'act_2')) {
		a.value = 'act_1';
	}
	*/
	document.getElementsByName("collectionForm")[0].elements[0].value = collID;
	document.getElementsByName("collectionForm")[0].submit();
}

function naught() {}

function redirectToTable(allFns) {
	document.getElementsByName("redForm")[0].elements[0].value = allFns;
	document.getElementsByName("redForm")[0].submit();
}

function previewDocument(pvFilename) {
	window.location = "JumpToPage?new=" + pvFilename;
}

function onSelectField(sel) {
	//alert(sel.selsize+", "+sel.selectedIndex);
	if (sel.selectedIndex == sel.selsize-1) {
		//sel.childNodes[sel.size-1].
		sel.parentNode.parentNode.childNodes[3].childNodes[0].style.display='none';
		sel.parentNode.parentNode.childNodes[3].childNodes[1].style.display='block';
		//alert("keywords");
	}
	else {
		sel.parentNode.parentNode.childNodes[3].childNodes[0].style.display='block';
		sel.parentNode.parentNode.childNodes[3].childNodes[1].style.display='none';
		//alert("moved away");
	}
}


function sects() {
	as = document.getElementsByTagName('a');
	cnt = 2;
	
	for (i=0; i<as.length; i++) {
		var sInd = as[i].href.indexOf('#sect');
		if (sInd != -1) {
			var title = as[i].innerHTML;
			var tL = title.length;
			
			title = title.substring(0, maxLBott);
			if (tL >= maxLBott)
				title += '...';

			botttree.add(cnt++, 1 , title, as[i].href);
			//alert((cnt-1)+':: '+as[i].href.substring(as[i].href.indexOf('#sect')));
		}
	}
	document.getElementById('dtree2').innerHTML = botttree.toString();
	//alert(botttree.toString());
	botttree.openAll();
}

function fixWidths() {
	is = document.getElementsByName('rightImg');
/*	for (i=0; i<is.length; i++) {
		is[i].style.display = 'block';
		if (is[i].width == 236) {
			h = is[i].height;
			w = is[i].width;
			is[i].width = 236;
			is[i].height = 236 / w * h;
		}
		else if (is[i].height == 161) {
			h = 161;
			w = is[i].width;
			is[i].width = 236;
			is[i].height = 236 / w * h;
		}
	}
*/
	lzs = document.getElementsByName('rightLez');
	for (j=0; j<is.length; j++) {
		if (is[j] != null)
			is[j].style.display = 'inline';
		if (j<lzs.length && lzs[j] != null)
			lzs[j].style.display = 'inline';
	}
	
	/*bis = document.getElementsByName('bottomImage');
	for (l=0; l<is.length; l++) {
		bis[l].height = 75;
	}
	*/
	scr = document.getElementById('scroller');
	if (scr != null) scr.style.display = 'block';
}

function popupImage() {
	cH = document.body.clientHeight;
	cW = document.body.clientWidth;
	//alert(cW+', '+cH);
	h = Number(600) + Number(150);
	w = Number(oImage.width) + Number(100);
	sm_w = Number(w-50);
	
	if (cH > h)
		cH = h;
	if (cW > w)
		cW = w;

	var hv = '_V';
	if (oImage.width > oImage.height)
		hv = '_H';
	
	newwindow2 = window.open('','_blank','left=0,top=0,height='+cH+',width='+cW+',location=no,resizable=yes,scrollbars=yes');
	
	var tmp = newwindow2.document;
	
	title = ph1.title;
	textTitle = ph1.textTitle;
	css = ph1.css;
	imgDir = ph1.imgDir;
	imgSrc = ph1.imgSrc;
	text = ph1.text;
	lang = ph1.lang;
	
	tmp.write('<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">\n');
	tmp.write('<title>'+title+'</title><link href="'+css+'" rel="stylesheet" type="text/css"></head>\n');
	tmp.write('<body style="width:'+sm_w+';text-align:center;" align="center"><br/>\n');
	tmp.write('<div align="center" width="'+sm_w+'">\n');
	tmp.write('<table width="'+sm_w+'" border="0" cellpadding="0" cellspacing="0" class="popup" align="center">\n');
	tmp.write('<tr><td height="28"><img src="'+imgDir+lang+'/top_logo_popup.jpg" width="281" height="28"></td></tr>\n');
	tmp.write('<tr><td height="21"><img src="'+imgDir+'top_image_popup'+hv+'.jpg" height="21" width="'+sm_w+'"></td></tr>\n');
	tmp.	write('<tr><td class="popup_separator">&nbsp;</td></tr>\n');
	tmp.write('<tr><td align="center"><img src="'+imgSrc+'" width="'+oImage.width+'" height="'+/*oImage.height*/600+'"></td></tr>\n');
	tmp.	write('<tr><td class="popup_separator">&nbsp;</td></tr>\n');
	tmp.	write('<tr><td class="popup_separator">&nbsp;</td></tr>\n');
	if (textTitle != '') {
		tmp.write('<tr><td class="popup_comments"><strong>'+textTitle+'</strong><br/><br/>\n');
		if (textTitle != text)
			tmp.write('<br>\n' + text);
		tmp.write('</td></tr>\n');
	}
	tmp.	write('<tr><td class="popup_separator">&nbsp;</td></tr>\n');
	tmp.	write('</table></div><br/></body></html>\n');

	tmp.close();
}


function loadImage(title, textTitle, css, imgDir, imgSrc, text, lang) {
   oImage = new Image;
   oImage.onload = popupImage;
   oImage.src = imgSrc;
   
   ph1 = new ph(title, textTitle, css, imgDir, imgSrc, text, lang);
}
 

function ph(title_, textTitle_, css_, imgDir_, imgSrc_, text_, lang_){
	this.title = title_;
	this.textTitle = textTitle_;
	this.css = css_;
	this.imgDir = imgDir_;
	this.imgSrc = imgSrc_;
	this.text = text_;
	this.lang = lang_;
}
		

function fixCaseGR(str) {
	var str1 = str.substring(0, 1).toUpperCase();
	var str2 = str.substring(1, str.length).toLowerCase();
	
	var ret = str1;

	for (i=0; i<str2.length; i++) {
		if (str2.charAt(i) == 'σ' && ( (i == (str2.length - 1)) 
									|| (str2.charAt(i+1) == ' ')                  
									|| (str2.charAt(i+1) == '\'') 
									|| (str2.charAt(i+1) == '\"') 
									|| (str2.charAt(i+1) == '-') 
									|| (str2.charAt(i+1) == ':') 
									|| (str2.charAt(i+1) == ',')
									 || (str2.charAt(i+1) == ')')
							) ) {
			ret = ret + 'ς';
		}
		else {
			ret = ret + str2.charAt(i);
		}
	}
	
	return ret;
}


function fixCase(str) {
	var str2 = str.toLowerCase();
	
	return str2;
}




function getSize(which) {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  //window.alert( 'Width = ' + myWidth );
  //window.alert( 'Height = ' + myHeight );
  return (which == 'width' ? myWidth : myHeight);
}


function scrollerReverse(scr) {
	if (scr == "left") {
		scroller.direction = "left";
	}
	else {
		scroller.direction = "right";
	}
} 



function goTo(url) {
	window.location.href = url;
}







