var MyMenu = new Array();
MyMenu[0] = 'menu 1';
MyMenu[1] = 'menu 2';
  
/**** Library vdl2 ***************************************************************************/
getObjLeft = function(obj, parentRef)
{
    oLeft = obj.offsetLeft
    while(obj.offsetParent!=null && !(parentRef && obj.offsetParent == parentRef))
    {
        oParent = obj.offsetParent
        oLeft += oParent.offsetLeft
        obj = oParent
    };
    return oLeft
};

getObjTop = function(obj, parentRef)
{
    objTop = obj.offsetTop
    while(obj.offsetParent!=null && !(parentRef && obj.offsetParent == parentRef))
    {
        objParent = obj.offsetParent
        objTop += objParent.offsetTop
        obj = objParent
    };
    return objTop
};
/**** Library vdl2 ***************************************************************************/

KeyCodeAction = function (action, keyCode) {

	if (Prototype.Browser.IE){
		document.onkeydown  = function () {
		if(window.event.keyCode == keyCode) {
		 	return true;
		}
		}
	}
	else {
	Event.observe(document, 'keypress', function(event){ 
		if(event.keyCode == keyCode) {
			return true;
		}
	});
	}
	return false;
}

var xmlhttp
var Target = null;

function loadXMLDoc(url, TargetID)
{
//	alert (url + TargetID);
	Target = TargetID; 

// code for Mozilla, etc.
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest()
  xmlhttp.onreadystatechange=state_Change;
  xmlhttp.open("POST",url,true)
  xmlhttp.send(null)
  }

//ActiveXObject("Microsoft.XMLHTTP");
else if (window.ActiveXObject)
  { 
	  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    if (xmlhttp)
    {
    xmlhttp.onreadystatechange=state_Change;
    xmlhttp.open("POST",url,true)
    xmlhttp.send()
    }
  }

/*	return xmlhttp;*/
}

function state_Change()
{
// if xmlhttp shows "loaded"
if (xmlhttp.readyState==4)
  {
  // if "OK"
  if (xmlhttp.status==200)
  {	
	//	alert (xmlhttp.responseText);
		document.getElementById(Target).innerHTML = '';
		document.getElementById(Target).innerHTML = xmlhttp.responseText;
  }
  else
  {
	  alert("Problem retrieving data:" + xmlhttp.statusText)
  }
  }
}



function showResponseInfo(originalRequest)
	{
		//put returned XML in the textarea
		$('MyInformation').innerHTML = originalRequest.responseText;
	}


function showResponse(originalRequest)
	{	//alert (originalRequest);
		//put returned XML in the textarea
		
		$('Main').innerHTML = originalRequest.responseText;
		if ($('MyIntro')){
			Event.observe('titre', 'focus', function (){
				$('titre').style.border = '2px solid #999';
				$('titre').style.background = '#fff';
			});
			
			Event.observe('titre', 'blur', function (){
				$('titre').style.border = '2px solid #bbb';
				$('titre').style.background = '#ddd';
			});

			Event.observe('MyIntro', 'focus', function (){
				$('MyIntro').style.border = '2px solid #999';	
			}); 
			Event.observe('MyIntro', 'blur', function (){
				$('MyIntro').style.border = '2px solid #bbb';
				
			});
			Event.observe('MyIntro', 'keypress', function (){
				$('MyIntro').style.border = '2px solid #999';
				$('inputsave').style.border = '1px solid #999';
				$('inputsave').style.background = '#f00';
			});
		}
		if ($('description')){
			
			Event.observe('titre', 'focus', function (){
				$('titre').style.border = '2px solid #999';
				$('titre').style.background = '#fff';
			});
			
			Event.observe('titre', 'blur', function (){
				$('titre').style.border = '2px solid #bbb';
				$('titre').style.background = '#ddd';
			});
			
			Event.observe('description', 'focus', function (){
				$('description').style.border = '2px solid #999';
				$('description').style.background = '#fff';
			}); 
			Event.observe('description', 'blur', function (){
				$('description').style.border = '2px solid #bbb';
				$('description').style.background = '#ddd';
				
			});
			Event.observe('description', 'keypress', function (){
				$('description').style.border = '2px solid #999';
				$('inputsave').style.border = '1px solid #f99';
				$('inputsave').style.background = '#f00';
			});
		}
}
	
function showResponseNote(originalRequest)
	{
		//put returned XML in the textarea
				
		$('container').innerHTML = originalRequest.responseText;
	//	$('ArLeft').style.display = 'inline';
	//	$('ArRight').style.display = 'inline';

//	if ($('ArLeft'))
//		 $('Main').removeChild($('ArLeft'));	
		//$('Main').appendChild($('ArLeft'));
		//$('Main').appendChild($('ArRight'));
	}
	
function getIntro(){
	$('MyImagesMain').src = '/gallery/images/img-accu-f.jpg';
	MyPkPhoto = 0;
	MyNote.getIntro();
}
	
function showResponseInformation(originalRequest)
{
	//put returned XML in the textarea
	$('ControlBox').innerHTML = originalRequest.responseText;
	$('MyInformation').onclick = function () {
		var MyTempInfo = $('MyInformation').innerHTML;
		$('MyInformation').innerHTML = '<textarea style="width : 120px; height : 200px; font-size : 10px;" id="MyInformationText">' + MyTempInfo + '</textarea>'
//			$('MyInformation').innerHTML = '<textarea id="MyInformationText"></textarea>'
	};
}

	