var cX = 0; var cY = 0; var rX = 0; var rY = 0; var the_posY=0; var the_posX=0;
function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }
function AssignPosition(d) {
if(self.pageYOffset) {
	rX = self.pageXOffset;
	rY = self.pageYOffset;
	}
else if(document.documentElement && document.documentElement.scrollTop) {
	rX = document.documentElement.scrollLeft;
	rY = document.documentElement.scrollTop;
	}
else if(document.body) {
	rX = document.body.scrollLeft;
	rY = document.body.scrollTop;
	}
if(document.all) {
	cX += rX; 
	cY += rY;
	}
the_posX = (cX/2);
the_posY = (cY/2);

}



// JavaScript Document
function limitText(limitField, limitCount, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		limitCount.value = limitNum - limitField.value.length;
	}
}



var speed=10
var stopit=0

function rollon()
{
  var loc = document.getElementById('list_actifs');
  var div = document.getElementById('list_actifs');
  h = div.scrollHeight;
  if(speed > (h-350))
  {
   speed =10;
  }
  if(stopit == 0)
  {
  div.scrollTop = speed;
  speed=speed+1;
  }
  
  
  self.setTimeout('rollon()', 15)
  
}
function scrollstop()
{
	stopit=1;
}
function scrollstart()
{
	stopit=0;
}

function getElementsByName_iefix(tag, name) {
     
     var elem = document.getElementsByTagName(tag);
     var arr = new Array();
     for(i = 0,iarr = 0; i < elem.length; i++) {
          att = elem[i].getAttribute("name");
          if(att == name) {
               arr[iarr] = elem[i];
               iarr++;
          }
     }
     return arr;
}

function returnSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  var result = new Array(myWidth,myHeight);
  return result;
}



function toggle(div_id) {
	var el = document.getElementById(div_id);
	if ( el.style.display == 'none' ) {	el.style.display = 'block';}
	else {el.style.display = 'none';}
}

if(typeof(window.external) != 'undefined'){

//yes, this is evil browser sniffing, but only IE has this bug

document.getElementsByName = function(name, tag){
    if(!tag){
        tag = '*';
    }
    var elems = document.getElementsByTagName(tag);
    var res = []
    for(var i=0;i<elems.length;i++){
        att = elems[i].getAttribute('name');
        if(att == name) {
            res.push(elems[i]);
        }
    }
    return res;
}

}

function all_name_off(name) {
	for  (i=0; i<500; i++)  {
		if (navigator.appName == "Microsoft Internet Explorer") {
			
		var el = document.getElementsByName('pops', 'div')[i];
		if ( el.style.display == 'block' ) {	el.style.display = 'none';}
		
		} else {
			
		var el = document.getElementsByName('pops')[i];
		if ( el.style.display == 'block' ) {	el.style.display = 'none';}
		
		}

   		
	}
	
}


