function OpenWindow(strImage, intWidth, intHeight)
{
	if ((intWidth == 0) && (intHeight == 0))
	{
		window.open('popup.asp?img='+strImage);
	}
	else
	{
		window.open('popup.asp?img='+strImage, '', 'width='+intWidth+',height='+intHeight+',top=100,left=100,toolbar=0');
	}
}

function changeClass(obj, strClassName)
{
	obj.className = strClassName;
}

function toggleExpandableText(strID)
{
	var obj = document.getElementById(strID)
	if (obj.style.display == '')
	{
		obj.style.display = 'inline';
	}
	else
	{
		obj.style.display = '';
	}
}

//TRAININGEN FUNCTIONS
function CourseCategorie_Clicked(intMenuID, strPage, intCategoryID)
{
	document.location.href = "text.asp?page="+strPage+"&mid="+intMenuID+"&mcid="+intCategoryID;
}
function CourseSubCategorie_Clicked(intMenuID, strPage, intCategoryID, intSubCategoryID)
{
	document.location.href = "text.asp?page="+strPage+"&mid="+intMenuID+"&mcid="+intCategoryID+"&scid="+intSubCategoryID;
}

//QUICKSEARCH FUNCTIONS
function QuickSearchMainItemClicked(lngItemID, bitSubmitForm) 
{
	document.getElementById('QuickSearchStep0').value = lngItemID;
	if (bitSubmitForm == 1) {
		document.getElementById('page').value = 'QSStep2';
		document.getElementById('text').value = 'QSStep2';
		document.getElementById('frm').submit();
	}
}
function QuickSearchSubItemClicked(lngItemID, bitSubmitForm) 
{
	document.getElementById('QuickSearchStep1').value = lngItemID;
	if (bitSubmitForm == 1) {
		document.getElementById('page').value = 'QSStep2';
		document.getElementById('text').value = 'QSStep2';
		document.getElementById('frm').submit();
	}
}

// REACTION FORM
function ShowOtherTextBox(lngID)
{
	if (lngID == 0)
	{
		document.getElementById('otherfunction_tr').style.display = "block";
	}
}

// SUBSCRIPTION FORM
function ShowSubscribers(intMaxSubscribers, strTooManySubscribers)
{
	var intSubscribers = document.getElementById('SubscriberCount').value;
	
	if ((intSubscribers <= intMaxSubscribers) && (intSubscribers > 0))
	{
		//make visible
		for (var i=1; i <= intSubscribers; i++)
		{
			document.getElementById("Subscriber_"+i).style.display = "block";
		}
		//make invisible
		for (i=(++intSubscribers); i < intMaxSubscribers+1; i++)
		{
			document.getElementById("Subscriber_"+i).style.display = "none";
		}
	}
	else
	{
		alert(strTooManySubscribers);
	}
}

function openCalendar(oWhat, bMultiSel) 
{
	strPopUp = "includes/calendar/popup.asp?currsel=" + oWhat.value

	if (bMultiSel) { strPopUp += '&multi=1'; }
	if (event.screenY+200>screen.availHeight) { sy = screen.availHeight - 200 } else { sy = event.screenY }
	if (event.screenX+210>screen.availWidth) { sx = screen.availWidth - 210 } else { sx = event.screenX }
	var ret = window.showModalDialog(strPopUp,"LIM Calendar","dialogHeight:188px;dialogWidth:202px;dialogTop:" + sy + ";dialogLeft:" + sx + "px;center:Yes;help:No;resizable:No;status:No;scroll:No;");

	if (ret) {oWhat.value = ret};
	oWhat.blur();
}


function isFutureDate(strDate, strDateSeperator)
{
	if (!((parseInt(strDate.split(strDateSeperator)[2]) >= (new Date().getYear())) 
	   && (parseInt(strDate.split(strDateSeperator)[1], 10) >= (new Date().getMonth())) 
	   && (parseInt(strDate.split(strDateSeperator)[0], 10) >= (new Date().getDate())) ))
	{
		return false;
	}
	return true;
}

