<!--

function switchToggle(id, display, hide){

	dom = document.getElementById ? 1 : 0;
	ie4 = (document.all && !dom) ? 1 : 0;
	opera = (navigator.userAgent.indexOf('Opera')!=-1) ? 1 : 0;
	supported = ((dom||ie4) && !(opera)) ? 1 : 0;

	if(!supported) {
		return;
	}

	if (dom && !document.all) {
		document.all = document.getElementsByTagName("*");
	}

	obj = (dom) ? document.getElementById(id) : document.all(id);

	if(obj.style.display == hide) {
		obj.style.display = display;
	} else {
		obj.style.display = hide;
	}

}

function switchText(id, text1, text2) {
	dom = document.getElementById ? 1 : 0;
	ie4 = (document.all && !dom) ? 1 : 0;
	opera = (navigator.userAgent.indexOf('Opera')!=-1) ? 1 : 0;
	supported = ((dom||ie4) && !(opera)) ? 1 : 0;

	if(!supported) {
		return;
	}

	if (dom && !document.all) {
		document.all = document.getElementsByTagName("*");
	}

	obj = (dom) ? document.getElementById(id) : document.all(id);
	obj.innerHTML = obj.innerHTML == text1 ? text2 : text1;

}

function switchImage(id, img1, img2) {
	dom = document.getElementById ? 1 : 0;
	ie4 = (document.all && !dom) ? 1 : 0;
	opera = (navigator.userAgent.indexOf('Opera')!=-1) ? 1 : 0;
	supported = ((dom||ie4) && !(opera)) ? 1 : 0;

	if(!supported) {
		return;
	}

	if (dom && !document.all) {
		document.all = document.getElementsByTagName("*");
	}

	obj = (dom) ? document.getElementById(id) : document.all(id);
	obj.src = obj.src.indexOf(img1) > 0 ? img2 : img1;

}
function setCriteriaState(id, id2) {
	obj1 = getObject(id);
	obj2 = getObject(id2);
	
	//alert(obj1.style.display);
	obj2.value = obj1.style.display;
	//alert(obj2.value);
}

function getObject(id) {
	dom = document.getElementById ? 1 : 0;
	ie4 = (document.all && !dom) ? 1 : 0;
	opera = (navigator.userAgent.indexOf('Opera')!=-1) ? 1 : 0;
	supported = ((dom||ie4) && !(opera)) ? 1 : 0;

	if(!supported) {
		return;
	}

	if (dom && !document.all) {
		document.all = document.getElementsByTagName("*");
	}

	obj = (dom) ? document.getElementById(id) : document.all(id);
	return obj;
}

function alertValue(id) {
	dom = document.getElementById ? 1 : 0;
	ie4 = (document.all && !dom) ? 1 : 0;
	opera = (navigator.userAgent.indexOf('Opera')!=-1) ? 1 : 0;
	supported = ((dom||ie4) && !(opera)) ? 1 : 0;

	if(!supported) {
		return;
	}

	if (dom && !document.all) {
		document.all = document.getElementsByTagName("*");
	}

	obj = (dom) ? document.getElementById(id) : document.all(id);

	alert(obj.value);
}

function setElementValue(id, value) {
	dom = document.getElementById ? 1 : 0;
	ie4 = (document.all && !dom) ? 1 : 0;
	opera = (navigator.userAgent.indexOf('Opera')!=-1) ? 1 : 0;
	supported = ((dom||ie4) && !(opera)) ? 1 : 0;

	if(!supported) {
		return;
	}

	if (dom && !document.all) {
		document.all = document.getElementsByTagName("*");
	}

	obj = (dom) ? document.getElementById(id) : document.all(id);

	obj.value = value;

}


function toggle(id, display){

	dom = document.getElementById ? 1 : 0;
	ie4 = (document.all && !dom) ? 1 : 0;
	opera = (navigator.userAgent.indexOf('Opera')!=-1) ? 1 : 0;
	supported = ((dom||ie4) && !(opera)) ? 1 : 0;

	if(!supported) {
		return;
	}

	if (dom && !document.all) {
		document.all = document.getElementsByTagName("*")
	}

	obj = (dom) ? document.getElementById(id) : document.all(id)

	obj.style.display = display;
}

function get_window_size()
   {
   var w = h = 0;
   if(document.body && document.body.clientWidth)
     {
     w = parseInt(document.body.clientWidth);
     h = parseInt(document.body.clientHeight);
     }
   else if(window.innerWidth)
     {
     w = parseInt(window.innerWidth);
     h = parseInt(window.innerHeight);
     }
   return { width:w, height:h+30 };
   }

//  Function to open windows 

function fermer(page) {
opener.location.href=page;
window.close();

}

