//------------------------------------------------------------------------------------------------------------------------
var RootFolder =""; //"/abaris"
function button_onmouseoverLeft(id){	eval("Link_" + id).className = "button_left_over";
}
function button_onmouseoutLeft(id){
	eval("Link_"+id).className = "button_left_normal";
}
function DisplayTitle(locTitle){
	MainTitle.innerText="    " + locTitle
}	
//------------------------------------------------------------------------------------------------------------------------
function checkpozitiveintegerfield(fieldname)
{
	if ((ispozitiveinteger(fieldname.value)) && (! isempty(fieldname.value))){return true}
	alert("Please enter pozitive integer value.");
	fieldname.focus();
	return false;	
}
//------------------------------------------------------------------------------------------------------------------------
function isreal(varstr) {
	var eroare = 0;
	for (var i = 0; i < varstr.length ; i++)
	{
	var sir = varstr.substring(i,i+1)
	if ((sir < "0" || sir > "9") && sir != ".")
		{
 		if (sir == "-" && i==0)
			{
		    //nothing
			};
			else {return false}	
		}
	}
	return true
}
//------------------------------------------------------------------------------------------------------------------------
function isinteger(varstr) {
	var eroare = 0;
	for (var i = 0; i < varstr.length ; i++)
	{
	var sir = varstr.substring(i,i+1)
	if ((sir < "0" || sir > "9"))
		{
 		if (sir == "-" && i==0)
			{
		    //nothing
			};
			else {return false}	
		}
	}
	return true
}
//------------------------------------------------------------------------------------------------------------------------
function ispozitiveinteger(varstr) {
	var eroare = 0;
	for (var i = 0; i < varstr.length ; i++)
	{
	var sir = varstr.substring(i,i+1)
	if ((sir < "0" || sir > "9"))
		{
			return false
		}
	}
	return true
}
//------------------------------------------------------------------------------------------------------------------------
function isempty(varstr) {
	if (varstr == null || varstr == "" ) 
	{ 
	return true
	}
	return false
}

//------------------------------------------------------------------------------------------------------------------------
function ParseToFloat(fieldname) {
	//if ((isreal(fieldname.value)) && (! isempty(fieldname.value))){return true}
	fieldname.value = parseFloat("0" + fieldname.value)
	//return false;	
}
//------------------------------------------------------------------------------------------------------------------------
function ParseToInt(fieldname) {
	//if ((isreal(fieldname.value)) && (! isempty(fieldname.value))){return true}
	fieldname.value = parseInt("0" + fieldname.value)
	//return false;	
}

//------------------------------------------------------------------------------------------------------------------------
function settoday(formname,fieldname) {
	DateObject = new Date()
	//alert (formname + " + " + fieldname);
	document.forms[formname].elements[fieldname+"Year"].value = DateObject.getYear();
	document.forms[formname].elements[fieldname+"Month"].value = DateObject.getMonth()+1;
	document.forms[formname].elements[fieldname+"Day"].value = DateObject.getDate();
	
}
function goLink(theLink) {
  document.location.href = "outlink.asp?" + theLink
}

//function MyDelete(ID,ListAspFile,IDField){
//	if (window.confirm('Are you sure you want to delete this?')) {
//		s = ListAspFile + "?OP=DEL&" + IDField + "=" + ID 
//		document.location = s
//	}
//}

//function MyEdit(ID,EditAspFile,IDField){
//	s = EditAspFile + "?" + IDField + "=" + ID 
//	document.location = s
//}

function MyDelete2(NewLocation){
	if (window.confirm('Are you sure you want to delete this?')) {
		document.location = NewLocation
	}
}


function MyDelete(ID,ListAspFile,IDField){
	var Linkchar
	if (ListAspFile.indexOf('?') > 0) {
		Linkchar="&" ;
	} else {
		Linkchar="?"
	};
	if (window.confirm('Are you sure you want to delete this?')) {
		s = ListAspFile + Linkchar + "OP=DEL&" + IDField + "=" + ID 
		document.location = s
	}
}
function MyEdit(ID,EditAspFile,IDField){
	var Linkchar
	var Linkchar
	if (EditAspFile.indexOf('?') > 0) {
		Linkchar="&" ;
	} else {
		Linkchar="?"
	};
	s = EditAspFile + Linkchar + IDField + "=" + ID 
	document.location = s
}


function DispLargeImage(IMGID) {
	var url
	newurl=RootFolder + "/DispLargeImage.asp?IMGID=" + IMGID
	newwin=window.open(newurl,"LargeImageWindow","toolbar=no,status=no,resizable=yes,width=400,height=400,scrollbars=yes")
	newwin.focus();
}
function glw(GLSID) {
	var url;
	var newurl;
	newurl=RootFolder + "/GlossaryFrames.asp?GLSID=" + GLSID + "&t=" + Math.random() + "#" + GLSID;
	newwin=window.open(newurl,"GlossaryWindow","toolbar=yes,status=yes,resizable=yes,width=500,height=450,scrollbars=yes")
	newwin.focus();
}

function glwbyFirstLetter(FirstLetter) {
	var url;
	var newurl;
	newurl=RootFolder + "/GlossaryFrames.asp?FirstLetter=" + FirstLetter + "&t=" + Math.random();
	newwin=window.open(newurl,"GlossaryWindow","toolbar=yes,status=yes,resizable=yes,width=500,height=450,scrollbars=yes")
	newwin.focus();
}

function ShowReviewTopic(url) {
	newwin=window.open(url,"TopicWindow","toolbar=yes,status=yes,resizable=yes,width=660,height=500,scrollbars=yes")
	newwin.focus();
}

function hlw(HTLID) {
	var url;
	var newurl;
	newurl=RootFolder + "/HotLink.asp?HTLID=" + HTLID + "&t=" + Math.random(); 
	newwin=window.open(newurl,"HotLinkWindow","toolbar=yes,status=yes,resizable=yes,width=600,height=550,scrollbars=yes")
	newwin.focus();
}

function PublicSite() {
	var url;
	var newurl;
	newurl=RootFolder + "/Default.asp"; 
	newwin=window.open(newurl,"MainWindow");
	newwin.focus();
}


function ShowLessonShortContent(LSNID) {
	var url;
	var newurl;
	newurl=RootFolder + "/ShortContent.asp?LSNID=" + LSNID ; 
	newwin=window.open(newurl,"LessonContentWindow","toolbar=yes,status=no,resizable=yes,width=600,height=400,scrollbars=yes")
	newwin.focus();
}

function ShowDiploma(CRSID) {
	var newurl;
	newurl="Diploma.asp?CRSID=" + CRSID + "&t=" + Math.random(); 
	newwin=window.open(newurl,"DiplomaWindow","toolbar=yes,status=yes,resizable=yes,width=730,height=550,scrollbars=yes")
	newwin.focus();
}

function psr(PSRID) {
	var newurl;
	newurl=RootFolder + "/PictureSource.asp?PSRID=" + PSRID; 
	newwin=window.open(newurl,"PictureSource","toolbar=yes,status=yes,resizable=yes,width=600,height=500,scrollbars=yes")
	newwin.focus();
}
