﻿function openModalEditingPopup(listUrl)
{
  createModalDiv(); 
  var url="/StoricoContainer.aspx?" + listUrl;
  var vReturnValue =window.showModalDialog(url,self, 'dialogHeight:768px;dialogWidth:1024px;resizable:yes;maximize:yes;scroll:no;center:yes'); 
  return false;
}
function createModalDiv()
{
    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.body.clientHeight;
    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
      //IE 4 compatible
      myWidth = document.body.clientWidth;
      myHeight = document.body.clientHeight;
    }
  var newdiv = document.createElement('div');
  var divIdName = 'modalDivdynamicediting';
  newdiv.setAttribute('id',divIdName);
  newdiv.className="modalClass";
  newdiv.style.height=myHeight;
   newdiv.style.width=myWidth;
  newdiv.innerHTML = '&nbsp;Test';
  document.body.appendChild(newdiv);
 }
 function closeModalDialog()
 {
    var div=document.getElementById('modalDivdynamicediting');
    if(div==null)
        createModalDiv();
     else
        document.body.removeChild(div);
 }
 function openModalEditingPopupContents(params,hfid){
  createModalDiv();
  createModalDivImage(); 
  var url="/NewEditItem.aspx?" + params + "&hfid=" + hfid;
  var vReturnValue =window.showModalDialog(url,self, 'dialogHeight:768px;dialogWidth:1024px;resizable:yes;maximize:yes;scroll:yes;center:yes'); 
  closeModalDialog();
  return false;
 }
 function openModalEditingPopupContentsStorico(params,hfid)
 {
     createModalDiv(); 
      var url="/StoricoContainer.aspx?" + params + "&hfid=" + hfid;
      var vReturnValue =window.showModalDialog(url,self, 'dialogHeight:768px;dialogWidth:1024px;resizable:yes;maximize:yes;scroll:no;center:yes'); 
      return false;
 }
function createModalDivImage(e)
{
  if (!e) var e = window.event;
  if(e==null){
  	 try{
	       e=event;
	    }
	    catch(errore)
	    {
    		e=Event;
    	}

  }

  var img=document.createElement('img');
  var imgIdName = 'modalDivdynamiceditingIMAGE';
  img.setAttribute('id',imgIdName);
  img.src="/images/indicator.gif";
  img.className="modalClassImage";
  img.style.left=e.x + "px";
  img.style.top=e.y + "px";
  document.body.appendChild(img);
 }
 function RemoveImageLoad()
 {
    var img=document.getElementById('modalDivdynamiceditingIMAGE');
    if(img==null)
        return;
    document.body.removeChild(img);
 }
