function checkSearch(str) {
  if (str.value.match(/поиск/i)) {
    alert('Задан пустой поисковый запрос. Укажите фразу для поиска');
    str.focus();
    return false;
  }
  return true;
}


function clearSearch(obj) {
	 if (obj.value.match(/поиск/i))
		  obj.value = '';
}

 	
function getCookie(c_name)
{
   if (document.cookie.length>0)
      {
      var c_start;
      var c_end;
      c_start=document.cookie.indexOf(c_name + "=");
      if (c_start!=-1)
        { 
        c_start=c_start + c_name.length+1; 
        c_end=document.cookie.indexOf(";",c_start);
        if (c_end==-1) c_end=document.cookie.length;
        return unescape(document.cookie.substring(c_start,c_end));
        } 
      }
   return "";
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function checkCookies() {
    setCookie('checkCookies','true');
    var cookie = getCookie('checkCookies');
    if (cookie == 'true')
       return true;
    else
       return false;
    cookie = null;
}

function getPageScroll() {
   var xScroll, yScroll;
   if (self.pageYOffset) {
      yScroll = self.pageYOffset;
      xScroll = self.pageXOffset;
   } else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
      yScroll = document.documentElement.scrollTop;
      xScroll = document.documentElement.scrollLeft;
   } else if (document.body) {// all other Explorers
      yScroll = document.body.scrollTop;
      xScroll = document.body.scrollLeft;	
   }
   return new Array(xScroll,yScroll);
}

function getPageHeight() {
    var windowHeight;
    if (self.innerHeight) {	// all except Explorer
      windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
      windowHeight = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
      windowHeight = document.body.clientHeight;
    }	
    return windowHeight;
}


function setVisitorPos() {
  var yscroll = getPageScroll()[1];
  if ($.browser.msie && ($.browser.version < 7)) {
     $("#visitor").css('position', 'absolute');
     $("#visitor").css('top', (getPageHeight()+yscroll) - $("#visitor").outerHeight());
  }
}

$(function() { 
   $(window).load(setVisitorPos);
   $(window).resize(setVisitorPos);
   $(window).scroll(setVisitorPos);
})

