function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}


ihome=document.getElementById("i-home");
isearch=document.getElementById("i-search");
ifeedback=document.getElementById("i-feedback");

if(ihome!=null) {ihome.onmouseover=function(){setActive("home");}
ihome.onmouseout=function(){setPassive("home");}}
if(isearch!=null) {isearch.onmouseover=function(){setActive("search");}
isearch.onmouseout=function(){setPassive("search");}}
if(ifeedback!=null) {ifeedback.onmouseover=function(){setActive("feedback");}
ifeedback.onmouseout=function(){setPassive("feedback");}}

function setActive(elName){
   var el=document.getElementById("i-"+elName);
   el.src="/i/i-"+elName+"-hover.gif";
}

function setPassive(elName){
   var el=document.getElementById("i-"+elName);
   el.src="/i/i-"+elName+".gif";
}

/*
 * 20.06.2005 17:27
 * InputPlaceholder Class v 0.1a
 *
 * 30.06.2005 20:36
 * InputPlaceholder Class v 0.1b
 *
 * 01.07.2005 18:30
 * InputPlaceholder Class v 0.1c
 */

/* Методы:
 *    отсутствуют
 *
 * Свойства
 *    Input       Элемент формы, с которым работаем
 *    Value       Значение надписи по умолчанию
 *    CssFilled      Имя css-класса для отображения заполненого поля
 *    CssEmpty    Имя css-класса для отображения пустого поля
 */

/* Конструктор
 * Параметры:
 *    input       Элемент формы ( input[@type='text'] ), с которым работаем
 *    value       Значение надписи по умолчанию, т. е. тот самый placeholder
 *    cssFilled      Имя css-класса для отображения заполненого поля (применяется к input)
 *    cssEmpty    Имя css-класса для отображения пустого поля (применяется к input)
 */
/*
   Я не машина, я просто читаю исходники.
*/
function InputPlaceholder (input, value, cssFilled, cssEmpty)
{
   var thisCopy = this

   this.Input = input
   this.Value = value
   this.SaveOriginal = (input.value == value)
   this.CssFilled = cssFilled
   this.CssEmpty = cssEmpty

   this.setupEvent (this.Input, 'focus', function() {return thisCopy.onFocus()})
   this.setupEvent (this.Input, 'blur',  function() {return thisCopy.onBlur()})
   this.setupEvent (this.Input, 'keydown', function() {return thisCopy.onKeyDown()})

   if (input.value == '') this.onBlur();

   return this
}

InputPlaceholder.prototype.setupEvent = function (elem, eventType, handler)
{
   if (elem.attachEvent)
   {
      elem.attachEvent ('on' + eventType, handler)
   }

   if (elem.addEventListener)
   {
      elem.addEventListener (eventType, handler, false)
   }
}

InputPlaceholder.prototype.onFocus = function()
{
   if (!this.SaveOriginal &&  this.Input.value == this.Value)
   {
      this.Input.value = ''
   }
   else
   {
         this.Input.className = ''
   }
}

InputPlaceholder.prototype.onKeyDown = function()
{
   this.Input.className = ''
}

InputPlaceholder.prototype.onBlur = function()
{
   if (this.Input.value == '' || this.Input.value == this.Value)
   {
      this.Input.value = this.Value
      this.Input.className = this.CssEmpty
   }
   else
   {
      this.Input.className = this.CssFilled
   }
}


function SetNRBL_RightCSS(uid) 
{
    window.userUID = uid;
    UpdateUserUIDIputField(uid)

    var options = { path: '/', domain: 'leaderinfo.org', expires: 10000 };
    $.cookie("userUID", uid, options);

    var options = { path: '/', domain: 'www.leaderinfo.org', expires: 10000 };
    $.cookie("userUID", uid, options);
}

function UpdateUserUIDIputField(uid) {
    $(".userUID").attr("value", uid);
}


if(typeof String.prototype.trim !== 'function') {
  String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/g, ''); 
  }
}
