// Popup
function openPopUp(str,width,height) {
	var param = 'width=' + width + ',height=' + height + ',resizable=no,left=100,top=20,scrollbars=yes,location=no,menubar=no,status=no,alwaysRaised=yes'; 
	popUpWindow = open(str,'PopUp', param);
	if (popUpWindow.opener == null)	popUpWindow.opener = self;
}																							

// Images RollIn / RollOut
function rollIn(imgName) {if (document.images && (flag == true)) document[imgName].src = eval(imgName + '_on.src');}
function rollOut(imgName) {if (document.images) document[imgName].src = eval(imgName + '_off.src');}

// Layers write (source code from http://dynamicdrive.com)
function writeContent(whichcontent){
	if (timerRunning)
		clearTimeout(myTimer); 
	timerRunning = false; 
	if (document.all||document.getElementById){
		DivElement=document.getElementById? document.getElementById('descriptions'):document.all.descriptions;
		DivElement.innerHTML=whichcontent;
	}
	else if (document.layers){
		document.d1.document.d2.document.write(whichcontent);
		document.d1.document.d2.document.close();
	}
}
function originalContent(){
	myTimer = setTimeout('writeContent(content[0])',500);
	timerRunning = true; 
}

// Layers visibility
function show(object) {
    if (document.getElementById && document.getElementById(object) != null) node = document.getElementById(object).style.visibility='visible';
    else if (document.layers && document.layers[object] != null) document.layers[object].visibility = 'visible';
    else if (document.all) document.all[object].style.visibility = 'visible';
	return true;
}

function hide(object) {
	if (document.getElementById && document.getElementById(object) != null) node = document.getElementById(object).style.visibility='hidden';
    else if (document.layers && document.layers[object] != null) document.layers[object].visibility = 'hidden';
    else if (document.all) document.all[object].style.visibility = 'hidden';
	return true;
}

function toggle(object) {
	if (document.getElementById && document.getElementById(object) != null) {
		if (document.getElementById(object).style.visibility == 'hidden')
			show(object);
		else
			hide(object);
	} else if (document.layers && document.layers[object] != null) {
		if (document.layers[object].visibility == 'hidden')
			show(object);
		else
			hide(object);
    } else if (document.all) {
		if (document.all[object].style.visibility == 'hidden')
			show(object);
		else
			hide(object);
	}
}

// Layers expansion
function expand(object) {
    if (document.getElementById && document.getElementById(object) != null) node = document.getElementById(object).style.display='';
    else if (document.layers && document.layers[object] != null) document.layers[object].display = '';
    else if (document.all) document.all[object].style.display = '';
	return true;
}

function collapse(object) {
	if (document.getElementById && document.getElementById(object) != null) node = document.getElementById(object).style.display='none';
    else if (document.layers && document.layers[object] != null) document.layers[object].display = 'none';
    else if (document.all) document.all[object].style.display = 'none';
	return true;
}

function setBackgroundColor(object,color) {
	if (document.getElementById && document.getElementById(object) != null) node = document.getElementById(object).style.backgroundColor = color;
    else if (document.layers && document.layers[object] != null) document.layers[object].bgColor  = color;
  	else if (document.all) document.all[object].style.backgroundColor = color;
}

function changeContent(object,text) {
    if (document.getElementById && document.getElementById(object) != null) {
		document.getElementById(object).innerHTML = text;
    } else if (document.layers && document.layers[object] != null) {
		object.document.open();
        object.document.write(text);
        object.document.close();
    } else if (document.all) {
		object.innerHTML = text;
	}
}

