/* Fonction d'animation */
anim = new Array();
function anime(id,type,arrivee,duree){ var Nvar = Math.floor((Math.random()*1000000000)+1); anim[Nvar] = new Array(); var nav = window.navigator.appName; var element = document.getElementById(id); var start = (new Date).getTime(); if (element.style.opacity){ var val1 = (element.style.opacity * 10); isie8 = '0'; } else if (nav == "Microsoft Internet Explorer" && typeof document.createElement('div').style.filter != 'undefined'){ var val1 = (element.filters.alpha.opacity / 10); isie8 = '1'; } else { var val1 = 10; isie8 = '0'; } if (arrivee === parseInt(arrivee)){ var val2 = parseInt(arrivee); } else { if (arrivee.substr(0,2) == '++' && (val1 + parseInt(arrivee)) <= 10){ var val2 = val1 + parseInt(arrivee); } else if (arrivee.substr(0,2) == '--' && (val1 - parseInt(arrivee)) >= 0){ var val2 = val1 - parseInt(arrivee); } } var val = val2 - val1; if (val != 0){ anim[Nvar]['el'] = element; anim[Nvar]['start'] = start; anim[Nvar]['end'] = (start + duree); anim[Nvar]['type'] = type; anim[Nvar]['val1'] = val1; anim[Nvar]['val2'] = val2; anim[Nvar]['val'] = val; anim[Nvar]['run'] = duree; a_opacity(Nvar); } }
function a_opacity(Nvar){ if (Nvar && Nvar != 'undefined'){ var time = (new Date).getTime(); var pos = (Math.abs(anim[Nvar]['val']) * ((time-anim[Nvar]['start'])/anim[Nvar]['run'])); if (pos > Math.abs(anim[Nvar]['val'])){ pos = Math.abs(anim[Nvar]['val']); } if (anim[Nvar]['val2'] > anim[Nvar]['val1']){ if(isie8 == '1'){ anim[Nvar]['el'].style.filter = "alpha(opacity = '"+((anim[Nvar]['val1'] * 10) + (pos * 10))+"')"; } else { anim[Nvar]['el'].style.opacity = (anim[Nvar]['val1'] / 10) + (pos / 10); } } else { if(isie8 == '1'){ anim[Nvar]['el'].style.filter = "alpha(opacity = '"+((anim[Nvar]['val1'] * 10) - (pos * 10))+"')"; } else { anim[Nvar]['el'].style.opacity = (anim[Nvar]['val1'] / 10) - (pos / 10); } } if(time > anim[Nvar]['end']){ anim[Nvar]['el'].style.filter = "alpha(opacity = '"+(anim[Nvar]['val2'] * 10)+"')"; anim[Nvar]['el'].style.opacity = (anim[Nvar]['val2'] / 10); delete anim[Nvar]; } else { setTimeout("a_opacity('"+Nvar+"')",10); }}}
/* Manipulation des cadres */
function openPatientFile(id,i){
var patientFile = document.getElementById('list_'+id+'_'+i);
if (patientFile.offsetHeight > 0){
patientFile.style.maxHeight = '0';
patientFile.style.margin = '0';
patientFile.style.opacity = '0';
patientFile.style.filter = "alpha(opacity = '0')";
document.getElementById('openfile_'+i).getElementsByTagName('img')[0].className='';
if ((i / 2) == Math.round(i / 2)){
document.getElementById('patientLine_'+i).style.backgroundColor = '#eee';
} else {
document.getElementById('patientLine_'+i).style.backgroundColor = 'transparent';
}
document.getElementById('patientLine_'+i).style.borderWidth='0';
} else if (patientFile.offsetHeight == 0){
patientFile.style.maxHeight = (patientFile.getElementsByTagName('table')[0].offsetHeight + 100)+'px';
patientFile.style.margin = '5px 10px 10px 0';
patientFile.style.opacity = '1';
patientFile.style.filter = "alpha(opacity = '100')";
document.getElementById('openfile_'+i).getElementsByTagName('img')[0].className='lineopened';
document.getElementById('patientLine_'+i).style.backgroundColor = '#ddd';
document.getElementById('patientLine_'+i).style.borderWidth='0 0 1px 0';
}
}
function openLeft(from){
var corps = document.getElementById('corps_page');
var leftCol = document.getElementById('left_col');
var rightCol = document.getElementById('right_col');
var openLeft = document.getElementById('openleft');
if (corps.offsetWidth <= 700){ leftSize = '250'; } else if (corps.offsetWidth <= 1050){ leftSize = '215'; } else if (corps.offsetWidth > 1050){ leftSize = '315'; }
if (leftCol.offsetLeft == '0'){
leftCol.style.left = '-'+(leftSize - 30)+'px';
openLeft.style.width = '30px';
openLeft.style.fontSize = '30px';
if (corps.offsetWidth > 800){ rightCol.style.width = (corps.offsetWidth - 30)+'px'; }
openLeft.innerHTML = '»';
if (from == 'medecin'){
openLeft.title = 'Ouvrir le panneau de recherche';
} else if (from == 'patient'){
openLeft.title = 'Ouvrir les options';
}
} else if (leftCol.offsetLeft < '0'){
leftCol.style.left = '0';
openLeft.style.width = '14px';
openLeft.style.fontSize = '18px';
if (corps.offsetWidth > 800){ rightCol.style.width = (corps.offsetWidth - leftCol.offsetWidth)+'px'; }
openLeft.innerHTML = '«';
if (from == 'medecin'){
openLeft.title = 'Fermer le panneau de recherche';
} else if (from == 'patient'){
openLeft.title = 'Fermer les options';
}
}
}
function open_search_panel(id){
var elem = document.getElementById(id);
if (elem.offsetHeight == '0'){
elem.style.height = elem.getElementsByClassName('inner')[0].offsetHeight+'px';
} else if (elem.offsetHeight > '0'){
elem.style.height = '0';
}
setTimeout('subButton()',500); }
function subButton(){
if (document.getElementById('search_exams').offsetHeight > 0 || document.getElementById('search_date').offsetHeight > 0){
document.getElementById('bottomSearchButton').style.opacity = '1';
document.getElementById('bottomSearchButton').style.visibility = 'visible';
} else {
document.getElementById('bottomSearchButton').style.opacity = '0';
document.getElementById('bottomSearchButton').style.visibility = 'hidden';
}
}
function openGal(id){
var galerie = document.getElementById(id);
var galerieBouton = id.replace('surGalerie_','galerieBouton_');
var galeriz = document.getElementsByClassName('surGalerie');
for (var g = 0; g < galeriz.length; g++){
if (galeriz[g].id != id && galeriz[g].id != 'galerieMenuBar'){
galeriz[g].style.left = '100%';
}
}
var galBout = document.getElementsByClassName('galerie_bouton');
for (var f = 0; f < galBout.length; f++){
galBout[f].style.backgroundColor='#222';
}
document.getElementById(galerieBouton).style.backgroundColor='#333';
if (galerie.offsetLeft > 0){
galerie.style.left = '0';
var galId = id.replace('surGalerie_','');
var totalPix = document.getElementById('total_'+galId).innerHTML;
oInF(galId,0,totalPix);
setLoadBar(galId);
launchPreload(galId,0);
}
}
followPic = 0;
function launchPreload(galId,k){
if (currGal == galId && typeof window["imgTab_"+galId][k] != 'undefined'){
var test = document.getElementById('preload_'+galId+'_'+k);
var barEl = document.getElementById('loadCases').getElementsByTagName('td');
if (test === null){
var pic = new Image();
pic.id = 'preload_'+galId+'_'+k;
pic.style.position = 'fixed';
pic.style.width = '0';
pic.style.height = '0';
pic.onload = function(){
var gal = this.id.split('_')[1];
var key = this.id.split('_')[2];
var next = parseInt(key) + 1;
document.getElementById('galerie_'+gal).appendChild(this);
var currBg = getStyle('smallFrameViewPic','background-image');
document.getElementById('smallFrameViewPic').style.backgroundImage = currBg.split(', ')[0]+", url('"+window["imgTab_"+galId][k]+"')";
barEl[k].style.background = '#666';
barEl[k].style.cursor = 'pointer';
barEl[k].title = 'Image '+k+'/'+document.getElementById('total_'+currGal).innerHTML;
barEl[k].onclick = function(){ oInF(currGal,key,document.getElementById('total_'+currGal).innerHTML); };
barEl[k].onmousedown = function(){ followPic = 1; };
barEl[k].onmouseup = function(){ followPic = 0; };
barEl[k].onmouseover = function(){ if (followPic == 1){ oInF(currGal,parseInt(this.title.replace('Image ','').split('/')[0]),document.getElementById('total_'+currGal).innerHTML); } };
barEl[k].className = 'loadedPix';
if (k == 0){ barEl[k].className = 'loadedPix'; barEl[k].style.background = '#ddd'; }
launchPreload(gal,next);
}
pic.src = window["imgTab_"+galId][k];
} else {
barEl[k].style.background = '#666';
barEl[k].className = 'loadedPix';
barEl[k].style.cursor = 'pointer';
var key = k;
barEl[k].title = 'Image '+k+'/'+document.getElementById('total_'+currGal).innerHTML;
barEl[k].onclick = function(){ oInF(currGal,key,document.getElementById('total_'+currGal).innerHTML); };
if (k == 0){ barEl[k].className = 'loadedPix'; barEl[k].style.background = '#ddd'; }
var next = parseInt(k) + 1;
launchPreload(galId,next);
}
}
}
function setLoadBar(galId){
var loadTest = document.getElementById('loadTab');
if (loadTest !== null){
loadTest.innerHTML = '
';
} else {
var loadTab = document.createElement('div');
loadTab.id = 'loadTab';
loadTab.style.display = 'block';
loadTab.style.height = '6px';
loadTab.style.width = '100%';
loadTab.style.background = '#000';
loadTab.style.position = 'absolute';
loadTab.style.left = '0';
loadTab.style.bottom = '40px';
loadTab.style.zIndex = '999999';
loadTab.innerHTML = '';
document.getElementsByClassName('right_frame')[0].appendChild(loadTab);
}
fillLoadBar(galId,0);
}
function fillLoadBar(galId,k){
if (currGal == galId && typeof window["imgTab_"+galId][k] != 'undefined'){
document.getElementById('loadCases').innerHTML = document.getElementById('loadCases').innerHTML+' | ';
var next = parseInt(k) + 1;
fillLoadBar(galId,next);
}
}
function openviewerFrame(uuid){
document.body.style.overflow = 'hidden';
document.getElementById('backView').style.display='block';
document.getElementById('header').style.display = 'none';
var viewerF = document.getElementById('viewerFrame');
viewerF.src = 'viewer.php?study='+uuid;
viewerF.onload = function(){
document.getElementById('setPdata').style.display='block';
viewerF.style.visibility = 'visible';
viewerF.style.opacity = '1';
viewerF.onload=null;
viewerF.contentWindow.ldGal();
}
}
function closeviewerFrame(){
document.body.style.overflow = 'auto';
document.getElementById('viewerFrame').onload=null;
document.getElementById('viewerFrame').style.visibility = 'hidden';
document.getElementById('viewerFrame').style.opacity = '0';
document.getElementById('viewerFrame').src='systemfile.php?func=blank';
document.getElementById('backView').style.display='none';
document.getElementById('setPdata').style.display='none';
document.getElementById('header').style.display = 'block';
document.getElementById("openleft").style.display = "block";
}
/* Confirmation no Bot pour les formulaires */
function nobot(){ document.getElementById('controlfield').value = 'ImNoBot'; }
/* Visionneuse grand format */
brightness = new Array();
contrast = new Array();
rotation = new Array();
negatif = new Array();
ajustOn = isZoom = isMove = 0;
scrop = 'n'; movX = 'n'; movY = 'n';
scropActive = 0;
function seeInFrame(imgId,galerie,prev,next,num){
var keyImg = parseInt(imgId.split("_")[1]);
var total = parseInt(num.split('/')[1]);
var path = window["imgTab_"+galerie][keyImg];
if (prev != 'none'){ var seeprev = ""; } else { var seeprev = ''; }
if (next != 'none'){ var seenext = ""; } else { var seenext = ''; }
var idIm = path.replace('systemfile.php?func=image','').replace('&src=','').replace('&load=1','').replace('&print=1','');
if (brightness.hasOwnProperty(idIm)){ var lum = brightness[idIm]; } else { var lum = 100; brightness[idIm] = lum; }
if (contrast.hasOwnProperty(idIm)){ var cont = contrast[idIm]; } else { var cont = 100; contrast[idIm] = cont; }
if (!rotation.hasOwnProperty(idIm)){ rotation[idIm] = 0; }
if (!negatif.hasOwnProperty(idIm)){ negatif[idIm] = 0; }
ajustOn = isZoom = isMove = 0;
currZoom = 0;
zoomActive = 0;
if (rotation[idIm] != 0){ var rotat = '&rotate='+rotation[idIm]; } else { var rotat = ''; }
document.getElementById('smallViewFrame').style.background = '#000 url("../common/css/loading2.gif") no-repeat center center';
document.getElementById('smallViewFrame').innerHTML = ''+num+'
lum:'+lum+'
cont:'+cont+'
';
if (scropActive == 1){ document.getElementById('scrollButton').style.backgroundImage = "url('../common/css/mouse-scroll-close.png')"; }
var loadTest = document.getElementById('loadCases');
if (loadTest !== null){
var barEl = document.getElementById('loadCases').getElementsByClassName('loadedPix');
for (var f = 0; f < barEl.length; f++){ barEl[f].style.background = '#666'; }
barEl[keyImg].style.background = '#ddd';
}
/* activation ajust() */
ajust(idIm);
removeCSSRule('smallFrameViewPic');
addCSSRule(document.styleSheets[(document.styleSheets.length - 1)], '#smallFrameViewPic', '-moz-filter:brightness('+lum+'%) contrast('+cont+'%) invert('+negatif[idIm]+'); -webkit-filter:brightness('+lum+'%) contrast('+cont+'%) invert('+negatif[idIm]+'); -o-filter:brightness('+lum+'%) contrast('+cont+'%) invert('+negatif[idIm]+'); -ms-filter:brightness('+lum+'%) contrast('+cont+'%) invert('+negatif[idIm]+'); filter:brightness('+lum+'%) contrast('+cont+'%) invert('+negatif[idIm]+');');
/* Scrolling des images */
document.getElementById("smallFrameViewPic").addEventListener('wheel', function(e){
if (e.deltaY < 0){
if (prev != 'none' && document.getElementById('loadCases').getElementsByTagName('td')[prev].className == 'loadedPix'){ oInF(galerie,prev,total); }
}
if (e.deltaY > 0){
if (next != 'none' && document.getElementById('loadCases').getElementsByTagName('td')[next].className == 'loadedPix'){ oInF(galerie,next,total); }
}
});
document.getElementById('smallViewFrame').addEventListener("mousedown", function(){ document.getElementById('smallViewFrame').addEventListener("mousemove", scrollOnPic); } );
document.getElementById('smallViewFrame').addEventListener("mouseup", function(){ document.getElementById('smallViewFrame').removeEventListener("mousemove", scrollOnPic); scrop = 'n'; movX = 'n'; movY = 'n'; });
}
function toggleBig(el){
if (document.getElementById('smallViewFrame').className == 'fullScreen'){
document.getElementById('smallViewFrame').className = '';
document.getElementById('loadTab').className = '';
} else {
document.getElementById('smallViewFrame').className = 'fullScreen';
document.getElementById('loadTab').className = 'fullScreenLoadTab';
}
}
function setScrollOn(idIm){
if (scropActive == 0){
scropActive = 1;
document.getElementById('scrollButton').style.backgroundImage = "url('../common/css/mouse-scroll-close.png')";
document.getElementById("smallViewFrame").style.cursor = 'pointer';
if (ajustOn == 1){ initAjust(idIm); }
} else {
scropActive = 0;
document.getElementById('scrollButton').style.backgroundImage = "url('../common/css/mouse-scroll.png')";
document.getElementById("smallViewFrame").style.cursor = 'default';
}
}
/* Fonction de scroll et mouvement à la souris */
scrollOnPic = function (event){
if (scropActive == 1){
event = event || window.event;
if(navigator.appName=="Microsoft Internet Explorer"){ var posY = event.y; } else { var posY = event.pageY; }
if (scrop == 'n'){ scrop = posY; }
var curNum = parseInt(document.getElementsByClassName('numimg')[0].innerHTML.split('/')[0]) - 1;
var currTot = parseInt(document.getElementsByClassName('numimg')[0].innerHTML.split('/')[1]);
if (posY > scrop && (curNum + 2) <= currTot){ oInF(currGal,(curNum + 1),document.getElementById('total_'+currGal).innerHTML); scrop = posY; }
if (posY < scrop && (curNum - 1) >= 0){ oInF(currGal,(curNum - 1),document.getElementById('total_'+currGal).innerHTML); scrop = posY; }
} else if (zoomActive == 1){
event = event || window.event;
if(navigator.appName=="Microsoft Internet Explorer"){ var posY = event.y; var posX = event.X; } else { var posY = event.pageY; var posX = event.pageX; }
if (movX == 'n'){ movX = posX; }
var diffX = 1;
if (posX > movX){ diffX = posX - movX; }
if (posX < movX){ diffX = movX - posX; }
var thePic = document.getElementById('smallFrameViewPic');
if (posX > movX && (thePic.offsetLeft + diffX) <= 0){ thePic.style.left = (thePic.offsetLeft + diffX)+'px'; movX = posX; }
if (posX < movX && (thePic.offsetLeft - diffX) >= document.getElementById('smallViewFrame').offsetWidth - thePic.offsetWidth){ thePic.style.left = (thePic.offsetLeft - diffX)+'px'; movX = posX; }
if (movY == 'n'){ movY = posY; }
var diffY = 1;
if (posY > movY){ diffY = posY - movY; }
if (posY < movY){ diffY = movY - posY; }
var thePic = document.getElementById('smallFrameViewPic');
if (posY > movY && (thePic.offsetTop + diffY) <= 0){ thePic.style.top = (thePic.offsetTop + diffY)+'px'; movY = posY; }
if (posY < movY && (thePic.offsetTop - diffY) >= document.getElementById('smallViewFrame').offsetHeight - thePic.offsetHeight){ thePic.style.top = (thePic.offsetTop - diffY)+'px'; movY = posY; }
}
}
/* Gestion des règles CSS */
rulesAdded = 0;
function addCSSRule(sheet, selector, rules, index){
if('insertRule' in sheet){
sheet.insertRule(selector+'{'+rules+'}',sheet.cssRules.length);
} else if('addRule' in sheet){
sheet.addRule(selector, rules, sheet.cssRules.length);
}
rulesAdded = 1;
}
function removeCSSRule(id){
var styleTag = document.getElementById(id);
var sheet = document.styleSheets[(document.styleSheets.length - 1)];
if (rulesAdded == 1){
sheet.deleteRule((sheet.cssRules.length - 1));
rulesAdded = 0;
}
}
/* Ajuster Luminosité/Contraste */
function initAjust(id){
if (ajustOn == 1){
ajustOn = 0;
document.getElementById('smallFrameViewPic').style.cursor='default';
document.getElementById('lumCont').style.backgroundImage="url('../common/css/lum-cont.png')";
document.getElementById('lumCont').title="Ajuster la luminosit\351 et le contraste de l'image";
} else if (ajustOn == 0){
ajustOn = 1;
scropActive = 0;
zoomActive = 0;
document.getElementById('smallFrameViewPic').style.cursor='crosshair';
document.getElementById('lumCont').style.backgroundImage="url('../common/css/close-lum-cont.png')";
document.getElementById('lumCont').title="Fermer l'outil de luminosit\351/contraste";
}
}
ajustPreview = function(event){
if (ajustOn == 1){
var preview = document.getElementById('smallFrameViewPic');
var baseWidth = document.getElementsByClassName('left_frame')[0].offsetWidth;
var baseHeight = (document.getElementsByClassName('right_frame')[0].offsetHeight + document.getElementById('otherExamsBar').offsetHeight) - preview.offsetHeight;
event = event || window.event;
if(navigator.appName=="Microsoft Internet Explorer"){
var posX = Math.round((((event.x+document.body.scrollLeft) - baseWidth) / preview.offsetWidth) * 200);
var posY = 200 - Math.round((((event.y+document.body.scrollTop) - baseHeight) / preview.offsetHeight) * 200);
} else {
var posX = Math.round(((event.pageX - baseWidth) / preview.offsetWidth) * 200);
var posY = 200 - Math.round(((event.pageY - baseHeight) / preview.offsetHeight) * 200);
}
if (posX < 0){ posX = 0; } if (posY > 200){ posY = 200; }
removeCSSRule(preview.id);
addCSSRule(document.styleSheets[(document.styleSheets.length - 1)], '#'+preview.id, '-moz-filter:brightness('+posY+'%) contrast('+posX+'%) invert('+negatif[currId]+'); -webkit-filter:brightness('+posY+'%) contrast('+posX+'%) invert('+negatif[currId]+'); -o-filter:brightness('+posY+'%) contrast('+posX+'%) invert('+negatif[currId]+'); -ms-filter:brightness('+posY+'%) contrast('+posX+'%) invert('+negatif[currId]+'); filter:brightness('+posY+'%) contrast('+posX+'%) invert('+negatif[currId]+');');
brightness[currId] = posY; contrast[currId] = posX; document.getElementById('lumData').innerHTML = posY; document.getElementById('contData').innerHTML = posX;
}
}
function ajust(id){
currId = id;
var preview = document.getElementById('smallFrameViewPic');
preview.addEventListener("click", ajustPreview);
preview.addEventListener("mousedown", function(){ document.getElementById('smallFrameViewPic').addEventListener("mousemove", ajustPreview); } );
preview.addEventListener("mouseup", function(){ document.getElementById('smallFrameViewPic').removeEventListener("mousemove", ajustPreview); } );
}
/* Rotation Image */
function rotateImg(id,sens){
var imageBg = getStyle('smallFrameViewPic','background-image');
var origRotation = rotation[id];
if (sens == 'moins'){
if (rotation[id] == 0){ rotation[id] = 90; } else if (rotation[id] == 90){ rotation[id] = 180; } else if (rotation[id] == 180){ rotation[id] = 270; } else if (rotation[id] == 270){ rotation[id] = 0; }
} else if (sens == 'plus'){
if (rotation[id] == 0){ rotation[id] = 270; } else if (rotation[id] == 270){ rotation[id] = 180; } else if (rotation[id] == 180){ rotation[id] = 90; } else if (rotation[id] == 90){ rotation[id] = 0; }
}
if (imageBg.search(/&rotate=/i) == '-1'){ var newBgImage = imageBg.replace('&load=1','&load=1&rotate='+rotation[id]); } else { var newBgImage = imageBg.replace('&rotate='+origRotation,'&rotate='+rotation[id]); }
document.getElementById('smallFrameViewPic').style.backgroundImage = newBgImage;
}
/* Négatif */
function negative(id,displayPic){
if (negatif[id] == 0){
negatif[id] = 1;
} else if (negatif[id] == 1){
negatif[id] = 0;
}
removeCSSRule('smallFrameViewPic');
addCSSRule(document.styleSheets[(document.styleSheets.length - 1)], '#smallFrameViewPic', '-moz-filter:brightness('+brightness[id]+'%) contrast('+contrast[id]+'%) invert('+negatif[id]+'); -webkit-filter:brightness('+brightness[id]+'%) contrast('+contrast[id]+'%) invert('+negatif[id]+'); -o-filter:brightness('+brightness[id]+'%) contrast('+contrast[id]+'%) invert('+negatif[id]+'); -ms-filter:brightness('+brightness[id]+'%) contrast('+contrast[id]+'%) invert('+negatif[id]+'); filter:brightness('+brightness[id]+'%) contrast('+contrast[id]+'%) invert('+negatif[id]+');');
}
/* Zoom */
function zoomIn(sens){
scropActive = 0;
document.getElementById('scrollButton').style.backgroundImage = "url('../common/css/mouse-scroll.png')";
document.getElementById("smallViewFrame").style.cursor = 'grab';
var preview = document.getElementById('smallFrameViewPic');
var prevFrame = document.getElementById('smallViewFrame');
var legende = document.getElementsByClassName('legende')[0];
if (sens == 'plus'){ currZoom++; } else if (sens == 'moins'){ currZoom--; }
if (currZoom < 0){ currZoom = 0; }
var newSize = 100 + (currZoom * 5);
var newHeight = Math.round(((prevFrame.offsetHeight - legende.offsetHeight) / 100) * newSize);
var newWidth = Math.round((prevFrame.offsetWidth / (prevFrame.offsetHeight - legende.offsetHeight)) * newHeight);
if (newSize == 100){
zoomActive = 0;
var newLeft = 0;
var newTop = 0;
preview.style.cursor='default';
} else if (newSize == 105){
zoomActive = 1;
var newLeft = Math.round((newWidth - prevFrame.offsetWidth) / 2);
var newTop = Math.round((newHeight - (prevFrame.offsetHeight - legende.offsetHeight)) / 2);
} else {
zoomActive = 1;
var newLeft = Math.round((Math.abs(preview.offsetLeft) / Math.round(preview.offsetWidth - prevFrame.offsetWidth)) * Math.round(newWidth - prevFrame.offsetWidth));
var newTop = Math.round((Math.abs(preview.offsetTop) / Math.round(preview.offsetHeight - (prevFrame.offsetHeight - legende.offsetHeight))) * Math.round(newHeight - (prevFrame.offsetHeight - legende.offsetHeight)));
}
preview.style.height = newHeight+'px';
preview.style.width = newWidth+'px';
preview.style.left = '-'+newLeft+'px';
preview.style.top = '-'+newTop+'px';
}
/* Reset des propriétés */
function resetImage(id,displayPic){
var preview = 'smallFrameViewPic';
brightness[id] = 100; contrast[id] = 100; document.getElementById('lumData').innerHTML = 100; document.getElementById('contData').innerHTML = 100; zoomActive = 0; currZoom = 0;
removeCSSRule('smallFrameViewPic');
document.getElementById('smallFrameViewPic').style.width = '100%';
document.getElementById('smallFrameViewPic').style.height = 'calc(100% - 44px)';
document.getElementById('smallFrameViewPic').style.top = '0';
document.getElementById('smallFrameViewPic').style.left = '0';
document.getElementById(displayId).style.cursor='default';
var imageBg = getStyle('smallFrameViewPic','background-image');
var origRotation = rotation[id];
rotation[id] = 0;
if (imageBg.search(/&rotate=/i) == '-1'){ var newBgImage = imageBg.replace('&load=1','&load=1&rotate=0'); } else { var newBgImage = imageBg.replace('&rotate='+origRotation,'&rotate=0'); }
document.getElementById('smallFrameViewPic').style.backgroundImage = newBgImage;
negatif[id] = 0;
document.getElementById(preview).style.backgroundSize = 'contain';
document.getElementById(preview).style.backgroundPosition = 'center center';
document.getElementById(preview).style.cursor = 'default';
document.getElementById('zoomButton').style.backgroundImage="url('../common/css/loupe-white.png')";
if (displayPic == 'big'){ document.getElementById('zoomButtonBig').style.backgroundImage="url('../common/css/loupe-white.png')"; }
/* Fermeture de Ajust() */
if (ajustOn == 1){
if (displayPic == 'small'){
var displayId = 'smallFrameViewPic';
var buttonId = 'lumCont';
} else if (displayPic == 'big'){
var displayId = 'seebig';
var buttonId = 'lumContBig';
}
ajustOn = 0;
document.getElementById(displayId).style.cursor='default';
document.getElementById(buttonId).style.backgroundImage="url('../common/css/lum-cont.png')";
document.getElementById(buttonId).title="Ajuster la luminosit\351 et le contraste de l'image";
}
}
/* Déconnexion automatique après une trop longue inactivité */
function setLimiter(limit){
inactiveOrigLimit = limit;
var links = document.getElementsByTagName('a');
if (links.length > 0){
for(var x=0; x < links.length; x++){
if (links[x].getAttribute('onclick')){ links[x].setAttribute("onclick","resetLimit();"+links[x].getAttribute('onclick')); } else { links[x].onclick = function(){ resetLimit(); }; }
}
}
var images = document.getElementsByTagName('img');
if (images.length > 0){
for(var x=0; x < images.length; x++){
if (images[x].getAttribute('onclick')){ images[x].setAttribute("onclick","resetLimit();"+images[x].getAttribute('onclick')); } else { images[x].onclick = function(){ resetLimit(); }; }
}
}
var tds = document.getElementsByTagName('td');
if (tds.length > 0){
for(var x=0; x < tds.length; x++){
if (tds[x].getAttribute('onclick')){ tds[x].setAttribute("onclick","resetLimit();"+tds[x].getAttribute('onclick')); } else { tds[x].onclick = function(){ resetLimit(); }; }
}
}
inactiveLimit(inactiveOrigLimit);
}
function inactiveLimit(limit){
if (limit > 0){
limit = limit - (inactiveOrigLimit + 1);
iTime = setTimeout('inactiveLimit('+limit+');',(inactiveOrigLimit + 0.5)*60000);
} else if (limit <= 0){
clearTimeout(iTime);
window.location.href='index.php?deconnect=deconnect&sessionexpired=1';
}
}
function resetLimit(){ clearTimeout(iTime); inactiveLimit(inactiveOrigLimit); }
/* Scrolling des galeries */
followOn = 0;
function follow(id,barre,galerie){
if (document.getElementById(galerie).offsetWidth > document.getElementById(galerie).parentElement.offsetWidth){
if (followOn == 1){
var totalWidth = document.getElementsByClassName('left_frame')[0].offsetWidth + document.getElementsByClassName('right_frame')[0].offsetWidth;
var bar = document.getElementById(barre);
var barWidth = bar.offsetWidth;
var baseWidth = document.getElementsByClassName('left_frame')[0].offsetWidth + bar.offsetLeft;
bar.onclick = function(event){
event = event || window.event;
if(navigator.appName=="Microsoft Internet Explorer"){
var x = event.x+document.body.scrollLeft;
} else {
var x = event.pageX;
}
var pos = ((x - baseWidth) - (document.getElementById(id).offsetWidth / 2));
if (pos < 0){ pos = 0; }
if (pos > barWidth){ pos = barWidth - document.getElementById(id).offsetWidth; }
document.getElementById(id).style.left = pos+'px';
document.getElementById(galerie).style.marginLeft = '-'+((pos / barWidth) * (document.getElementById(galerie).offsetWidth - document.getElementById(galerie).parentElement.offsetWidth))+'px';
loadPix(galerie.replace('galerie_',''));
}
bar.onmousedown = function(event){
event = event || window.event;
if(navigator.appName=="Microsoft Internet Explorer"){
var x = event.x+document.body.scrollLeft;
} else {
var x = event.pageX;
}
var pos = ((x - baseWidth) - (document.getElementById(id).offsetWidth / 2));
if (pos < 0){ pos = 0; }
if (pos > barWidth){ pos = barWidth - document.getElementById(id).offsetWidth; }
document.getElementById(id).style.left = pos+'px';
document.getElementById(galerie).style.marginLeft = '-'+((pos / barWidth) * (document.getElementById(galerie).offsetWidth - document.getElementById(galerie).parentElement.offsetWidth))+'px';
bar.onmousemove = function(event){
event = event || window.event;
if(navigator.appName=="Microsoft Internet Explorer"){
var x = event.x+document.body.scrollLeft;
} else {
var x = event.pageX;
}
var pos = ((x - baseWidth) - (document.getElementById(id).offsetWidth / 2));
if (pos < 0){ pos = 0; }
if (pos > barWidth){ pos = barWidth - document.getElementById(id).offsetWidth; }
document.getElementById(id).style.left = pos+'px';
document.getElementById(galerie).style.marginLeft = '-'+((pos / barWidth) * (document.getElementById(galerie).offsetWidth - document.getElementById(galerie).parentElement.offsetWidth))+'px';
}
loadPix(galerie.replace('galerie_',''));
}
} else {
document.getElementById(barre).onmousemove = '';
document.getElementById(id).onmousemove = '';
}
}
}
function getStyle(el,styleProp){
var x = document.getElementById(el);
if (x.currentStyle)
var y = x.currentStyle[styleProp];
else if (window.getComputedStyle)
var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
return y;
}
/* Administration */
/* Show/Hide catégories */
function showCats(type){
var box = document.getElementById("box-"+type);
var trz = document.getElementsByClassName("users")[0].getElementsByTagName("tr");
if (box.checked == true){
for (var x=1; x < trz.length; x++){
if (type == "all"){
trz[x].style.display = "table-row";
} else {
var adminMark = trz[x].className.split("-")[0];
var examMark = trz[x].className.split("-")[1];
if (type == "medecin"){
if (examMark == "m"){ trz[x].style.display = "table-row"; } else { trz[x].style.display = "none"; }
} else if (type == "invite"){
if (examMark == "v"){ trz[x].style.display = "table-row"; } else { trz[x].style.display = "none"; }
} else if (type == "admin"){
if (adminMark == "a" || adminMark == "sa"){ trz[x].style.display = "table-row"; } else { trz[x].style.display = "none"; }
} else if (type == "sAdmin"){
if (adminMark == "sa"){ trz[x].style.display = "table-row"; } else { trz[x].style.display = "none"; }
} else if (type == "radio"){
if (examMark == "r"){ trz[x].style.display = "table-row"; } else { trz[x].style.display = "none"; }
} else if (type == "secretaire"){
if (examMark == "s"){ trz[x].style.display = "table-row"; } else { trz[x].style.display = "none"; }
}
}
}
}
var liz = document.getElementById("selectShowBlock").getElementsByTagName("li");
for (var y=0; y < liz.length; y++){
if (liz[y].getElementsByTagName("span")[0].id == "label-"+type){
liz[y].getElementsByTagName("span")[0].style.fontWeight="bold";
} else {
liz[y].getElementsByTagName("span")[0].style.fontWeight="normal";
}
}
}
/* Organisation des tables */
function order_rows(link,ind,sens){
var thisTable = link.parentNode.parentNode.parentNode.parentNode;
var tbody = thisTable.getElementsByTagName("tbody")[0];
var thz = thisTable.getElementsByTagName("th");
var newTable = new Array();
var keyList = new Array();
for (var i=0; icliquez ici pour voir le compte qui y est attaché).
Si vous le souhaitez, "+altname+" est disponible.";
document.getElementById('email_field').style.display = 'none';
document.getElementById('submit').style.display = 'none';
}
} else {
var reponse = "Le nom d'utilisateur doit contenir entre 6 et 16 caractères, uniquement des chiffres, des lettres, des points ou des tirets.";
document.getElementById('email_field').style.display = 'none';
document.getElementById('submit').style.display = 'none';
}
document.getElementById("result_username").innerHTML = ""+reponse+"
";
}
function checkbeforesend(){
var reg = new RegExp("^[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*@[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*[\.]{1}[a-z]{2,6}$", "i");
var isGroup = new RegExp("^[0-9]{1,10}$", "i");
var v = 0;
if (document.getElementById("visitor").checked == true && isGroup.test(document.getElementById("var_group").value)){
var groups = new Array();
groups.push('1');
for (var f = 0; f < groups.length; f++){
if (document.getElementById("var_group").value == groups[f]){ v++; }
}
}
if (reg.test(document.getElementById("new_user_email").value)){
if (document.getElementById("admin1").checked == true){ var type_compte = "administrateur"; }
if (document.getElementById("admin2").checked == true){ var type_compte = "super-administrateur"; }
if (document.getElementById("simple_user").checked == true && document.getElementById("admin_rights1").checked != true && document.getElementById("admin_rights2").checked != true){ var type_compte = "médecin"; }
if (document.getElementById("simple_user").checked == true && document.getElementById("admin_rights1").checked == true){ var type_compte = "médecin / administrateur"; }
if (document.getElementById("simple_user").checked == true && document.getElementById("admin_rights2").checked == true){ var type_compte = "médecin / super-administrateur"; }
if (document.getElementById("radiologue").checked == true){ var type_compte = "radiologue"; }
if (document.getElementById("visitor").checked == true){ var type_compte = "invité"; }
if (document.getElementById("secretaire").checked == true){ var type_compte = "secrétaire"; }
var docname = "";
var type_acces = "";
if (document.getElementById("simple_user").checked == true && document.getElementById("access_rights1").checked == true){ type_acces = "accès limité"; docname = document.getElementById("doc_suggest").value; }
if (document.getElementById("simple_user").checked == true && document.getElementById("access_rights2").checked == true){ type_acces = "accès non-limité"; docname = document.getElementById("doc_suggest").value; }
if (document.getElementById("visitor").checked == true && document.getElementById("one_exam").checked == true){ type_acces = "accès limité aux examens "+document.getElementById("var_one_exam").value.replace(/\n/g,", "); }
if (document.getElementById("visitor").checked == true && document.getElementById("one_patient").checked == true && document.getElementById("var_one_patient").value != ""){ type_acces = "accès limité aux examens du patient "+document.getElementById("var_one_patient").value; }
if (document.getElementById("visitor").checked == true && document.getElementById("one_doctor").checked == true && document.getElementById("var_one_doctor").value != ""){ type_acces = "accès limité aux dossiers du docteur "+document.getElementById("var_one_doctor").value; }
if (document.getElementById("visitor").checked == true && document.getElementById("group").checked == true){ type_acces = "accès limité aux dossiers du groupe "+document.getElementById("var_group").value; }
if (document.getElementById("visitor").checked == true && document.getElementById("all_exams").checked == true){ type_acces = "accès non-limité"; }
var expire = "pas de date définie";
if (document.getElementById("visitor").checked == true && document.getElementById("expiration_date").value == "1s"){ expire = "dans une semaine"; }
if (document.getElementById("visitor").checked == true && document.getElementById("expiration_date").value == "1m"){ expire = "dans un mois"; }
if (document.getElementById("visitor").checked == true && document.getElementById("expiration_date").value == "3m"){ expire = "dans trois mois"; }
if (document.getElementById("visitor").checked == true && document.getElementById("expiration_date").value == "6m"){ expire = "dans six mois"; }
if (document.getElementById("visitor").checked == true && document.getElementById("expiration_date").value == "1a"){ expire = "dans un an"; }
var resume = "Vous vous apprêtez à créer un nouveau compte utilisateur. Merci de vérifier les informations fournies avant de confirmer la création.\n\n";
if (docname != ""){
resume += "Nom : "+docname+"\n";
}
resume += "Nom d'utilisateur : "+document.getElementById("username_search").value+"\nAdresse email : "+document.getElementById("new_user_email").value+"\nType de compte : "+type_compte+"\n";
if (type_acces != ""){
resume += "Droits d'accès aux examens : "+type_acces+"\n";
}
if (document.getElementById("visitor").checked == true){
resume += "Date d'expiration du compte : "+expire+"\n";
}
if (document.getElementById("radiologue").checked == true && document.getElementById("isPacs").checked == true){
resume += "Accès à PacsOne : ouvert\n";
} else if (document.getElementById("radiologue").checked == true && document.getElementById("isPacs").checked == false){
resume += "Accès à PacsOne : fermé\n";
}
resume += "\nSi ces informations sont exactes, cliquez sur OK pour confirmer la création de compte.\nSinon, cliquez sur ANNULER pour effectuer des rectifications.";
if ((document.getElementById("visitor").checked == true && type_acces == "") || (document.getElementById("simple_user").checked == true && type_acces == "")){
alert("Vous devez renseigner les droits d'accès du compte.");
return false;
} else if (document.getElementById("visitor").checked == true && document.getElementById("group").checked == true && document.getElementById("var_group").value == ""){
alert("Vous devez renseigner un numéro de groupe.");
return false;
} else if (document.getElementById("visitor").checked == true && document.getElementById("group").checked == true && !isGroup.test(document.getElementById("var_group").value)){
alert("Un numéro de groupe ne peut contenir que des chiffres.");
return false;
} else if (document.getElementById("visitor").checked == true && document.getElementById("group").checked == true && v == 0){
alert("Le groupe que vous avez renseigné n'existe pas.");
return false;
} else {
return confirm(resume);
}
} else {
alert("L\'adresse email que vous avez fournie n\'est pas valide.");
return false;
}
}
function checknewgroupuserbeforesend(){
var v = 0;
var groups = new Array();
groups.push('1');
for (var f = 0; f < groups.length; f++){
if (document.getElementById("newgroup").value == groups[f]){ v++; }
}
var resume = "Vous vous apprêtez à ajouter cet utilisateur au groupe n°";
resume += " "+document.getElementById("newgroup").value+".\n";
resume += "Souhaitez-vous continuer ?";
if (v == 0){
alert("Le groupe que vous avez renseigné n\'existe pas.");
return false;
} else {
return confirm(resume);
}
}
function checkgroupbeforesend(action){
if (document.getElementById("one_doctor").checked != true && document.getElementById("share_all").checked != true && document.getElementById("unlimited").checked != true && document.getElementById("center").checked != true){
alert("Vous devez renseigner les droits associés au groupe.");
return false;
} else if (document.getElementById("one_doctor").checked == true && document.getElementById("doc_suggest").value == ""){
alert("Vous devez sélectionner un médecin dans la liste pour cette option.");
return false;
} else if (document.getElementById("center").checked == true && document.getElementById("centerPick").value == "--"){
alert("Vous devez sélectionner un centre demandeur.");
return false;
} else if (parseInt(document.getElementById("nb_membres").innerHTML) < 1){
alert("Vous devez sélectionner au moins un membre.");
return false;
} else {
if (action == 1){
var resume = "Vous vous apprêtez à créer un nouveau groupe d'utilisateurs. Merci de vérifier les informations fournies avant de confirmer la création.\n\n";
} else if (action == 2){
var resume = "Vous vous apprêtez à modifier ce groupe d'utilisateurs. Merci de vérifier les informations fournies avant de confirmer les changements.\n\n";
}
resume += "Objet du groupe : ";
if (document.getElementById("commentaires").value == ""){ resume += "non renseigné\n\n"; } else { resume += document.getElementById("commentaires").value+"\n\n"; }
resume += "Droits associés : ";
if (document.getElementById("one_doctor").checked == true){
resume += "les membres ont accès aux examens du docteur "+document.getElementById("doc_suggest").value+"\n\n";
} else if (document.getElementById("center").checked == true){
resume += "les membres ont accès aux examens demandés par "+document.getElementById("centerPick").value+"\n\n";
} else if (document.getElementById("share_all").checked == true){
resume += "les membres ont accès aux examens des autres membres du groupe.\n\n";
} else if (document.getElementById("unlimited").checked == true){
resume += "les membres ont accès à tous les examens de la base.\n\n";
}
resume += "Liste des membres :\n";
var checkbox = document.getElementsByClassName("checkbox");
for(var x = 0; x < checkbox.length; x++){
if (checkbox[x].id.substring(0,5) == "pick-" && checkbox[x].checked == true){ resume += checkbox[x].parentNode.getElementsByTagName("span")[0].innerHTML+"\n"; }
}
resume += "\nSi ces informations sont exactes, cliquez sur OK pour confirmer la création de compte.\nSinon, cliquez sur ANNULER pour effectuer des rectifications.";
return confirm(resume);
}
}
/* Gestion des groupes */
function entoure(box){
if (box.parentNode.className == 'selectedMember'){
box.parentNode.className = '';
var nb_membres = parseInt(document.getElementById('nb_membres').innerHTML);
document.getElementById('nb_membres').innerHTML = (nb_membres - 1);
} else if (box.parentNode.className == ''){
box.parentNode.className = 'selectedMember';
var nb_membres = parseInt(document.getElementById('nb_membres').innerHTML);
document.getElementById('nb_membres').innerHTML = (nb_membres + 1);
}
}
function onScroll(){
var thisScroll = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
document.getElementById('left_col').style.top = '-'+thisScroll+'px';
if (document.getElementById('left_col').offsetTop < -115){ document.getElementById('left_col').style.top = '-115px'; }
}
/* Défilement des boutons d'examens supplémentaires dans le viewer */
function moveExams(sens){
var surBarre = document.getElementById('otherExamsBar');
var barre = document.getElementById('innerOtherExams');
if (barre.offsetWidth > surBarre.offsetWidth){
if (sens == 0){
var move = (barre.offsetLeft - (surBarre.offsetWidth / 2));
if (move < '-'+(barre.offsetWidth - surBarre.offsetWidth)){ move = '-'+(barre.offsetWidth - surBarre.offsetWidth); }
barre.style.marginLeft = move+'px';
} else if (sens == 1){
var move = (barre.offsetLeft + (surBarre.offsetWidth / 2));
if (move > 0){ move = 0; }
barre.style.marginLeft = move+'px';
}
}
}
function checkButtonSize(){
var surBarre = document.getElementById('otherExamsBar');
var barre = document.getElementById('innerOtherExams');
var buttons = document.getElementsByClassName('otherExamMove');
if (barre.offsetWidth > surBarre.offsetWidth){
for (var x = 0; x < buttons.length; x++){ buttons[x].style.display = 'block'; barre.style.padding = '0 20px'; }
} else {
for (var x = 0; x < buttons.length; x++){ buttons[x].style.display = 'none'; barre.style.padding = '0'; }
}
setTimeout('checkButtonSize()',1000);
}
/* Lancement du cadre d'édition des comptes-rendus */
function launchEdit(info){
var data = info.split('|');
var studyUid = data[0];
var pName = decodeURIComponent(data[2]);
var viewerLink = 'dicomviewer.php?studyuid='+studyUid+'&p='+data[1];
var editPage = document.createElement('div');
editPage.id = 'editorPage';
editPage.innerHTML = 'Enregistrer
Valider le compte-rendu
Ce compte-rendu a été validé et ne peut plus être modifié.
';
var objReq2 = new XMLHttpRequest();
objReq2.onreadystatechange = function (){
if (this.readyState == 4 && this.status == 200){
if (objReq2.responseText.split('|')[0].trim() == 'yes'){
document.getElementById('ordHere').className = 'oIsOn';
document.getElementById('ordHere').innerHTML = 'Ordonnance';
} else {
document.getElementById('ordHere').innerHTML = '';
}
}
};
var url = 'systemfile.php?func=isOrdonnanceOn&study='+studyUid;
objReq2.open("GET", url, true);
objReq2.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
objReq2.send();
document.body.style.overflow='hidden';
document.body.appendChild(editPage);
var objReq= new XMLHttpRequest();
objReq.onreadystatechange = function (){
if (this.readyState == 4 && this.status == 200){
document.getElementById('pData').innerHTML = objReq.responseText;
document.getElementById('pData').style.left = '-'+(document.getElementById('pData').offsetWidth * 1.2)+'px';
}
};
var url = 'systemfile.php?func=getPatientData&study='+studyUid;
objReq.open("GET", url, true);
objReq.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
objReq.send();
setTimeout("document.getElementById('editorPage').style.top = '0';",500);
}
function setTinyFull(studyUid){
document.getElementById('editLeft').getElementsByTagName('iframe')[0].style.width = (document.getElementById('editLeft').getElementsByTagName('iframe')[0].offsetWidth + 1)+'px';
setTimeout("document.getElementById('editLeft').getElementsByTagName('iframe')[0].removeAttribute('style')",200);
saveThisText(studyUid,'check');
}
function closeEdit(){
document.getElementById('editorPage').style.top = '110%';
document.body.style.overflow='auto';
setTimeout("document.body.removeChild(document.getElementById('editorPage'));",1500);
}
function togglePData(){
var pData = document.getElementById('pData')
if (pData.offsetLeft < 0){
pData.style.left='0';
} else {
pData.style.left='-1000px';
}
}
function toggleLeftEdit(){
var leftEdit = document.getElementById('editLeft');
var widthHandler = document.getElementById('widthHandler');
leftEdit.style.WebkitTransition = 'left, right 1s';
widthHandler.style.WebkitTransition = 'left 1s';
leftEdit.style.transition = 'left, right 1s';
widthHandler.style.transition = 'left 1s';
if (leftEdit.offsetLeft < 0){
leftEdit.style.left = '0';
leftEdit.style.right = '6px';
widthHandler.style.left = 'calc(100% - 6px)';
} else if (leftEdit.offsetLeft >= 0){
leftEdit.style.left = '-105%'; leftEdit.style.right = '105%';
widthHandler.style.left = '-5%';
}
setTimeout("document.getElementById('editLeft').style.WebkitTransition = 'all 0s ease 0s'; document.getElementById('widthHandler').style.WebkitTransition = 'all 0s ease 0s'; document.getElementById('editLeft').style.transition = 'all 0s ease 0s'; document.getElementById('widthHandler').style.transition = 'all 0s ease 0s';",1500);
}
function setWidth(){
document.getElementById('editorPage').onmousedown = function(){
document.getElementById('editorPage').onmousemove = function(event){
event = event || window.event;
if (navigator.appName == "Microsoft Internet Explorer"){ var x = event.x+document.body.scrollLeft; } else { var x = event.pageX; }
if (x < 3){ x = 3; }
document.getElementById('widthHandler').style.left = (x - 3)+'px';
document.getElementById('editLeft').style.right = ((document.getElementById('editorPage').offsetWidth - x) - 3)+'px';
if (document.getElementById('editRight').getElementsByClassName('cacheFrame').length == 0){
var rightCache = document.createElement('div');
rightCache.className = 'cacheFrame';
document.getElementById('editRight').appendChild(rightCache);
}
if (document.getElementById('editLeft').getElementsByClassName('cacheFrame').length == 0){
var leftCache = document.createElement('div');
leftCache.className = 'cacheFrame';
document.getElementById('editLeft').appendChild(leftCache);
}
document.getElementById('editRight').getElementsByClassName('cacheFrame')[0].style.zIndex='10';
document.getElementById('editLeft').getElementsByClassName('cacheFrame')[0].style.zIndex='10';
}
}
document.getElementById('editorPage').onmouseup = function(){
document.getElementById('editorPage').onmousedown = '';
document.getElementById('editorPage').onmousemove = '';
document.getElementById('editRight').getElementsByClassName('cacheFrame')[0].style.zIndex='-1';
document.getElementById('editLeft').getElementsByClassName('cacheFrame')[0].style.zIndex='-1';
}
}
function blocNote(studyUid){
if (!document.getElementById('blocNote')){
var bloc = document.createElement('div');
bloc.id = 'blocNote';
bloc.innerHTML = '';
document.getElementById('editorPage').appendChild(bloc);
}
if (document.getElementById('blocNote').offsetLeft >= document.getElementById('editorPage').offsetWidth){
document.getElementById('blocNote').style.right = '0';
} else {
document.getElementById('blocNote').style.right = '-'+(document.getElementById('blocNote').offsetWidth * 1.2)+'px';
}
}
function prepValid(studyUid){
if (confirm('Vous vous apprétez à valider le contenu de ce compte-rendu.\n Une fois le compte-rendu validé, il ne pourra plus être modifié.\n Ãtes-vous certain de souhaiter poursuivre ? Cliquez sur OK pour confirmer ou sur ANNULER pour ne pas valider.')){
saveThisText(studyUid,'valid');
}
}
function saveThisText(studyUid,action){
var y = document.getElementById('mce_0_ifr');
var z = (y.contentWindow || y.contentDocument);
var save = encodeURIComponent(z.document.getElementById('tinymce').innerHTML).replace("%E2%80%99","'").replace("%E2%80%93","-");
var objReq= new XMLHttpRequest();
objReq.onreadystatechange = function (){
if (this.readyState == 4 && this.status == 200){
if (action == 'save'){
alert(decodeURIComponent(objReq.responseText));
}
}
};
var url = 'systemfile.php?func=saveTextContent&study='+studyUid+'&action='+action;
objReq.open("POST", url, true);
objReq.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
objReq.send('content='+save);
}