function getInternetExplorerVersion(){
  var rv = -1;
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}
function isInternetExplorer(){
	var browserName=navigator.appName; 
	if (browserName=="Microsoft Internet Explorer")
		return true;
 	else
		return false;
}
function changeCaptcha(idToUpdate, pageUrl) {
	var req = new Request.HTML({url:pageUrl, 
		onSuccess: function(html) {
			$(idToUpdate).set('text', '');
			$(idToUpdate).adopt(html);
		}
	});
	req.send();
}
function makeScrollbar(content,scrollbar,handle,horizontal,ignoreMouse){
	var steps = (horizontal?(content.getScrollSize().x - content.getSize().x):(content.getScrollSize().y - content.getSize().y))
	var slider = new Slider(scrollbar, handle, {	
		steps: steps,
		mode: (horizontal?'horizontal':'vertical'),
		onChange: function(step){
			var x = (horizontal?step:0);
			var y = (horizontal?0:step);
			content.scrollTo(x,y);
		}
	}).set(0);
	if( !(ignoreMouse) ){
		$$(content, scrollbar).addEvent('mousewheel', function(e){	
			e = new Event(e).stop();
			var step = slider.step - e.wheel * 30;	
			slider.set(step);					
		});
	}
	$(document.body).addEvent('mouseleave',function(){slider.drag.stop()});
}
function imgHover(id,tag){
      var sfEls = $(id).getElementsByTagName(tag);
      for (var i=0; i<sfEls.length; i++) {
            sfEls[i].onmouseover=function() {  
                  if (this.className.search("rollOver")>=0){
                        if (this.src.search("jpg")>=0){
                             this.src=this.src.replace('.jpg','_a.jpg');
                        }else if (this.src.search("png")>=0){
                             this.src=this.src.replace('.png','_a.png');
                        }else{
                             this.src=this.src.replace('.gif','_a.gif');
                        }
                  }
            }
            sfEls[i].onmouseout=function() {
                  if (this.className.search("rollOver")>=0){
                        if (this.src.search("jpg")>=0){
                             this.src=this.src.replace('_a.jpg','.jpg');
                        }else if (this.src.search("png")>=0){
                             this.src=this.src.replace('_a.png','.png');
                        }else{
                             this.src=this.src.replace('_a.gif','.gif');
                        }
                  }
            }
      }
}

function goToPage(link,type){
	if (type == "page" && link != ""){
		document.location.href = link;
	}
	else if (type == "video" && link != ""){
		Mediabox.open(link,'','');
	}
}
