function isFilled(sString){
	var whitespace = ' \t\n\r';
   var i;
   
   if (sString != undefined && sString != null)
   	sString = sString + ''
   
   if((sString == null) || (sString.length == 0))
		return false;
		
   for(i = 0; i < sString.length; i++){
      var c = sString.charAt(i);

      if(whitespace.indexOf(c) == -1)
			return true;
   }
   return false;
}
function isEmail(s){
	var sFilter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if (sFilter.test(s))
		return true;
	else
		return false;
}
function isNumeric(s){
	if (!isFilled(s))
      return false;
		
	var checkOK = '0123456789.,';
   for (i = 0; i < s.length; i++){
      ch = s.charAt(i);
      for (j = 0;  j < checkOK.length;  j++)
         if (ch == checkOK.charAt(j))
            break;
      if (j == checkOK.length){
         return false;
      }
   }
   return true;
}
function isValidString(s, checkString){
   for (i = 0; i < s.length;  i++){
      ch = s.charAt(i);
      for (j = 0;  j < checkString.length;  j++)
         if (ch == checkString.charAt(j))
            break;
      if (j == checkString.length){
         return false;
      }
   }
   return true
}
function isInValidString(s, checkString){
   for (i = 0; i < s.length;  i++){
      ch = s.charAt(i);
      for (j = 0;  j < checkString.length;  j++)
         if (ch == checkString.charAt(j))
            return false;
   }
   return true
}
function isDate(sDay, sMonth, sYear){
   if (!isFilled(sDay) || !isFilled(sMonth) || !isFilled(sYear))
      return false;
   var iDay = parseInt(sDay, 10);
   var iMonth = parseInt(sMonth, 10);
   var iYear = parseInt(sYear, 10);
	if (iMonth < 1 || iMonth > 12)
      return false;
   if ((iMonth == 1 || iMonth == 3 || iMonth == 5 || iMonth == 7 || iMonth == 8 || iMonth == 10 || iMonth == 12) && (iDay < 1 || iDay > 31))
      return false;
   if ((iMonth == 4 || iMonth == 6 || iMonth == 9 || iMonth == 11) && (iDay < 1 || iDay > 30))
      return false;
   if ((iMonth == 2)){
      if ((((iYear % 4) == 0)) && (iDay < 1 || iDay > 29)){
         return false;
      }
      else if ((((iYear % 4) != 0)) && (iDay < 1 || iDay > 28)){
         return false;
      }
   }
   return true;
}
function isTime(sHour, sMinute){
   if (!isFilled(sHour) || !isFilled(sMinute))
      return false;
   if(sMinute.length != 2)
      return false;
   var iHour = parseInt(sHour, 10);
   var iMinute = parseInt(sMinute, 10);
	if (iHour < 1 || iHour > 12)
      return false;
	if (iMinute < 0 || iMinute > 59)
      return false;
   return true;
}
function isRadioChecked(oRadio){
	if (oRadio.length) {
   	for(var x = 0; x < oRadio.length; x++)
   		if(oRadio[x].checked)
   			return true;
   } else {
   	if(oRadio.checked)
   		return true;
   }
   		
	return false;
}
function radioValue(oRadio){
	if (oRadio.length) {
   	for(var x = 0; x < oRadio.length; x++)
   		if(oRadio[x].checked)
   			return oRadio[x].value;
   } else {
   	if(oRadio.checked)
   		return oRadio.value;
   }
   		
	return '';
}
function textMaxLength(oText, iMax) {
	if(oText.value.length > iMax) {
		alert('This field can be no longer than ' + iMax + ' characters long.');
		oText.value = oText.value.substr(0, iMax);
	}
}
function openWindow(sUrl, sName , sProperties){
	window.open(sUrl, sName, sProperties);
}
function openWindowMove(sUrl, sName, sProperties, iWidth, iHeight, iMoveX, iMoveY, bDialog){
	var iX, iY;
	
	iX = iMoveX;
	if(iMoveX == 'left')
		iX = 0
	if(iMoveX == 'middle')
		iX = (screen.width / 2) - (iWidth / 2)
	if(iMoveX == 'right')
		iX = screen.width - iWidth - 10;
		
	iY = iMoveY;	
	if(iMoveY == 'top')
		iY = 0;
	if(iMoveY == 'middle')
		iY = ((screen.height - 56) / 2) - (iHeight / 2);
	if(iMoveY == 'bottom')
		iY = screen.height - 56 - iHeight;

	sProperties += ',screenX=' + iX + ',screenY=' + iY + ',left=' + iX + ',top=' + iY +
					',width=' + iWidth + ',height=' + iHeight +
					',dialogWidth=' + iWidth + 'px,dialogHeight=' + iHeight + 'px';

	if (bDialog) {
		sProperties = replace(sProperties, ',', ';');
		window.showModalDialog(sUrl, sName, sProperties);
	} else {
		window.open(sUrl, sName, sProperties);	
	}
}
function popupLink(sLink){
	window.opener.location = sLink;
	window.close();
}
function checkAll(oMaster, oGroup){
	if(oGroup && oGroup.length) {
   	for(var i=0; i < oGroup.length; i++) {
   		oGroup[i].checked = oMaster.checked;
   	}
   } else if(oGroup) {
   	oGroup.checked = oMaster.checked;
   }
}
function checkMaster(oMaster, oCheck){
	oGroup = eval('oCheck.form.' + oCheck.name);

	if(oGroup.length) {
   	for(var i=0; i < oGroup.length; i++) {
   		if(!oGroup[i].checked) {
   			checkAll(oGroup[i], oMaster)
   			return true;
   		}
   	}
   	
   	checkAll(oGroup[i - 1], oMaster)
   } else {
   	oMaster.checked = oGroup.checked;
   }
}
function refresh(){
	window.location.reload();
}
function listAdd(oList, oText) {
	var aValues = oText.value.split('\n');
	
	for(i = 0; i <  aValues.length; i++) {
		if(isFilled(aValues[i].replace('\r', '')))
      	oList.options[oList.options.length] = new Option(aValues[i].replace('\r', ''), 'new');
	}
	
	oText.value = ''
	oText.focus();
}
function listJump(oForm, iIndex, iDifference) {
	var oFrom_list = oForm.elements[iIndex];
	var oTo_list = oForm.elements[iIndex + iDifference];
	
	if (oFrom_list.options && oTo_list.options) {
		oTo_list.options[oTo_list.options.length] = new Option(oFrom_list[oFrom_list.selectedIndex].text, oFrom_list[oFrom_list.selectedIndex].value);
		oTo_list.selectedIndex = oTo_list.options.length - 1;
		
		oFrom_list[oFrom_list.selectedIndex] = null;
	}
}
function listDelete(oList, sRecord) {
	if(oList.selectedIndex >= 0) {
		sRecord.value += oList.options[oList.selectedIndex].value + '|||||'

		for(i = oList.selectedIndex; i < oList.options.length -1; i++) {
			oList.options[i].value = oList.options[i + 1].value;
			oList.options[i].text = oList.options[i + 1].text;
		}
		
		oList.options.length -= 1;
	}
}
function listMove(oList, iDifference) {
	var iSelected = oList.selectedIndex;
	
	if(iSelected + iDifference >= 0 && iSelected + iDifference < oList.length && iSelected != -1){
		var sTmpValue1 = oList.options[iSelected].value;
		var sTmpValue2 = oList.options[iSelected].text;
			
		oList.options[iSelected].value = oList.options[iSelected + iDifference].value;
		oList.options[iSelected].text = oList.options[iSelected + iDifference].text
		
		oList.options[iSelected + iDifference].value = sTmpValue1;
		oList.options[iSelected + iDifference].text = sTmpValue2;
		
		oList.selectedIndex = oList.selectedIndex + iDifference
	}
}
function listPost(oList, sValue, sText, sDelete) {
	sValue.value = '';
	sText.value = '';

	for(i = 0; i < oList.options.length; i++) {
		sValue.value += oList.options[i].value + '|||||';
		sText.value += oList.options[i].text + '|||||';
	}
	
	if (sValue.value.length > 5)
		sValue.value = sValue.value.substr(0, sValue.value.length -5);
	if (sText.value.length > 5)
		sText.value = sText.value.substr(0, sText.value.length -5);
	if (sDelete.value.length > 5)
		sDelete.value = sDelete.value.substr(0, sDelete.value.length -5);
}
function listEdit(oList, sLink) {
	if(oList.selectedIndex >= 0 && oList.options[oList.selectedIndex].value != 'new')
		document.location = sLink + oList.options[oList.selectedIndex].value;
}
function radioSelect(oRadio, sValue) {
	for(var i = 0; i < oRadio.length; i++){
		if(oRadio[i].value == sValue)
			oRadio[i].checked = true;
		else
			oRadio[i].checked = false;
	}
}
function checkForm(theform) {
	var sQuestion_tag = 'q_id_';
	var sOther_answer_tag = 'o_q_id_';
	var iQuestion_id;
	
	for(var i = 0; i < theform.elements.length; i++) {
		if(theform.elements[i].getAttribute('editor') == 'True') {
			//alert(getEditor(theform.elements[i].name));
			theform.elements[i].value = getEditor(theform.elements[i].name);
			breakItUp(theform.elements[i]);
		}
		if(theform.elements[i].getAttribute('validate') == 'True') {
			switch(theform.elements[i].type) {
			case 'checkbox':
			case 'radio':
   			if(theform.elements[i].getAttribute('required') == 'True') {
   				if(!isRadioChecked(eval('theform.' + theform.elements[i].name))) {
   					return false;
   				}
   			}
				
				break
			case 'select-one':
			case 'select-multiple':
				if(isFilled(theform.elements[i].getAttribute('list'))) {
					var sTag = theform.elements[i].getAttribute('list');
					
					eval('listPost(theform.' + sTag + '_list, theform.' + sTag + '_value, theform.' + sTag + '_text, theform.' + sTag + '_delete)');
				}
				
   			if(theform.elements[i].getAttribute('required') == 'True') {
   				if(theform.elements[i].selectedIndex == -1 || eval('theform.' + theform.elements[i].name + '[' + theform.elements[i].selectedIndex + '].value') == '') {
   					alert('Please select a "' + theform.elements[i].getAttribute('title') + '".');
   					
   					return false;
   				}
   			}
				
				break
			case 'hidden':
   			if(theform.elements[i].getAttribute('group') == 'True') { 
   				aTags = theform.elements[i].value.split(',');
   				
   				aValues = new Array(aTags.length)
   				
   				for(var j = 0; j < aTags.length; j++) {
   					oElement = eval('theform.' + aTags[j])
   					
   					switch(oElement.type) {
   					case undefined:
      					for(var x = 0; x < oElement.length; x++) {
      						if(oElement[x].checked) {
      							aValues[j] = oElement[x].value;
      							
      							break;
      						}
      					}
      					
      					break;
      				case 'select-one':
      				case 'select-multiple':
      					if(oElement[oElement.selectedIndex].value.substring(0, '|||||a_id_other'.length) == '|||||a_id_other') {
                     	iQuestion_id = oElement.name.substring(sQuestion_tag.length, oElement.name.length);
                     	
                     	aValues[j] = eval('theform.' + sOther_answer_tag + iQuestion_id + '.value');
      					} else if(isFilled(oElement[oElement.selectedIndex].value)) {
     							aValues[j] = oElement[oElement.selectedIndex].text;
     						}
      					
      					break;
      				}      					

   					if((aValues[j] == undefined || aValues[j] == '') && theform.elements[i].getAttribute('required') == 'True') {
   						alert('Please provide an answer to all the "' + theform.elements[i].getAttribute('title') + '" fields.');
   							
   						return false;
   					}
   					
   					if(theform.elements[i].getAttribute('exclusive') == 'True') {
      					for(var k = 0; k < j; k++) {
      						if(aValues[k] == aValues[j] && aValues[k] != undefined && aValues[k] != '' && aValues[k] != '|||||a_id_other|||||a_other' && isFilled(aValues[k])) {
      							alert('Please make sure that all the "' + theform.elements[i].getAttribute('title') + '" fields are different.');
      							
      							return false;
      						}
      					}
      				}
   				}
   			}
   			
   			if(theform.elements[i].getAttribute('date') == 'True') {
   				if (theform.elements[i].getAttribute('validate').toLowerCase == 'True'.toLowerCase && !isDate(eval('theform.' + theform.elements[i].name + '_day.value'), eval('theform.' + theform.elements[i].name + '_month.value'), eval('theform.' + theform.elements[i].name + '_year.value'))){
						alert('Please make sure that the "' + theform.elements[i].getAttribute('title') + '" date is valid.');
						
						return false;   					
   				}
   				theform.elements[i].value = eval('theform.' + theform.elements[i].name + '_year.value') + '-' + eval('theform.' + theform.elements[i].name + '_month.value') + '-' + eval('theform.' + theform.elements[i].name + '_day.value') 
   			}
   						
				break
			case 'text':
			case 'textarea':
				if(!isInValidString(theform.elements[i].value, '|')) {
					alert('The "' + theform.elements[i].getAttribute('title') + '" field cannot contain |.');
					
					return false;
				}				
				
   			//Required
   			if(theform.elements[i].getAttribute('required') == 'True') {
   				if(!isFilled(theform.elements[i].value)) {
   					alert('Please provide an answer in the "' + theform.elements[i].getAttribute('title') + '" field.');
   					
   					return false;
   				}
   			}
   
   			//Email
   			if(theform.elements[i].getAttribute('email') == 'True') {
   				if(!isEmail(theform.elements[i].value)) {
   					alert('Please make sure that the "' + theform.elements[i].getAttribute('title') + '" field is a valid email address.');
   					
   					return false;
   				}
   			}
   			
   			//Numeric
   			if(theform.elements[i].getAttribute('number') == 'True') {
   				if(!(isNumeric(theform.elements[i].value) || (theform.elements[i].getAttribute('required') != 'True' && !isFilled(theform.elements[i].value)))) {
   					alert('Please make sure that the "' + theform.elements[i].getAttribute('title') + '" field is numeric.');
   					
   					return false;
   				}
   			}
   
   			//Length min
   			if(isFilled(theform.elements[i].getAttribute('length_min'))) {
   				if(theform.elements[i].value.length < theform.elements[i].getAttribute('length_min')) {
   					alert('The "' + theform.elements[i].getAttribute('title') + '" field needs to be more than ' + theform.elements[i].getAttribute('length_min') + ' characters.');
   					
   					return false;
   				}
   			}
   			
   			//Length max
   			if(isFilled(theform.elements[i].getAttribute('length_max'))) {
   				if(theform.elements[i].value.length > theform.elements[i].getAttribute('length_max')) {
   					alert('The "' + theform.elements[i].getAttribute('title') + '" field needs to be less than ' + theform.elements[i].getAttribute('length_max') + ' characters.');
   					
   					return false;
   				}
   			}
   				
   			//More than
   			if(isFilled(theform.elements[i].getAttribute('more_than'))) {
   				if(parseFloat(theform.elements[i].value) < theform.elements[i].getAttribute('more_than')) {
   					alert('The "' + theform.elements[i].getAttribute('title') + '" field needs to be more than ' + theform.elements[i].getAttribute('more_than') + '.');
   					
   					return false;
   				}
   			}
   			
   			//Less than
   			if(isFilled(theform.elements[i].getAttribute('less_than'))) {
   				if(parseFloat(theform.elements[i].value) > theform.elements[i].getAttribute('less_than')) {
   					alert('The "' + theform.elements[i].getAttribute('title') + '" field needs to be less than ' + theform.elements[i].getAttribute('less_than') + '.');
   					
   					return false;
   				}
   			}
			}
		}
	}

	//return confirm('Form valid. Continue?');
	return true;
}
function help(iHelp_page_id) {
	openWindowMove('/oscar/help/page.asp?h_p_id=' + iHelp_page_id, '_help', 'scrollbars=yes,resizable=yes', '300', '400', 'right', 'top');
}
function otherUpdate(oText, sType) {
	if(isFilled(oText.value)) {
   	var sQuestion_tag = 'q_id_';
   	var sOther_answer_tag = 'o_q_id_';
   	var iQuestion_id = oText.name.substring(sOther_answer_tag.length, oText.name.length);
   	var oParent = eval('oText.form.' + sQuestion_tag + iQuestion_id);
   	
   	switch(sType) {
   	case 'radio':
   		for(var i=0; i < oParent.length; i++) {
   			if(oParent[i].value == '|||||a_id_other|||||a_other')
   				oParent[i].checked = true;
   			else
   				oParent[i].checked = false;
   		}
   		break
   	case 'checkbox':
   		for(var i=0; i < oParent.length; i++) {
   			if(oParent[i].value == '|||||a_id_other|||||a_other')
   				oParent[i].checked = true;
   		}
   		break
   	case 'select':
   		oParent.selectedIndex = oParent.length - 1;
   		
   		break
   	}
   }
}
function insertFile(oField, sRoot, sDefault_path, oTarget_image) {
	var sPath;
	
	if (oField.value != '')
		sPath = oField.value;
	else
		sPath = sDefault_path;
			
	var sImage = window.showModalDialog('/editor/file/default.asp?root=' + sRoot + '&path=' + sPath, '_file_manager', 'status=no;scrollbars=auto;resizable=no;dialogWidth=700px;dialogHeight=450px;center=yes');

	if(sImage != null && sImage != "") {
		oField.value = unescape(sImage);
		
		if(oTarget_image != null && oTarget_image != undefined) {
			oTarget_image.src = '/' + sRoot + sImage;
		}
	}
}
function insertColour(oField) {
	var sNon_hex;
	
	if (oField.value.length > 0) {
		sNon_hex = oField.value.substring(1, oField.value.length);
	}

	var sColour = window.showModalDialog('colour_wheel.asp?colour=' + sNon_hex, '_colour_wheel', 'status=no;scrollbars=auto;resizable=no;dialogWidth=276px;dialogHeight=331px;center=yes');

	if(sColour != null && sColour != '') {
		oField.value = unescape(sColour);
	}
}
function removeFile(oField, oTarget_image) {
	oField.value = '';
	
	if(oTarget_image != null && oTarget_image != undefined) {
		oTarget_image.src = '/images/spacer.gif';
	}
}
function replace(string,text,by) {
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}
function clearTextbox(oInput, sText){
	if(oInput.value == sText) {
		oInput.value = '';
	} else if(oInput.value == ''){
		oInput.value = sText;
	}
}
function popupEditor(sName, sFolder) {
	openWindowMove('editor.asp?field_name=' + sName + '&folder=' + sFolder, '_editor', 'scroll:no,status:no', '775', '504', 'middle', 'middle', false);
}	