function blanket_size(popUpDivVar, MY) {

	if (typeof window.innerWidth != 'undefined') {
		viewportheight = window.innerHeight;
	} else {
		viewportheight = document.documentElement.clientHeight;
	}
	if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) {
		blanket_height = viewportheight;
	} else {
		if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) {
			blanket_height = document.body.parentNode.clientHeight;
		} else {
			blanket_height = document.body.parentNode.scrollHeight;
		}
	}
	var blanket = document.getElementById('blanket');
	blanket.style.height = blanket_height + 'px';
		
	myId = popUpDivVar;
	result=returnSize();

	popUpDiv=document.getElementById(myId);
	
	
}
function window_pos(popUpDivVar, MX) {	
	
	myId = popUpDivVar;

	result=returnSize();
	var myWidth=result[0];
	var elementWidth=document.getElementById(myId).offsetWidth;
    var myScrollLeft=document.documentElement.scrollLeft;
	var posX=((myScrollLeft+myWidth)-(myWidth/2)-(elementWidth/2))/2-elementWidth;
	posX=(myWidth/4)-150;
	var myHeight=result[1];
	var elementHeight=document.getElementById(myId).offsetHeight;
	var myScrollTop=document.documentElement.scrollTop;
	var posY=((myScrollTop+myHeight)-(myHeight/2)-(elementHeight/2))/2-elementHeight;
	posY=myScrollTop+100;
	
	popUpDiv=document.getElementById(popUpDivVar);
	AssignPosition(popUpDivVar);
	var browser = navigator.userAgent;
	if (browser.toLowerCase().indexOf('safari') > 0) {
  	popUpDiv.style.left = the_posX + 'px';
	popUpDiv.style.top = the_posY + 'px';
	} else {
 	popUpDiv.style.left = posX + 'px';
	popUpDiv.style.top = posY + 'px';
	}

	
}
function popup(windowname) {

	
	if (navigator.appName == "Microsoft Internet Explorer") {
	blanket_size(windowname);
	window_pos(windowname);
	toggle('blanket');
	toggle(windowname);
	} else {
	blanket_size(windowname);
	window_pos(windowname);
	toggle('blanket');
	toggle(windowname);
	}

			
}

var cbb = {
	init : function() {
	// Check that the browser supports the DOM methods used
		if (!document.getElementById || !document.createElement || !document.appendChild) return false;
		var oElement, oOuter, oI1, oI2, tempId;
	// Find all elements with a class name of cbb
		var arrElements = document.getElementsByTagName('*');
		var oRegExp = new RegExp("(^|\\s)cbb(\\s|$)");
		for (var i=0; i<arrElements.length; i++) {
	// Save the original outer element for later
			oElement = arrElements[i];
			if (oRegExp.test(oElement.className)) {
	// 	Create a new element and give it the original element's class name(s) while replacing 'cbb' with 'cb'
				oOuter = document.createElement('div');
				oOuter.className = oElement.className.replace(oRegExp, '$1cb$2');
	// Give the new div the original element's id if it has one
				if (oElement.getAttribute("id")) {
					tempId = oElement.id;
					oElement.removeAttribute('id');
					oOuter.setAttribute('id', '');
					oOuter.id = tempId;
				}
	// Change the original element's class name and replace it with the new div
				oElement.className = 'i3';
				oElement.parentNode.replaceChild(oOuter, oElement);
	// Create two new div elements and insert them into the outermost div
				oI1 = document.createElement('div');
				oI1.className = 'i1';
				oOuter.appendChild(oI1);
				oI2 = document.createElement('div');
				oI2.className = 'i2';
				oI1.appendChild(oI2);
	// Insert the original element
				oI2.appendChild(oElement);
	// Insert the top and bottom divs
				cbb.insertTop(oOuter);
				cbb.insertBottom(oOuter);
			}
		}
	},
	insertTop : function(obj) {
		var oOuter, oInner;
	// Create the two div elements needed for the top of the box
		oOuter=document.createElement("div");
		oOuter.className="bt"; // The outer div needs a class name
	    oInner=document.createElement("div");
	    oOuter.appendChild(oInner);
		obj.insertBefore(oOuter,obj.firstChild);
	},
	insertBottom : function(obj) {
		var oOuter, oInner;
	// Create the two div elements needed for the bottom of the box
		oOuter=document.createElement("div");
		oOuter.className="bb"; // The outer div needs a class name
	    oInner=document.createElement("div");
	    oOuter.appendChild(oInner);
		obj.appendChild(oOuter);
	},
	// addEvent function from http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html
	addEvent : function(obj, type, fn) {
		if (obj.addEventListener)
			obj.addEventListener(type, fn, false);
		else if (obj.attachEvent) {
			obj["e"+type+fn] = fn;
			obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
			obj.attachEvent("on"+type, obj[type+fn]);
		}
	}
};

cbb.addEvent(window, 'load', cbb.init);

function Visio(URL) {
var window_handle = window.open(URL, 'window_handle', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=570,height=590,left = 555,top = 230');
}

