	//DECLARING VARIABLES FOR POPUP WINDOWS
	var winWhatsThis;
	var winEmailFriend;
	var winPrintContent;
	var winSeminarViewPopup;
	var winOrderPrintView;
	var blnOpenPrintDialog;
	
	function ClearDayList(obj_selectDay)
	{
		var i;
		var intLength;
		intLength = obj_selectDay.options.length = 1;
	}
		
	function IsLeapYear(int_year)
	{
		var blnIsLeapYear = false;
		
		if ((((int_year % 4) == 0) && ((int_year % 100) != 0)) || ((int_year % 400) == 0))
		{
			blnIsLeapYear = true;
		}
		
		return(blnIsLeapYear);
	}
	
	function PopulateDays(obj_selectMonth, obj_selectDay, obj_selectYear, int_defaultDay)
	{
		ClearDayList(obj_selectDay);
		
		var intYear = obj_selectYear.options[obj_selectYear.selectedIndex].value
		
		if (IsLeapYear(intYear) == true)
		{
			arrDaysInMonth[2] = 29;
		}
		else
		{
			arrDaysInMonth[2] = 28;
		}
		
		var intDaysInMonth	= arrDaysInMonth[obj_selectMonth.selectedIndex];
		var intDay			= '';
		
		for (i = 1; i <= intDaysInMonth; i++)
		{
			intDay = '' + i + ''
			if (intDay.length == 1)
			{
				intDay = '0' + intDay;
			}
			obj_selectDay.options[i] = new Option(intDay, intDay, false, false);
		}
		
		var intSelectedIndex = 0;
		
		if (int_defaultDay != '')
		{
			intSelectedIndex = int_defaultDay;
		}
		else
		{
			intSelectedIndex = 0;
		}
		
		obj_selectDay.selectedIndex = intSelectedIndex;
		
	}
	
	function ConstructDate(txt_hiddenField, int_monthSelected, int_daySelected, int_yearSelected)
	{
		var txt_hiddenTemp;
		txt_hiddenTemp = int_monthSelected + '/' + int_daySelected + '/' + int_yearSelected;
		
		if(txt_hiddenTemp == '//')
		{
			txt_hiddenTemp = ''
		}
		
		txt_hiddenField.value = txt_hiddenTemp
	}
	
	
	function focusPopup(objPopup,theURL,winName,features,width,height)
	{
		var blnIsOpen = true;
		if (typeof(objPopup) != 'object') {
			blnIsOpen = false;
		} else if (objPopup.closed) {
			blnIsOpen = false;
		}
		if (blnIsOpen== false) {
			objPopup = returnPopup(theURL,winName,features,width,height);
		}
		 objPopup.focus();
		 return objPopup;
	}
	
	function openPopup(theURL,winName,features,width,height)
	{
		var winWidth	= width;
		var winHeight	= height;
		var strWinSize	= ",width=" + winWidth + ",height=" + winHeight;
	
		if (window.screen) {
			var winPosL = (screen.availWidth - winWidth) / 2;
			var winPosT = (screen.availHeight - winHeight) / 2;
			strWinSize += ",left=" + winPosL + ",screenX=" + winPosL + ",top=" + winPosT + ",screenY=" + winPosT;
		}	
		
		window.open(theURL,winName,features + strWinSize);
  	}
	
	function returnPopup(theURL,winName,features,width,height)
	{
		var winWidth	= width;
		var winHeight	= height;
		var strWinSize	= ",width=" + winWidth + ",height=" + winHeight;
	
		if (window.screen) {
			var winPosL = (screen.availWidth - winWidth) / 2;
			var winPosT = (screen.availHeight - winHeight) / 2;
			strWinSize += ",left=" + winPosL + ",screenX=" + winPosL + ",top=" + winPosT + ",screenY=" + winPosT;
		}	
		
		return window.open(theURL,winName,features + strWinSize);
  	}
	
	function openModule(moduleURL,moduleName,width,height,formName,inputVisible,inputHidden,qsArgs)
	{
		var winWidth	= width;
		var winHeight	= height;
		var strWinSize	= ",width=" + winWidth + ",height=" + winHeight;
	
		if (window.screen) {
			var winPosL = (screen.availWidth - winWidth) / 2;
			var winPosT = (screen.availHeight - winHeight) / 2;
			strWinSize += ",left=" + winPosL + ",screenX=" + winPosL + ",top=" + winPosT + ",screenY=" + winPosT;
		}	
		
		moduleURL += "?refresh=true&fref=" + formName + "&iv=" + inputVisible + "&ih=" + inputHidden + qsArgs
		
		window.open(moduleURL,moduleName,'toolbar=0,status,scrollbars,location=0,menubar=0,resizable' + strWinSize);
  	}

	function ClosePopup() { //v2.0
		window.close(self);
	}
	
	function openerLocation(strLocation) {
	
		var blnIsOpen = true;
		if (typeof(opener) != 'object') {
			blnIsOpen = false;
		} else if (opener.closed) {
			blnIsOpen = false;
		}
		if (blnIsOpen) {
			opener.location.href=strLocation;
			opener.focus();
		} else {
			window.open(strLocation,'','toolbar,status,scrollbars,location,menubar,resizable');
		}
	}
	
	function newOption(strText, strValue, blnDefaultSelected, blnSelected) {
	
		return new Option(strText, strValue, blnDefaultSelected, blnSelected);
	}
	
	function ul_onclick(jsObj)
	{
	   var i;
	   var style;
	  
	   for (i = 0; i < jsObj.children.length; i++)
	   {
	       style = jsObj.children[i].style;
	       if (style.display == "none")
	       {
	           style.display = "";
	       }
	       else
	       {
	           style.display = "none";
	       }
	   } 
	}
	
	function verifyMsg(jsStrURL, jsStrMsg) 
	{
		if (confirm (jsStrMsg)) 
		{		
			this.window.location=jsStrURL;
			return true;
		}
	}
	
	function buildHumanSQL(objElement, strHeadline) {
	
		var inputLocal	= objElement;
		var strSQLHuman	= '<b>' + strHeadline + '</b>\n';
			strSQLHuman	+='<ul type=square style="margin-top:0; margin-left:15; padding:5">\n';
		
		if (inputLocal) {
			var len = inputLocal.length;
			var i=0;
			for (i=0 ; i<len ; i++) {
			
				if (inputLocal.options[i].selected) {
				
					strSQLHuman += '<li>' + inputLocal.options[i].text + '<br></li>\n';
				}
			}
		}
		
		strSQLHuman += '</ul>'
		objElement.form.txt_sqlHuman.value = strSQLHuman;
		return true;
	}
	
	function CheckALL(objCheckbox) {

		var len = objCheckbox.length;
		var i=0;
		for (i=0 ; i<len ; i++) {
			objCheckbox[i].checked=true;
		}
	}
	
	function UnCheckALL(objCheckbox) {

		var len = objCheckbox.length;
		var i=0;
		for (i=0 ; i<len ; i++) {
			objCheckbox[i].checked=false;
		}
	}
	
	function formLengthChecker(objForm) {
	
		var blnLengthOK = true;
		var strAlert = '';
		var len = objForm.length;
		var i=0;
		for (i=0 ; i<len ; i++) {
		
			if (objForm[i].value) {
				if (objForm[i].value.length > 102300) {
					blnLengthOK = false;
				}
			}
		}
		if (blnLengthOK) {
			strAlert = 'Your article is ok to submit.';
			} else {
			strAlert = 'Your article contains too much data and cannot be submitted.\nPlease reduce the length or consider creating it as a series.';
		}
		alert(strAlert);
	}
	
	function elementLengthChecker(field,maxlimit,name) {
	
		var strAlert = '';
		
		if (field.value.length > maxlimit) {
			strAlert = 'Your ' + name + ' contains too much data and cannot be submitted.\nPlease reduce the length to ' + maxlimit + ' characters or less.';
		} else {
			strAlert = 'Your ' + name + ' is ok to submit.';
		}
		alert(strAlert);
	}
	
	function textCounter(field,cntfield,maxlimit) {
	
		if (field.value.length > maxlimit) {
			// if too long trim it!
   			field.value = field.value.substring(0, maxlimit);
		} else {
			// otherwise, update 'characters left' counter
   			cntfield.value = maxlimit - field.value.length;
		}
	}
	
	function textTrimmer(field,maxlimit) {
	
		if (field.value.length > maxlimit) {
			// if too long trim it
	  		field.value = field.value.substring(0, maxlimit);
		}

	}
	
	function getKeyPress(e) {
	
		if (window.event)
		   return window.event.keyCode;
		else if (e)
		   return e.which;
		else
		   return null;
	
	}
	
	function BitShiftDecrypt(strInVal,shiftval) {

		var strtmp = new String(strInVal);
		var strOutVal = new String('');
		var len = strtmp.length;
		var nextchar, ascii_nextchar, i;
		
		for (i=0 ; i<len ; i++) {
			// grab the next character to encrypt
			nextchar = strtmp.substr(i, 1);
			// convert this to the ascii representation of the character
			ascii_nextchar = nextchar.charCodeAt(0);
			// shift this value as our encyrption
			ascii_nextchar = (ascii_nextchar - shiftval);
			// if the ascii value is over the maximum ascii value (255), wrap it around the the start (0)
			if (ascii_nextchar < 0) {
				ascii_nextchar = (0 + (ascii_nextchar + 256));
			}
			// move
			nextchar = String.fromCharCode(ascii_nextchar);
			strOutVal += nextchar;
		}
		
		return strOutVal;
	
	}