if(window!=window.top){top.location.href=location.href;}
$().ready(function() {
var b_version=navigator.appVersion;
if (b_version.indexOf('MSIE6')==-1){
$("#page_right").css("width",'68%');
}
$("input[type='text']:first", document.forms[1]).focus();
});
function growTAVert (textarea) {
var lineBreaks = countLineBreaks(textarea.value);
if (textarea.rows * textarea.cols < textarea.value.length) {
var newRows = lineBreaks +
parseInt(textarea.value.length / textarea.cols) + 2;
newRows = newRows <= 40 ? newRows : 40;
textarea.rows = newRows;
} else if (textarea.rows < lineBreaks) {
textarea.rows = lineBreaks + 2;
}
}
function getElementWidth(objectId) {
x = document.getElementById(objectId);
if (!x) return 0;
return x.offsetWidth;
}
function getAbsoluteLeft(objectId) {
o = document.getElementById(objectId);
if (!o) return 0;
oLeft = o.offsetLeft;
while(o.offsetParent!=null) {
oParent = o.offsetParent;
oLeft += oParent.offsetLeft;
o = oParent;
}
return oLeft;
}
function getAbsoluteTop(objectId) {
o = document.getElementById(objectId);
if (!o) return 0;
oTop = o.offsetTop;
while(o.offsetParent!=null) {
oParent = o.offsetParent;
oTop += oParent.offsetTop;
o = oParent;
}
return oTop;
}
function PPwithDiv(link_url,width, height,objectId){
document.getElementById('float_window_iframe').src=link_url;
if (!$.browser.msie){
var toppx=10;
if (objectId && getAbsoluteTop(objectId)){
toppx = getAbsoluteTop(objectId)- 350;
if (toppx<10) toppx=10;
}
var s_width = ((screen.width)/2) - 300;
var s_height = screen.height;
$("#float_window").css({left: s_width+'px', top: toppx+'px'});
$("#float_allbody").css({height: document.body.clientHeight+'px', width: document.body.clientWidth+'px'});
}
$("#float_allbody").show();
$("#float_window").show();
}
function float_window_close(){
$("#float_allbody").hide();
$("#float_window").hide();
}
function PopUpEx(sendLink, name, width, height, scrollbars,objectId) {
PPwithDiv(sendLink,width,height,objectId);
//mm= "width=" + width + ",height=" + height + ",scrollbars=" + scrollbars + ",resizable=" + scrollbars;
//win = window.open(sendLink, name, mm);
//if (win && win.open && !win.closed)
// win.focus();
//return win;
}
function PopUpPicInCensor(sendLink, name, width, height, scrollbars,objectId) {
mm= "width=" + width + ",height=" + height + ",scrollbars=" + scrollbars + ",resizable=" + scrollbars;
win = window.open(sendLink, name, mm);
if (win && win.open && !win.closed)
win.focus();
}
function PopUp(sendLink, name, width, height, scrollbars,objectId) {
PopUpEx(sendLink, name, width, height, scrollbars,objectId);
}
function need_pay(){
window.open('/?page=pay');
}
function newwindow(a,windowname, width, height, scrollbars, process_link,objectId){
PopUpEx(a.href, windowname, width, height, scrollbars,objectId);
//var mm= "width=" + width + ",height=" + height + ",scrollbars=" + scrollbars + ",resizable=" + scrollbars;
//var url = a.href;
//window.open(a.href, windowname, mm);return;
//var win = window.open(a.href, windowname, mm);
//if (win && win.open && !win.closed){
// win.focus();
//}
if(process_link == null){
process_link = false;
}
return process_link;
}
function window_move(element,event){
var x=parseInt(element.style.left);
var y=parseInt(element.style.top);
var maxLeft=parseInt(document.body.clientWidth)-parseInt(element.clientWidth);
var maxTop=parseInt(document.body.clientHeight)-parseInt(element.clientHeight);
var deltaX=event.clientX-x;
var deltaY=event.clientY-y;
if(document.addEventListener){
document.addEventListener("mousemove",moveHandler,true);
document.addEventListener("mouseup",upHandler,true);
}else if(document.attachEvent){//IE5+
document.attachEvent("onmousemove",moveHandler);
document.attachEvent("onmouseup",upHandler);
}else{//IE4
var oldonmousemove=document.onmousemove;
var oldonmouseup=document.onmouseup;
document.onmousemove=moveHandler;
document.onmouseup=upHandler;
}
if(event.preventDefault){
event.preventDefault();
}else{
event.returnValue=false;
}
function moveHandler(e){
if(!e){//IE
e=window.event;
}
element.style.left=(e.clientX-deltaX)+"px";
element.style.top=(e.clientY-deltaY)+"px";
var left=parseInt(element.style.left);
var top=parseInt(element.style.top);
if(left<0){
element.style.left="0px";
}
if(left>maxLeft){
element.style.left=maxLeft+"px";
}
if(top<0){
element.style.top="0px";
}
if(top>maxTop){
element.style.top=maxTop+"px";
}
if(e.stopPropagation){
e.stopPropagation();
}else{//IE
e.cancelBubble=true;
}
}
function upHandler(e){
if(!e){
e=window.event;
}
if(document.removeEventListener){
document.removeEventListener("mouseup",upHandler,true);
document.removeEventListener("mousemove",moveHandler,true);
}else if(document.detachEvent){
document.detachEvent("onmouseup",upHandler);
document.detachEvent("onmousemove",moveHandler);
}else{//IE4
document.onmouseup=oldonmouseup;
document.onmousemove=oldonmousemove;
}
if(e.stopPropagation){
e.stopPropagation();
}else{//IE
e.cancelBubble=true;
}
}
}
function deleteBatch(theBox,theArray,confirm_txt) {
if (!confirm_txt) confirm_txt="Etes-vous sûr(e) de vouloir supprimer les profils?";
if(confirm(confirm_txt))
{
theArray.submit();
}
}
function clickOnceForm(f){
f.value='Veuillez patienter...';
f.disabled=true;
}
function on_search_focus(obj) {
if(obj.value == 'Identifiant, titre') {
obj.style.color='#000000';
obj.value='';
}
}
function on_search_blur(obj) {
if (obj.value == '') {
obj.style.color='#818181';
obj.value = 'Identifiant, titre';
}
}
function checkMessages(theBox,theArray) {
if ( theBox.checked ) {
for (i = 0; i < theArray.elements.length; i++) {
try{
theArray.elements[i].checked = true ;
}catch(e){}
}
} else {
for (i = 0; i < theArray.elements.length; i++) {
try{
theArray.elements[i].checked = false ;
}catch(e){}
}
}
}
function fixForm(c)
{
var i;
var n = c.name;
var l = c.form.elements.length;
if (!c.checked) return;
if (c.value == '' || c.value ==0) {
for (i = 0 ; i < l ; i++){
var e = c.form.elements[i];
if(e.name == n && e.value != c.value) e.checked=false;
}
} else {
for (i = 0 ; i < l ; i++){
var e = c.form.elements[i];
if(e.name == n && (e.value == '0' || e.value=="")) e.checked=false;
}
}
return;
}
function show_chose(obj){
if( $("#"+obj).css("display")=="none"){
$("#"+obj).css("display","block");
$("#c_"+obj).html("Taille");
}else{
$("#"+obj).css("display","none");
$("#c_"+obj).html("Montrer");
}
}
function rand(n){
return ( Math.floor ( Math.random ( ) * n + 1 ) );
}