function popupReturn(sName, sValue) {
   if (sValue != 'undefined') {
   	document.getElementById(sName).value = escape(sValue);
		document.getElementById(sName + '_preview').innerHTML = sValue;
	}
}
function columnsUpdate(oList) {
	var oForm = oList.form;
	
	for(var i = 0; i < oForm.elements.length; i++){
		if (oForm.elements[i].type == 'select-one' && oForm.elements[i] != oList){
			oForm.elements[i].selectedIndex = -1;
		}
	}
	
}

function columnMove(sDirection) {
	var iDifference;
	var oForm = document.columns;
	
	switch(sDirection) {
	case 'up':
	case 'down':
		if (sDirection == 'up')
			iDifference = -1;
		else
			iDifference = 1;
		
   	for(var i = 0; i < oForm.elements.length; i++){
   		if (oForm.elements[i].type == 'select-one' && oForm.elements[i].selectedIndex != -1){
   			listMove(oForm.elements[i], iDifference);
   		}
   	}
   	break;
   case 'left':
   case 'right':
		if (sDirection == 'left')
			iDifference = -1;
		else
			iDifference = 1;
   	
   	for(var i = 0; i < oForm.elements.length; i++){
   		if (oForm.elements[i].type == 'select-one' && oForm.elements[i].selectedIndex != -1){
   			listJump(oForm, i, iDifference);
   			break;
   		}
   	}
   }
}
function checkDuplicate(sTag, oRadio) {
	var oForm = oRadio.form;
	
	for(var i = 0; i < oForm.elements.length; i++) {
		if (oForm.elements[i] != oRadio
		&& oForm.elements[i].name.substring(0, sTag.length) == sTag 
		&& oForm.elements[i].value == oRadio.value) {
			oForm.elements[i].checked = false;
		}
	}
	
	for(var i = 0; i < oForm.elements.length; i++) {
	if (oForm.elements[i] != oRadio
	&& oForm.elements[i].name == oRadio.name) {
		oForm.elements[i].checked = false;
		}
	}

}
function updateVidiprinter(oVidiprinter, sMessage) {
	oVidiprinter.innerHTML += unescape(sMessage);
	
	parent.vidiprinter_frame.scrollTo(0, 100000000);
	
	//oVidiprinter.clip.top += iPixels;
	//.clip.bottom += iPixels;
	//oVidiprinter.scrollTo(0, 100000);
	
	//oVidiprinter.scrollBy(0, 100000);	
}
function changeDot(oImage, oForm) {
	var oElement, iValue, sName
	sName
	var aImages = new Array(2);
	
	aImages[0] = 'images/dot_red.gif';
	aImages[1] = 'images/dot_yellow.gif';
	aImages[2] = 'images/dot_green.gif';
	
	sName = oImage.name.substring(3, oImage.name.length);
	oElement = eval('oForm.frm' + sName);
	
	iValue = oElement.value;
	iValue = (iValue + 1) % 3;
	
	oImage.src = aImages[iValue];
	oElement.value = iValue;
	
	if (iValue == 2)
		checkDuplicateDots(oImage, oElement, aImages);
}