function WM_preloadImages() {

/*
WM_preloadImages()
Loads images into the browser's cache for later use.

Source: Webmonkey Code Library
(http://www.hotwired.com/webmonkey/javascript/code_library/)

Author: Nadav Savio
Author Email: nadav@wired.com

Usage: WM_preloadImages('image 1 URL', 'image 2 URL', 'image 3 URL', ...);
*/

  // Don't bother if there's no document.images
  if (document.images) {
    if (typeof(document.WM) == 'undefined'){
      document.WM = new Object();
    }
    document.WM.loadedImages = new Array();
    // Loop through all the arguments.
    var argLength = WM_preloadImages.arguments.length;
    for(arg=0;arg<argLength;arg++) {
      // For each arg, create a new image.
      document.WM.loadedImages[arg] = new Image();
      // Then set the source of that image to the current argument.
      document.WM.loadedImages[arg].src = WM_preloadImages.arguments[arg];
    }
  }
}

function WM_imageSwap(daImage, daSrc){
  var objStr,obj;
  /*
    WM_imageSwap()
    Changes the source of an image.

    Source: Webmonkey Code Library
    (http://www.hotwired.com/webmonkey/javascript/code_library/)

    Author: Shvatz
    Author Email: shvatz@wired.com

    Usage: WM_imageSwap(originalImage, 'newSourceUrl');

    Requires: WM_preloadImages() (optional, but recommended)
    Thanks to Ken Sundermeyer (ksundermeyer@macromedia.com) for his help
    with variables in ie3 for the mac. 
    */

  // Check to make sure that images are supported in the DOM.
  if(document.images){
    // Check to see whether you are using a name, number, or object
    if (typeof(daImage) == 'string') {
      // This whole objStr nonesense is here solely to gain compatability
      // with ie3 for the mac.
      objStr = 'document.' + daImage;
      obj = eval(objStr);
      obj.src = daSrc;
    } else if ((typeof(daImage) == 'object') && daImage && daImage.src) {
      daImage.src = daSrc;
    }
  }
}
	
function openpop(page,w,h,sc,t,st,r)  {
        //pour changer la variable popup a chaque click 
        var now = new Date();
        popup = now.getTime();
        popupwin=window.open(page, popup, "width="+w+",height="+h+",scrollbars="+sc+",toolbar="+t+",status="+st+",resizable="+r);
        }

function openpopRoom(page,w,h,sc,t,st,r)  {
        var now = new Date();
        popup = now.getTime();
        RoomPopup=window.open(page, popup, "width="+w+",height="+h+",scrollbars="+sc+",toolbar="+t+",status="+st+",resizable="+r);
        }
function openpopRoom2(page,uid)  {
        var now = new Date();
        popup = now.getTime();
        RoomPopup=window.open(page, popup, "width=1010,height=755,scrollbars=0,toolbar=0,status=0,resizable=0");
        }
function openpopRoomV2a(page,uid)  {
        var now = new Date();
        popup = now.getTime();
        RoomPopup=window.open(page, popup, "width=1010,height=690,scrollbars=0,toolbar=0,status=0,resizable=1");
        }        
function openpoproom3(page)  {
        var now3 = new Date();
        popup3 = now3.getTime();
        roompopup=window.open(page, popup3, "width=1010,height=755,scrollbars=0,toolbar=0,status=0,resizable=0");
        }
function openpopRoomNew(page,uid)  {
        var now = new Date();
        popup = now.getTime();
        RoomPopup=window.open(page, popup, "width=1022,height=742,scrollbars=0,toolbar=0,status=0,resizable=1");
        }        

function openpopRoomNew2(page,uid)  {
        var now = new Date();
        popup = now.getTime();
        RoomPopup2=window.open(page, popup, "width=1022,height=742,scrollbars=0,toolbar=0,status=0,resizable=1");
        }           
function closeRoom(page,w,h,sc,t,st,r)  {
        RoomPopup=window.open(page, "RoomPopup", "width="+w+",height="+h+",scrollbars="+sc+",toolbar="+t+",status="+st+",resizable="+r);
        }

function CheckIfPopup() {
		if (window.opener)
			{
			window.close();
			window.opener.location.href = "accueil.aspx";
			window.opener.focus();
			
			}
		}
		
function LogOut() {
		if (window.opener)
			{
			window.close();
			
			window.opener.location.href = "accueil.aspx";
			window.opener.focus();
			
			}
		else {
		    
			window.location.href = "accueil.aspx";
			}
		}		
function textLimit(field, maxlen) {
if (field.value.length > maxlen + 1)
alert('Votre texte est trop long');
if (field.value.length > maxlen)
field.value = field.value.substring(0, maxlen);
}

function openTarget(form, windowName) {

    windowName = 'formTarget' + (new Date().getTime());
	form.target = windowName;
	window.open('abonnement_choisir.aspx', windowName, 'width=740,height=540,resizable=1,scrollbars=1,toolbar=0,status=1');
	window.location='abonnement_bf.aspx';

}
//-->
