
var _dialogPromptID=null;
var _blackoutPromptID=null;
var page_ = '';
///////////////////////////////////////////////////////////
 
function promp(page_, topp, leftt, widthh, FONC) {

that=this;

   // Check to see if this is MSIE 7.   This isn't a great general purpose
   // detection system but it works well enough just to find MSIE 7.
   var _isIE7=true;

   this.wrapupPrompt = function (cancled) {
      // wrapupPrompt is called when the user enters or cancels the box.
      // It's called only by the IE7 dialog box, not the non IE prompt box
      if (_isIE7) {
         // Make sure we're in IE7 mode and get the text box value

         // clear out the dialog box
         _dialogPromptID.style.display='none';
         // clear out the screen
         _blackoutPromptID.style.display='none';
         // clear out the text field
			
         // if the cancel button was pushed, force value to null.
         // call the user's function
         //eval (fonc +'(val,ID,nom)');
      }
      return false;
   }

   //if def wasn't actually passed, initialize it to null
 var scrOfX = 0, scrOfY = 0;
			  if( typeof( window.pageYOffset ) == 'number' ) {
				//Netscape compliant
				scrOfY = window.pageYOffset;
				scrOfX = window.pageXOffset;
			  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
				//DOM compliant
				scrOfY = document.body.scrollTop;
				scrOfX = document.body.scrollLeft;
			  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
				//IE6 standards compliant mode
				scrOfY = document.documentElement.scrollTop;
				scrOfX = document.documentElement.scrollLeft;
			  }

   if (_isIE7) {
      // If this is MSIE 7.0 then...
      if (_dialogPromptID==null) {
         // Check to see if we've created the dialog divisions.
         // This block sets up the divisons
         // Get the body tag in the dom
         var tbody = document.getElementsByTagName("body")[0];
         // create a new division
         tnode = document.createElement('div');
         // name it
         tnode.id='IEPromptBox';
         // attach the new division to the body tag
         tbody.appendChild(tnode);
         // and save the element reference in a global variable
         _dialogPromptID=document.getElementById('IEPromptBox');
         // Create a new division (blackout)
         tnode = document.createElement('div');
         // name it.
         tnode.id='_blackoutPromptID';
         // attach it to body.
         tbody.appendChild(tnode);
         // And get the element reference
         _blackoutPromptID=document.getElementById('_blackoutPromptID');
         // assign the styles to the blackout division.
		 _blackoutPromptID.name = '_blackoutPromptID';
         _blackoutPromptID.style.opacity='.9';
         _blackoutPromptID.style.position='absolute';
         _blackoutPromptID.style.top='0px';
         _blackoutPromptID.style.left='0px';
         _blackoutPromptID.style.backgroundColor='#555555';
         _blackoutPromptID.style.filter='alpha(opacity=50)';
         _blackoutPromptID.style.zIndex='50';
         // assign the styles to the dialog box
		 
         _dialogPromptID.style.border='1px solid #FFFFFF';
		 _dialogPromptID.style.paddingTop='15px';
		 //_dialogPromptID.style.borderTop='10px solid #FFFFFF';
         _dialogPromptID.style.backgroundColor='#DDDDDD';
         _dialogPromptID.style.position='absolute';
		 _dialogPromptID.style.cursor='move';
         _dialogPromptID.style.zIndex='100';
		 
      }
      // This is the HTML which makes up the dialog box, it will be inserted into
      // innerHTML later. We insert into a temporary variable because
      // it's very, very slow doing multiple innerHTML injections, it's much
      // more efficient to use a variable and then do one LARGE injection.
      
      // Stretch the blackout division to fill the entire document
      // and make it visible.  Because it has a high z-index it should
      // make all other elements on the page unclickable.
      _blackoutPromptID.style.width='100%';
	  _blackoutPromptID.style.height= '2000px';/*(document.body.offsetHeight<screen.height) ? screen.height+'px' : document.body.offsetHeight+20+'px'; */		
	  _blackoutPromptID.style.display='block';
      // Insert the tmp HTML string into the dialog box.
      // Then position the dialog box on the screen and make it visible.
	  
	  content = document.createElement('div');
	  content.id = 'content';
	  content.style.backgroundColor='#DDDDDD';
         // name it.
         // attach it to body.
		 	divcroix = document.createElement('div'); 
			divcroix.style.backgroundColor='#DDDDDD';
		 	divcroix.className = 'divcroix';
		 	croix=document.createElement('img'); 
			croix.id = 'prompimgclose';
		 	croix.src='images/close.png';
			croix.onclick = function(){that.wrapupPrompt(true);_dialogPromptID.innerHTML='';window.location.reload();}
		 	divcroix.appendChild(croix);
			_dialogPromptID.innerHTML='';
		 	_dialogPromptID.appendChild(divcroix);
         	_dialogPromptID.appendChild(content);
		 
		 

		
	  ajax(page_+'&promp=ok&',content,'');

           // _dialogPromptID.style.top=parseInt(document.documentElement.scrollTop+(screen.height/3))+'px';
     // _dialogPromptID.style.left=parseInt((document.body.offsetWidth-315)/2)+'px';
	 if (topp){_dialogPromptID.style.top = topp+'px';} else { 
	  _dialogPromptID.style.top=parseInt(scrOfY+10)+'px';
	 }
	 
	 if (leftt){_dialogPromptID.style.left = leftt} else { 
      _dialogPromptID.style.left='10px';}
	  
	  if (widthh){
		  
		  	var myWidth = 0, myHeight = 0;
			  if( typeof( window.innerWidth ) == 'number' ) {
				//Non-IE
				myWidth = window.innerWidth;
				myHeight = window.innerHeight;
			  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
				//IE 6+ in 'standards compliant mode'
				myWidth = document.documentElement.clientWidth;
				myHeight = document.documentElement.clientHeight;
			  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
				//IE 4 compatible
				myWidth = document.body.clientWidth;
				myHeight = document.body.clientHeight;
			  }

			var leftpos = (myWidth/2) - (widthh/2);
		  	_dialogPromptID.style.width = widthh;
			_dialogPromptID.style.left = parseInt(scrOfX+leftpos);
			}
	  
      _dialogPromptID.style.display='block';
      // Give the dialog box's input field the focus.
      //document.getElementById('iepromptfield').focus();
   } 
   
   if(FONC){eval(FONC)}
}
