window.onload = function() { 
	if( document.getElementById( 'search-inp' ) ) {
		document.getElementById( 'search-inp' ).onfocus = function() { if( this.value=='поиск' ) { this.value=''; } };
		document.getElementById( 'search-inp' ).onblur  = function() { if( this.value=='' ) { this.value='поиск'; } };
	}
}

function OpenWin(pageUrl,nameWin,widthWin,heightWin,sbar) {
	hScreen=screen.availHeight; wScreen=screen.availWidth;
	if (widthWin||heightWin) { (widthWin>wScreen)?widthWin=wScreen-200:null; (heightWin>hScreen)?heightWin=hScreen-100:null; }
if (nameWin=="modal") {
	(widthWin)?null:widthWin=wScreen-200; (heightWin)?null:heightWin=hScreen-100;
		pWin="dialogWidth:"+widthWin+"px; "+"dialogHeight:"+heightWin+"px; center:1;help:0;scroll:0;status:0;"
	null_p=window.showModalDialog(pageUrl,"",pWin);
} else {
	(widthWin)?null:widthWin=wScreen-160; (heightWin)?null:heightWin=hScreen-200;
	xPos=(wScreen-widthWin)/2; yPos=(hScreen-heightWin)/2;
	(sbar)?null:sbar=0; (nameWin)?null:nameWin="wintxt";
	pWin="left=200,top=250,width="+widthWin+",height="+heightWin+",scrollbars="+sbar;
	window.open(pageUrl,nameWin,pWin); } }
   
   
function ShowBigImg(imgsrc) {
    if(document.images && document.getElementById('bigimg')) {
      var filter = /(-s)/;
      var newsrc = '';
      if( newsrc = imgsrc.replace( filter, '' ) ) {
         //alert(newsrc);
         document.getElementById('bigimg').src = newsrc;
      }
    }
}

function toggle(obj) {
	var el = document.getElementById(obj);
	el.style.display = (el.style.display != 'none' ? 'none' : '' );
}


function slideSwitch() {
  var $active = $('#flash img.active');
  if ($active.length == 0) $active = $('#flash img:last');
  var $next =  $active.next().length ? $active.next() : $('#slideshow img:first');
  // var $sibs  = $active.siblings();
  // var rndNum = Math.floor(Math.random() * $sibs.length );
  // var $next  = $( $sibs[ rndNum ] );
  $active.addClass('last-active');
  $next.css({opacity: 0.0})
    .addClass('active')
    .animate({opacity: 1.0}, 1000, function() {
        $active.removeClass('active last-active');
  });
}


