window.addEvent('domready',function(){
  if(Browser.Engine.trident4){
    $$('.transparent').each(function(elem){
      img = elem.getStyle('backgroundImage').match(/url\(([^)]+)\)/)[1]
      elem.style.backgroundImage = ''
      elem.setStyle('filter',"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+img+"', sizingMethod='crop')")      
    })
    
    $$('ul.cats li').each(function(e){
        e.addEvent('mouseenter',function(ev){ this.addClass('hover') })
        e.addEvent('mouseleave',function(ev){ this.removeClass('hover') })
    })
  }
  $$('a.ip-camera-link').addEvent('click',function(ev){
    new Event(ev).preventDefault()
    window.open(this.href, 'IPCamera', 'width=800, height=600');
  })
  
  if(country_switch = $('country_switch'))
    country_switch.addEvent('change',function(){
      window.location = 'http://'+this.value
    })
  
  if(home = $('home_banner')){
    banner = new Swiff('/images/home_banner.swf',{width:'100%', height:'330px',vars:{ slogan:Slogan},properties:{wmode:'opaque'}})
    
    home.adopt(banner)
  }
  
  if(home_cam = $('home_camera')){
    cam = new Swiff('/images/ip-cam.swf',{width:'100%', height:'115px', vars: {flash:IpCamera.flash, scroller:IpCamera.scroller}, properties:{wmode:'transparent'}})
    home_cam.adopt(cam)
  }
  
  if(forgotten_pass = $('forgotten_pass')){
    forgotten_pass.addEvent('click', function(ev){
      new Event(ev).preventDefault()
      var username = window.prompt(ForgottenPass)
      
      if(username)window.location = this.get('href').replace('noname',username)
    })
  }
})