function center(el){
    el.style.top = f_centeredTop(el.getHeight()) + 'px';
    el.style.left = f_centeredLeft(el.getWidth()) + 'px';
}
function trim(stringtoTrim) {
   return stringToTrim.replace(/^\s+|\s+$/g, "");
}
function ExistsInList(elm, list){
    var len = list.length
    var exists = false;
    for (i =0; i < len; i++){
        if(list[i] == elm)
        {
            exists=true;
            break;
            }
    }
    return exists;

}
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}
function deleteCookie(name, path, domain, secure){
    var date = new Date();
    date.setTime(date.getTime() + (-10 * 24 * 60 * 60 * 1000));
    var expires = date.toGMTString();
    setCookie(name, "", expires, path, domain, secure)
}
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}
function isIE(){
    return /MSIE/.test(navigator.userAgent);
}
function isIE6(){
    return /MSIE\s6.0/.test(navigator.userAgent);
}
function isIE7(){
    return /MSIE\s7.0/.test(navigator.userAgent);
}
function isSafari(){
    return /Safari/.test(navigator.userAgent);
}
function isMac(){
    return /Mac/.test(navigator.platform);
}
function isFF(){
    return /Firefox/.test(navigator.userAgent);
}
function isCtrlKey(e){
    return e.ctrlKey || (isMac() && (e.metaKey || e.keyCode == 91));
}

String.prototype.trim = function(stringtoTrim) {
   return stringToTrim.replace(/^\s+|\s+$/g,"");
}

function trim(stringToTrim) {
    return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function isText(c) {
    var isFunctionKey = (c >= 112 && c < 123);
    return ((c >= 48 && !isFunctionKey) || c == 32 || c == 8 || c == 9 || c == 13 || c == DEL_KEY);
}
var DEL_KEY = 46;
function getCharCode(e){
    return e.charCode ? e.charCode : e.keyCode;
}
function toggleDisplay(el){
    var display = el.style.display;
    if (display == "none") el.show();
    else el.hide();
}