
function keypressAlphaNum()
{
  return;
  if (event.keyCode == 13) return true;
  var vchar = String.fromCharCode(event.keyCode);
  var vupper = vchar.toUpperCase();
  var vvalid = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
  var vpos = vvalid.indexOf(vupper);
  if(vpos < 0) {
    event.returnValue = false;
  }
}

function keypressFileName()
{
  var vchar = String.fromCharCode(event.keyCode);
  var vupper = vchar.toUpperCase();
  var vvalid = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890 _";
  var vpos = vvalid.indexOf(vupper);
  if(vpos < 0) {
    event.returnValue = false;
  }
}

function ok2logoff()
{
  if (confirm("Are you sure you want to logoff?")) return true; else return false;
}

function PublishStyles()
{
  if (confirm("Are you sure you want to publish styles?")) {
    return true;
  } else {
    return false;
  }
}

function DiscardChanges()
{
  if (confirm("Are you sure you want to discard all changes since last published?")) {
    return true;
  } else {
    return false;
  }
}

function DeleteSection()
{
  if (confirm("Are you sure you want to delete the section and all columns in the section?")) {
    return true;
  } else {
    return false;
  }
}

function DeleteNewsletter(name)
{
  if (confirm("Are you sure you want to delete the newsletter'" + name + "' and all associated issues and subscribers?")) {
    return true;
  } else {
    return false;
  }
}

function DeleteColumn()
{
  if (confirm("Are you sure you want to delete the column and all items in the column?")) {
    return true;
  } else {
    return false;
  }
}

function DeleteItem()
{
  if (confirm("Are you sure you want to delete the item?")) {
    return true;
  } else {
    return false;
  }
}

function DeleteStyle()
{
  if (confirm("Are you sure you want to delete the style?")) {
    return true;
  } else {
    return false;
  }
}

function DeleteFile()
{
  if (confirm("Are you sure you want to delete the file?")) {
    return true;
  } else {
    return false;
  }
}

function DeleteUser()
{
  if (confirm("Are you sure you want to delete the user?")) {
    return true;
  } else {
    return false;
  }
}

function DeleteHMenuItem()
{
  if (confirm("Are you sure you want to delete the horizontal menu item?")) {
    return true;
  } else {
    return false;
  }
}

function DeleteVMenuItem()
{
  if (confirm("Are you sure you want to delete the vertical menu item?")) {
    return true;
  } else {
    return false;
  }
}

function DeleteSubItem()
{
  if (confirm("Are you sure you want to delete the item from the list?")) {
    return true;
  } else {
    return false;
  }
}

function DeleteTableItem()
{
  if (confirm("Are you sure you want to delete the table row?")) {
    return true;
  } else {
    return false;
  }
}

function DeletePhotoItem()
{
  if (confirm("Are you sure you want to delete the photo?")) {
    return true;
  } else {
    return false;
  }
}

function DeleteImageItem()
{
  if (confirm("Are you sure you want to delete the image?")) {
    return true;
  } else {
    return false;
  }
}

function DeleteTabItem()
{
  if (confirm("Are you sure you want to delete the tab?")) {
    return true;
  } else {
    return false;
  }
}

function DeleteFormField()
{
  if (confirm("Are you sure you want to delete the form field?")) {
    return true;
  } else {
    return false;
  }
}

function DeleteEvent()
{
  if (confirm("Are you sure you want to delete the event?")) {
    return true;
  } else {
    return false;
  }
}

function DeleteEventSeries()
{
  if (confirm("Are you sure you want to delete all repeating events in the series?")) {
    return true;
  } else {
    return false;
  }
}

function SyncFieldName()
{
  if (document.form1.ucFieldName_txtValue.value == "") document.form1.ucFieldName_txtValue.value = document.form1.ucLabelText_txtValue.value;
}

function CloseWindow()
{
  window.close();
}

