n = (document.layers) ? 1:0
ie = (document.all) ? 1:0
dom = (document.getElementById && !document.all) ? true:false;





function gimmeMyPos(lyrId) {

		rawClipInfo = document.getElementById(lyrId).style.left;
		tempLeft = parseInt(rawClipInfo.substring(0,rawClipInfo.indexOf("px")));
		if (isNaN(tempLeft)) tempLeft = 0;

		rawClipInfo = document.getElementById(lyrId).style.top;
		tempTop = parseInt(rawClipInfo.substring(0,rawClipInfo.indexOf("px")));
		if (isNaN(tempTop)) tempTop = 0;

		alert('left: '+tempLeft+' top: '+tempTop);


		}

function extractVar(varName,allVars) {
	if (allVars.indexOf(varName) > -1)	{
		resultAndAfter = allVars.substring((allVars.indexOf(varName))+(varName.length)+1,(allVars.length));
		return resultAndAfter.substring(0,(resultAndAfter.indexOf(";")));
		}
	else return "false";
	}



function chgImg(div,imgName,imgSrc) {
        	if (n) {sufx = eval("document." + div + ".document")}
        	if (ie || dom) {sufx = eval("document")}
        	sufx.images[imgName].src = imgSrc;
			
}


function getWindowWidth() {
	if (parseInt(navigator.appVersion)>3) {
		 if (navigator.appName=="Netscape") {
			  return window.innerWidth;
				}
		 if (navigator.appName.indexOf("Microsoft")!=-1) {
			  return document.body.offsetWidth;
				}
		}
}


function removeFocus(div,imgName) {
        	if (n) {sufx = eval("document." + div + ".document")}
        	if (ie || dom) {sufx = eval("document")}
        	sufx.images[imgName].blur();
			
} 



function ecrireContenu(layer,content) {


if (n) {
	lyr = document.layers[layer].document;
    lyr.open();
    lyr.write(content);
    lyr.close();
}
if (ie) document.all[layer].innerHTML = content;
if (dom) document.getElementById(layer).innerHTML = content;
}




function move(layer, newleft, newtop) {
newleft = parseInt(newleft)
newtop = parseInt(newtop)

if (n) layertemp = eval("document." + layer );
if (ie) layertemp = eval(layer + ".style");
if(dom) layertemp = eval(document.getElementById(layer).style);

layertemp.left = newleft;
layertemp.top = newtop;
}





function show(div){
if (n) {eval('document.'+div+'.visibility = "visible"');}
if (ie) {document.all[div].style.visibility = "visible";}
if (dom) {document.getElementById(div).style.visibility = "visible";}
}


function changeBgColor(div,newColor){
	if (n) {eval('document.'+div+'.backgroundColor = newColor');}
	if (ie) {document.all[div].style.backgroundColor = newColor;}
	if (dom) {document.getElementById(div).style.backgroundColor = newColor;}
}

function changeColor(div,newColor){
	if (n) {eval('document.'+div+'.color = newColor');}
	if (ie) {document.all[div].style.color = newColor;}
	if (dom) {document.getElementById(div).style.color = newColor;}
}

function changeFontSize(div,newSize){
	if (n) {eval('document.'+div+'.fontSize = newSize+"px"');}
	if (ie) {document.all[div].style.fontSize = newSize+"px";}
	if (dom) {document.getElementById(div).style.fontSize = newSize+"px";}
}

function setDivSize(layer,newWidth,newHeight){

	if (n) layertemp = eval("document." + layer );
	if (ie) layertemp = eval(layer + ".style");
	if(dom) layertemp = eval(document.getElementById(layer).style);

	layertemp.width = parseInt(newWidth)+"px";
	if (newHeight != undefined) layertemp.height = parseInt(newHeight)+"px";
}


function hide(layer) {
if (n) {
layertemp = eval("document." + layer );
layertemp.visibility = "hide";
}
if (ie) {
layertemp = eval(layer + ".style");
layertemp.visibility = "hidden";
}
if(dom) {
layertemp = eval(document.getElementById(layer).style);
layertemp.visibility = "hidden";
}
}





function newZindexPos(layer,newValue) {
if (n) {
layertemp = eval("document." + layer );
layertemp.zIndex = newValue;
}
if (ie) {
layertemp = eval(layer + ".style");
layertemp.zIndex = newValue;
}
if(dom) {
layertemp = eval(document.getElementById(layer).style);
layertemp.zIndex = newValue;
}
}




function setZIndex(id, z_index) {
	document.getElementById(id).style.zIndex = z_index;
}





function clipTo(layer,t,r,b,l) {
if (n) layertemp = eval("document." + layer );
if (ie) tempLyr = eval(layer + ".style");

if (n) {
layertemp.clip.top = t;
layertemp.clip.right = r;
layertemp.clip.bottom = b;
layertemp.clip.left = l;
}
if (ie) {
test = eval("document.all."+layer+".style");
test.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)";
}
if (dom) {
test = document.getElementById(layer).style;
test.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)";
}
}







// The Central Randomizer 1.3 (C) 1997 by Paul Houle (houle@msc.cornell.edu)
// See:  http://www.msc.cornell.edu/~houle/javascript/randomizer.html

rnd.today=new Date();
rnd.seed=rnd.today.getTime();

function rnd() {
        rnd.seed = (rnd.seed*9301+49297) % 233280;
        return rnd.seed/(233280.0);
};

function rand(number) {
        return Math.ceil(rnd()*number);
};

// end central randomizer. -->



// function used for reading anything in a XML file
// does not work in Safari, so I'm not using it

function readXml(xmlFileName,group,varToGet) {

	var temp = new Array;
	
	
    var xmlDoc=null;
	if (window.ActiveXObject)	{
		// code for IE
		xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
	}
	else if (document.implementation.createDocument) {
		// code for Mozilla, Firefox, Opera, etc.
		xmlDoc=document.implementation.createDocument("","",null);
	}
	else alert('Your browser cannot handle this script');

	if (xmlDoc!=null) {
			
		xmlDoc.async=false;
		xmlDoc.load(xmlFileName);
		
		var x=xmlDoc.getElementsByTagName(group);
		for (i=0;i<x.length;i++) { 
			temp[i] = x[i].getElementsByTagName(varToGet)[0].childNodes[0].nodeValue;
		}

		return temp;
	}
}