function checkDuplicateDots(oImage, oElement, aImages) {
	var sName = oElement.name;
	var oForm = oElement.form;
	
	sName = sName.substring(0, sName.indexOf('_'));
	
	for(var i = 0; i < oForm.elements.length; i++) {
		if (oForm.elements[i] != oElement
		&& oForm.elements[i].name.substring(0, sName.length) == sName
		&& oForm.elements[i].value == '2') {
			eval('document.all(\'img' + oForm.elements[i].name.substring(3, oForm.elements[i].name.length) + '\').src = aImages[1]');
			elements[i].value = 1;
		}
	}
}

//Example: <select id="select_name" name="select_name" onkeypress="listbox_onkeypress();" onblur="listbox_onblur();">
var toFind = ""; // keyboard buffer
var timeoutID = ""; // process id for timer - when stopping the timeout
var timeoutInterval = 500; // milliseconds - keyboard buffer
var timeoutCtr = 0; // initialise of timer countdown
var timeoutCtrLimit = 3; // number of times timer is allowed to count down
var oControl = ""; // maintains a global reference to the user control

function listbox_onkeypress(){
	window.clearInterval(timeoutID)
	oControl = window.event.srcElement;
	var keycode = window.event.keyCode;

	if(keycode >= 32 ){
		var c = String.fromCharCode(keycode);
		c = c.toUpperCase();
		toFind += c ;
		find(); // search the listbox
		timeoutID = window.setInterval("idle()", timeoutInterval); // restart the timer
	}
}

