﻿Console=function(){}
Console.WriteLine=function Console$WriteLine(s){
document.write(s+"<br />")}
MathUtility=function(){}
MathUtility.Percentage=function MathUtility$Percentage(amount,percent){
return amount*(percent/100)}
ConvertUtility=function(){}
ConvertUtility.ParseFloat=function ConvertUtility$ParseFloat(s){
return parseFloat(s)}
ConvertUtility.IsFloat=function ConvertUtility$IsFloat(s){
return !isNaN(parseFloat(s))}
ConvertUtility.ToFloat=function ConvertUtility$ToFloat(s,d){
if(ConvertUtility.IsFloat(s)){
return ConvertUtility.ParseFloat(s)}
else{
return d}}
UI=function(){}
UI.Get=function UI$Get(id){
return document.getElementById(id)}
UI.Hide=function UI$Hide(id){
var element=UI.Get(id)
if(element)element.style.display='none'}
UI.Show=function UI$Show(id){
var element=UI.Get(id)
if(element)element.style.display=''}
UI.SetValue=function UI$SetValue(id,value){
var element=UI.Get(id)
if(element)element.value=value}
UI.Clear=function UI$Clear(id){
UI.SetValue(id,'')}
UI.GoToUrl=function UI$GoToUrl(url){
if(!url)url="/"
if(window.event){
var src=window.event.srcElement
if((src.tagName !='A')&&((src.tagName !='IMG')||(src.parentElement.tagName !='A'))){
if(window.event.shiftKey)window.open(url)
else document.location=url}
}else document.location=url}
CheckboxColumnUI=function(){}
CheckboxColumnUI.CheckAll=function CheckboxColumnUI$CheckAll(checkBoxName,checkVal){
var el=document.forms[0].elements
for(count=0;count<el.length;count++){
var nameString=new String(el[count].name)
if(nameString.indexOf(checkBoxName)>-1){
if(!el[count].disabled){
el[count].checked=checkVal}}}}
CheckboxColumnUI.CheckUpperBox=function CheckboxColumnUI$CheckUpperBox(checkBoxName,checkVal){
var el=document.forms[0].elements
elchecked=0
elcount=0
for(count=0;count<el.length;count++){
var nameString=new String(el[count].name)
if(nameString.indexOf(checkBoxName)>-1){
elcount++
if(!el[count].disabled){
if(el[count].checked==true){
elchecked++}}
else{
elchecked++}}}
if(elchecked==elcount-1){
document.getElementsByName(checkBoxName)[0].checked=!document.getElementsByName(checkBoxName)[0].checked}}
TinyMCEUI=function(){}
TinyMCEUI.AddControl=function TinyMCEUI$AddControl(id){
if(document.getElementById(id)){
tinyMCE.execCommand('mceAddControl',false,id)}}
TextAreaUI=function(){}
TextAreaUI.ResolveMaxLength=function TextAreaUI$ResolveMaxLength(id,maxLen,aliasId){
var textArea=UI.Get(id)
if(textArea){
var textAreaValue=textArea.value
var textAreaValueLen=textAreaValue.length
if(textAreaValueLen>maxLen){
textArea.value=textAreaValue.substring(0,maxLen)}
else{
var aliasElement=UI.Get(aliasId)
if(aliasElement){
aliasElement.innerHtml=(maxLen-textAreaValueLen)+' characters left'}}}}


/*hiding & restoring selects in document (to fix bag in IE6.0)*/
var selects = [];
UI.HideSelects = function()
{
    Array.clear(selects);
    var elements = document.getElementsByTagName("select");
    for (var j = 0; j < elements.length; j++)
    {
        var element = new Object();
        element.Id = elements[j].id;
        element.Display = elements[j].style.display;
        elements[j].style.display = 'none';
        
        Array.add(selects, element);
    }
}
UI.RestoreSelects = function()
{
    for (var j = 0; j < selects.length; j++)
    {
        $get(selects[j].Id).style.display = selects[j].Display;
    }
    Array.clear(selects);
}