// если ссылка содержит путь схожий с тем где сейчас находится броузер, то она получит класс act
base=$('base').attr('href');if(base){$('a').each(function(){if(base.indexOf(this.href)>-1)$(this).addClass('act');});}

// если у таблицы установлен бордер, то применяем к ней оформление
$('table[border=1]').attr('border',0).attr('cellspacing',1).addClass('ntable');

// стандартный input:button
$('input[type=button]:not([class]),input[type=submit]:not([class])').each(function(){
  $(this).wrap('<span>').parent().attr('class','button')
  $(this).focus(function(){
    $(this).blur()
  })
});

// стандартный input:file
$('input:file').wrap('<span>').before('<span>Обзор...</span>').parent().addClass('butfile')
$('input:file').change(function(){
  $(this).parent().css('width',200)
  $(this).parent().find('span').css('width',180).text(this.value.replace(/^.+(\/|\\)/,''))
  $(this).parent().find('input').css('margin','0 0 0 65px')
})

// маркер
if(!$.browser.msie){
  $('input[type="password"][title]').each(function(){
    if(!this.value){
      this.type = 'text'
      this.alt = 'password'
    }else{
      this.alt = 'password'
    }
  })
  $('input[type="text"][title]').each(function(){
    if(this.value == ''){
      $(this).css('color', '#a0a0a0')
      this.value = this.title
    }
  }).focus(function(){
    if(this.value == this.title){
      $(this).css('color', '#000000')
      this.value = ''
      this.type = this.alt
      $(this).focus()
    }
  }).blur(function(){
    if(this.value == ''){
      $(this).css('color', '#a0a0a0')
      this.value = this.title
      this.type = 'text'
    }
  })
  $('form').submit(function(){
    $('input[type="text"][title]').each(function(){
      if(this.value == this.title){
        this.value = ''
      }
    })
  })
}

/**/
len = 0
lens = $('.head2 th img').length
if(lens>1){
	$('.head2').prepend('<h3><img src="css/img/knop.png" /></h3>')
	$('.head2 h3').click(function(){
		$('.head2 th img:eq('+len+')').parent().hide()
		len++
		if(len>=lens){
			len = 0
		}
		$('.head2 th img:eq('+len+')').parent().show()
	})
	$('.head2 th img').parent().hide()
	$('.head2 th img:eq(0)').parent().show()
}

