function highlight(me){
fullname=me.src
gifindex=fullname.indexOf('.gif')
mainname=fullname.substr(0,gifindex)
highlightname=mainname+'-h.gif';
me.src=highlightname;
}

function lowlight(me){
fullname=me.src
gifindex=fullname.indexOf('-h.gif')
mainname=fullname.substr(0,gifindex)
lowlightname=mainname+'.gif';
me.src=lowlightname;
}


function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function preloadInternalImages() {

	var preloadFlag = false;
	if (document.images) {
		img1 = newImage("images/intro-h.gif");
		img2 = newImage("images/educ-h.gif");
		img3 = newImage("images/publ-h.gif");
		img4 = newImage("images/phot-h.gif");
		img5 = newImage("images/cons-h.gif");
		img6 = newImage("images/news-h.gif");
		img7 = newImage("images/cont-h.gif");
		img8 = newImage("images/inno-h.gif");
		preloadFlag = true;
	}
}


function validate(elmnt1,elmnt2) {
myform = document.all(elmnt1)
switch (elmnt1){
	case 'addnews':
		{
			if (myform.newsTitle.value.length<1) {
				alert ("Title is required! Please enter it.");
				myform.newsTitle.focus();
				return false;
				}
			else if (myform.newsDate.value.length<1) {
				alert ("Date is required! Please enter your it.");
				myform.newsDate.focus();
				return false;
				}
			else if (myform.newsSource.value.length<1) {
				alert ("Source is required! Please enter it.");
				myform.newsSource.focus();
				return false;
				}
			else if (myform.newsKeyword.value.length<1) {
				alert ("Keyword is required! Please enter your it.");
				myform.newsKeyword.focus();
				return false;
				}
			else if (myform.newsDetail.value.length<1) {
				alert ("Detail is required! Please enter your it.");
				myform.newsDetail.focus();
				return false;
				}
			else{
				replacebr(elmnt1,elmnt2);
				}
			break;
		}
	case 'addbook':
		{
			if (myform.bookName.value.length<1) {
				alert ("Name is required! Please enter it.");
				myform.bookName.focus();
				return false;
				}
			else{
				replacebr(elmnt1,elmnt2);
				}
			break;
		}
	case 'addweb':
		{
			if (myform.webName_p.value.length<1) {
				alert ("Name of web is required! Please enter it.");
				myform.webName_p.focus();
				return false;
				}
			else if (myform.webAddress.value.length<1) {
				alert ("Address of web is required! Please enter it.");
				myform.webAddress.focus();
				return false;
				}
			else{
				if (elmnt2 != ""){
					replacebr(elmnt1,elmnt2);
				}
				}
			break;
		}
	}
 }

function replacebr(elmnt1,elmnt2){
	len = document.all(elmnt2).value.length;
	myText = document.all(elmnt2).value;
	for (i=0; i<len; ++i){
		rExp = "\r\n";
		newString = new String ("<br />");
		myText = myText.replace(rExp, newString);
	}
	document.all(elmnt2).value = myText;
}


function showmenu(elmnt)
{
	document.all(elmnt).style.visibility="visible"
}

function hidemenu(elmnt)
{
	document.all(elmnt).style.visibility="hidden"
}

function highbg(elmnt)
{
	document.getElementById(elmnt).style.background="#C1CCEB"
	document.getElementById(elmnt).style.color="#2B508A"
	document.getElementById(elmnt).style.cursor="hand"
}

function lowbg(elmnt)
{
	document.getElementById(elmnt).style.background="#2B508A"
	document.getElementById(elmnt).style.color="#FFED73"
}

function showHide (elmnt1,elmnt2)
{
	showIcon = 'showIcon'+elmnt2
	hidetr = 'hidetr'+elmnt2
	hideIcon = 'hideIcon'+elmnt2
	if(elmnt1 == '1')
	{
		document.all(showIcon).style.display = "block";
		document.all(hidetr).style.display = "none";
		document.all(hideIcon).style.display = "none";
	}
	else if(elmnt1 == '0')
	{
		document.all(hideIcon).style.display = "block";
		document.all(hidetr).style.display = "block";
		document.all(showIcon).style.display = "none";
	}
}

function handon(elmnt)
{
	document.all(elmnt).style.cursor="hand";
}