function listbox_onblur(){ // function is called when user leaves listbox
	window.clearInterval(timeoutID);
	resetToFind();
}

function idle(){ // function is called if timeout expires - 3rd time stops timer and clear kb buffer
	timeoutCtr += 1

	if(timeoutCtr > timeoutCtrLimit){
		resetToFind();
		timeoutCtr = 0;
		window.clearInterval(timeoutID);
	}
}

function resetToFind(){
	toFind = ""
}

function find(){
	var allOptions = document.all.item(oControl.id);

	for (i=0; i < allOptions.length; i++){
		nextOptionText = allOptions(i).text.toUpperCase();

		if(!isNaN(nextOptionText) && !isNaN(toFind) ){
			nextOptionText *= 1;
			toFind *= 1;
		}

		if(toFind == nextOptionText){
			oControl.selectedIndex = i;
			window.event.returnValue = false;
			break;
		}

		if(i < allOptions.length-1){
			lookAheadOptionText = allOptions(i+1).text.toUpperCase();

			if( (toFind > nextOptionText) && (toFind < lookAheadOptionText) ){
				oControl.selectedIndex = i+1;
				window.event.cancelBubble = true;
				window.event.returnValue = false;
				break;
			}
		} else {
			if(toFind > nextOptionText){
				oControl.selectedIndex = allOptions.length-1
				window.event.cancelBubble = true;
				window.event.returnValue = false;
				break;
			}
		}
	}
}

