/* Javascript - Sport 2000 */

/***** Index *****/
// 00 - MSC - Rescue
// 10 - MSC - Events
// 20 - Navigations
// 99 - onLoad
/***************/

/***** 00 - MSC - Rescue *****/
function msc_rStart(){
	if(msc_nIe && !msc_nIe7){
		var parent = arguments[0].parentNode;
		var frame = document.createElement('iframe');
		var elem = parent.insertBefore(frame,arguments[0]);
		if(elem){
			elem.className = 'rescue';
			elem.style.position = 'absolute';
			elem.style.left = arguments[0].offsetLeft+'px';
			elem.style.top = arguments[0].offsetTop+'px';
			elem.style.width = arguments[0].offsetWidth+'px';
			elem.style.height = arguments[0].offsetHeight+'px';
			elem.style.filter = 'alpha(opacity=0);';
		}
	}
}
function msc_rEnd(){
	if(msc_nIe && !msc_nIe7){
		var parent = arguments[0].parentNode;
		var frame = msc_c('iframe','rescue',parent)[0];
		var elem = parent.removeChild(frame);
	}
}

/***** 10 - MSC - Events *****/
function msc_eAdd(o,e,f,p){
	var b = "f"+f; b = b.substring(b.indexOf(" "),b.indexOf("("));
	var a  = Array.prototype.splice.call(arguments,4,arguments.length);
	o[e+b] = function(e){ if(o.ev){ a.pop(); } else { o.ev = true; } a.push(e); f.apply(o,a); }
	if(o.attachEvent){ o.attachEvent("on"+e,o[e+b]); } else if(o.addEventListener){ o.addEventListener(e,o[e+b],p); }
}
function msc_eRemove(o,e,f,p){
	var b = "f"+f; b = b.substring(b.indexOf(" "),b.indexOf("("));
	if(o.detachEvent){ o.detachEvent("on"+e,o[e+b]); } else if(o.removeEventListener){ o.removeEventListener(e,o[e+b],p); }
	o.ev = undefined;
}

/***** 20 - Navigations *****/
function nHover(){
	msc_s('add',this,'hover');
}
function nOut(){
	msc_s('del',this,'hover');
}

/*** Permet de voir les png transparent sous ie6 ***/
function hackPng(){
  if (navigator.appVersion.indexOf("MSIE 6")!=-1)
    for (i = 0; i < document.images.length; i++)
      if (document.images[i].src.substring(document.images[i].src.length-3, document.images[i].src.length) == "png") 
      {
        document.images[i].style.height = document.images[i].height + "px";
        document.images[i].style.width = document.images[i].width + "px";
        document.images[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + document.images[i].src + ",sizingMethod='scale')";
        document.images[i].src = "/S2K_Mountain_Root/Includes/Skins/Common/Css/Images/Dots/pix.gif";
      }
}

/***** 99 - onLoad *****/
function wLoad(){
	hackPng();
	
	// 20 - Navigations
	var n = msc_c('div','navigation',msc_o('header'));
	for(var i=0; i<n.length; i++){
		var li = n[i].getElementsByTagName("li");
		for(var j=0; j<li.length; j++){
			li[j].onmouseover = nHover;
			li[j].onmouseout = nOut;
		}
	}
	var l = msc_c('li','language',msc_o('toolbar'));
	for(var i=0; i<l.length; i++){
		l[i].onmouseover = nHover;
		l[i].onmouseout = nOut;
	}
	
}
msc_eAdd(window,"load",wLoad,false);