// Nav
function openNav(name) {
	if (document.getElementById) {
		if (name != 'home' && document.getElementById('homeNav') != null) {
			if (document.getElementById('homeNav').style.visibility == 'visible') hide('homeNav');
		} 
		if (name != 'communicate' && document.getElementById('communicateNav') != null) {
			if (document.getElementById('communicateNav').style.visibility == 'visible') hide('communicateNav');
		} 
		if (name != 'share' && document.getElementById('shareNav') != null) {
			if (document.getElementById('shareNav').style.visibility == 'visible') hide('shareNav');
		} 
		if (name != 'organise' && document.getElementById('organiseNav') != null) {
			if (document.getElementById('organiseNav').style.visibility == 'visible') hide('organiseNav');
		} 
		if (name != 'admin' && document.getElementById('adminNav') != null) {
			if (document.getElementById('adminNav').style.visibility == 'visible') hide('adminNav');
		}
		if (name != 'solutions' && document.getElementById('solutionsNav') != null) {
			if (document.getElementById('solutionsNav').style.visibility == 'visible') hide('solutionsNav');
		}
		if (name != 'services' && document.getElementById('servicesNav') != null) {
			if (document.getElementById('servicesNav').style.visibility == 'visible') hide('servicesNav');
		}
		if (name != 'customers' && document.getElementById('customersNav') != null) {
			if (document.getElementById('customersNav').style.visibility == 'visible') hide('customersNav');
		}
		if (name != 'company' && document.getElementById('companyNav') != null) {
			if (document.getElementById('companyNav').style.visibility == 'visible') hide('companyNav');
		}
		if (document.getElementById(name + 'Nav').style.visibility == 'hidden') show(name + 'Nav');
	}  else if (document.layers) {
		if (name != 'home' && document.layers('homeNav') != null) {
			if (document.layers('homeNav').style.visibility == 'visible') hide('homeNav');
		}
		if (name != 'communicate' && document.layers('communicateNav') != null) {
			if (document.layers('communicateNav').style.visibility == 'visible') hide('communicateNav');
		}
		if (name != 'share' && document.layers('shareNav') != null) {
			if (document.layers('shareNav').style.visibility == 'visible') hide('shareNav');
		}
		if (name != 'organise' && document.layers('organiseNav') != null) {
			if (document.layers('organiseNav').style.visibility == 'visible') hide('organiseNav');
		}
		if (name != 'admin' && document.layers('adminNav') != null){
			if (document.layers('adminNav').style.visibility == 'visible') hide('adminNav');
		}
		if (name != 'solutions' && document.layers('solutionsNav') != null){
			if (document.layers('solutionsNav').style.visibility == 'visible') hide('solutionsNav');
		}
		if (name != 'services' && document.layers('servicesNav') != null){
			if (document.layers('servicesNav').style.visibility == 'visible') hide('servicesNav');
		}
		if (name != 'customers' && document.layers('customersNav') != null){
			if (document.layers('customersNav').style.visibility == 'visible') hide('customersNav');
		}
		if (name != 'company' && document.layers('companyNav') != null){
			if (document.layers('companyNav').style.visibility == 'visible') hide('companyNav');
		}
		if (document.layers(name + 'Nav').style.visibility == 'hidden') show(name + 'Nav');
	}  else if (document.all) {
		if (name != 'home' && document.all('homeNav') != null) {
			if (document.all('homeNav').style.visibility == 'visible') hide('homeNav');
		}
		if (name != 'communicate' && document.all('communicateNav') != null) {
			if (document.all('communicateNav').style.visibility == 'visible') hide('communicateNav');
		}
		if (name != 'share' && document.all('shareNav') != null) {
			if (document.all('shareNav').style.visibility == 'visible') hide('shareNav');
		}
		if (name != 'organise' && document.all('organiseNav') != null) {
			if (document.all('organiseNav').style.visibility == 'visible') hide('organiseNav');
		}
		if (name != 'admin' && document.all('adminNav') != null) {
			if (document.all('adminNav').style.visibility == 'visible') hide('adminNav');
		}
		if (name != 'solutions' && document.all('solutionsNav') != null) {
			if (document.all('solutionsNav').style.visibility == 'visible') hide('solutionsNav');
		}
		if (name != 'services' && document.all('servicesNav') != null) {
			if (document.all('servicesNav').style.visibility == 'visible') hide('servicesNav');
		}
		if (name != 'customers' && document.all('customersNav') != null) {
			if (document.all('customersNav').style.visibility == 'visible') hide('customersNav');
		}
		if (name != 'company' && document.all('companyNav') != null) {
			if (document.all('companyNav').style.visibility == 'visible') hide('companyNav');
		}
		if (document.all(name + 'Nav').style.visibility == 'hidden') show(name + 'Nav');
	}
}

// File upload
function openUploadMessage() { 
	if (typeof Upload != 'undefined') return false;
	Uploading = true;
	
	var param = 'width=200,height=100,resizable=no,scrollbars=no,location=no,menubar=no,status=no,alwaysRaised=yes'; 
	var x = (screen.width - 400) / 2;
	var y = (screen.height - 300) / 2;
	param +=  ",left=" + x + ",top=" + y + ",screenX=" + x + ",screenY=" + y;
	Upload = open('Chargement.htm','Upload', param);
 	if (Upload.opener == null)	Upload.opener = self;
	Upload.focus();
	return true;
}
function closeUpload()	{
	if (typeof Upload != 'undefined') {
		if (!Upload.closed) Upload.close();
	}
}