function UploadFile() {
  var sOpt = "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=640,height=480"
  var oWin = window.open("/Pages/FileUpload.aspx", "upload", sOpt);
  oWin.focus();
}

function ShowEditor(ele) {
  var sOpt = "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=640,height=480"
  var oWin = window.open("/Tools/Editor.htm", "editor", sOpt);
  if ( oWin != null) {
    oWin.editElement = ele.name;
    oWin.opener = self;
    if (oWin.initEditor) oWin.initEditor();
    oWin.focus();
  }
}

function ShowColorPicker(ele) {
  var sOpt = "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=512,height=400"
  var oWin = window.open("/Tools/ColorPicker.htm", "color", sOpt);
  if ( oWin != null) {
    oWin.editElement = ele;
    oWin.opener = self;
    oWin.focus();
  }
}

function ShowFontSizePicker(ele) {
  var sOpt = "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=400,height=300"
  var oWin = window.open("/Tools/FontSizePicker.aspx", "fontsize", sOpt);
  if ( oWin != null) {
    oWin.editElement = ele;
    oWin.opener = self;
    oWin.focus();
  }
}

function ShowStyleNamePicker(ele) {
  var sOpt = "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=500,height=300"
  var oWin = window.open("/Tools/StyleNamePicker.aspx", "stylename", sOpt);
  if ( oWin != null) {
    oWin.editElement = ele;
    oWin.opener = self;
    oWin.focus();
  }
}

function ShowFontFamilyPicker(ele) {
  var sOpt = "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=500,height=400"
  var oWin = window.open("/Tools/FontFamilyPicker.aspx", "fontfamily", sOpt);
  if ( oWin != null) {
    oWin.editElement = ele;
    oWin.opener = self;
    oWin.focus();
  }
}

function ShowSizePicker(ele) {
  var sOpt = "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=400,height=200"
  var oWin = window.open("/Tools/SizePicker.aspx", "size", sOpt);
  if ( oWin != null) {
    oWin.editElement = ele;
    oWin.opener = self;
    oWin.focus();
  }
}

function ShowBorderPicker(ele) {
  var sOpt = "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=400,height=300"
  var oWin = window.open("/Tools/BorderPicker.aspx", "border", sOpt);
  if ( oWin != null) {
    oWin.editElement = ele;
    oWin.opener = self;
    oWin.focus();
  }
}

function ShowImagePicker(ele) {
  var sOpt = "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=400,height=425"
  var oWin = window.open("/Tools/ImagePicker.aspx", "image", sOpt);
  if ( oWin != null) {
    oWin.editElement = ele;
    oWin.opener = self;
    oWin.focus();
  }
}

function ShowFilePicker(ele) {
  var sOpt = "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=512,height=500"
  var oWin = window.open("/Tools/FilePicker.aspx", "file", sOpt);
  if ( oWin != null) {
    oWin.editElement = ele;
    oWin.opener = self;
    oWin.focus();
  }
}

function ShowHelp(href) {
  var sOpt = "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=400,height=600,left=0,top=0"
  var oWin = window.open(href, "help", sOpt);
  if ( oWin != null) {
    oWin.focus();
  }
}

function GetImage(src) {var image = new Image(); image.src = src; return image;}
function GetImageSrc(imageArray, index) {return(imageArray[index].src)}
function GetRandomIndex(low, high) {var range = high - low + 1; return Math.floor(Math.random() * range) + low;}
function GetNextIndex(current, total) {return (current + 1) % total;}

function GetElementById(id)
{
  if (window.document.getElementById) return window.document.getElementById(id);
  if (window.document.all) return window.document.all[id];
  if (window.document.layers) return window.document.layers[id];
}

function GetElementByDocId(doc, id)
{
  alert(id);
  //if (doc.getElementById) return doc.getElementById(id);
  //if (doc.all) return doc.all[id];
  //if (doc.layers) return doc.layers[id];
}