function getCookie(name) {
        var prefix = name + "="
        var cookieStartIndex = document.cookie.indexOf(prefix)
        if (cookieStartIndex == -1)
                return null
        var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
        if (cookieEndIndex == -1)
                cookieEndIndex = document.cookie.length
        return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
};

function setMyCookie(value) {
 var d = new Date(); d.setDate(d.getDate()+1);
 document.cookie = 'banner='+value+';expires='+d.toGMTString()+';path=/';
};

function setMyCookie(value) {
 var d = new Date(); d.setDate(d.getDate()+1);
 document.cookie = 'banner='+value+';expires='+d.toGMTString()+';path=/';
};

function slideToggle(el, bShow){
  var $el = $(el), height = $el.data("originalHeight"), visible = $el.is(":visible");
  
  // if the bShow isn't present, get the current visibility and reverse it
  if( arguments.length == 1 ) bShow = !visible;
  
  // if the current visiblilty is the same as the requested state, cancel
  if( bShow == visible ) return false;
  
  // get the original height
  if( !height ){
    // get original height
    height = $el.show().height();
    // update the height
    $el.data("originalHeight", height);
    // if the element was hidden, hide it again
    if( !visible ) $el.hide().css({height: 0});
  }

  // expand the knowledge (instead of slideDown/Up, use custom animation which applies fix)
  if( bShow ){
    $el.show().animate({height: height}, {duration: 600});
  } else {
    $el.animate({height: 0}, {duration: 600, complete:function (){
        $el.hide();
      }
    });
  }
};


function email_href(nm) {
var dmn = "urcrm.ru";
document.write('<a href=\"mailto:' + nm + '@' + dmn + '">'+nm+'@'+dmn+'</a>');
};

function wrtEmail(name, text) {
var dmn = "urcrm.ru";
 document.write('<a href="mailto:'+name+'@'+dmn+'">'+ ((text) ? text : name+'@'+dmn) +'</a>');
};