function confirmGo(sMessage, sURL) {
	if (confirm(sMessage))
		window.location = sURL;
}

function printPage(sURL) {
	openWindowMove(sURL + '&print=True', 'print', 'toolbar=yes,scrollbars=yes', '700', '500', 'middle', 'middle', false);
}
function setEditor(sName, sValue) {
	frames[sName + '_frame'].frames['RadEContentIframeeditor_body'].document.body.innerHTML = unescape(sValue);
}
function getEditor(sName) {
	return frames[sName + '_frame'].frames['RadEContentIframeeditor_body'].document.body.innerHTML;
}
function breakItUp(oTextarea) {
	//Set the limit for field size.
	var iFormLimit = 102399;
	
	var sValue = new String;
	sValue = oTextarea.value;
	
	if (sValue.length > iFormLimit) {
		oTextarea.value = sValue.substr(0, iFormLimit)
		sValue = sValue.substr(iFormLimit)
	
		while (sValue.length > 0) {
			var oNewTextarea = document.createElement("TEXTAREA");
			oNewTextarea.name = oTextarea.name;
			oNewTextarea.value = sValue.substr(0, iFormLimit);
			oTextarea.form.appendChild(oNewTextarea);
			
			sValue = sValue.substr(iFormLimit)
		}
	}
}
function setVisibility(id, visibility) {
    document.getElementById(id).style.display = visibility;
}
function newWindow(mypage,myname,w,h,features) {
  var win = null;
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(mypage,myname,settings);
  win.window.focus();
}  


