

function posDiv(obj){
  pageWidth =  window.innerWidth;
  pageWidth = (pageWidth)? pageWidth : document.documentElement.clientWidth;
  pageWidth = (pageWidth)? pageWidth: document.body.clientWidth;

  pageHeight =  window.innerHeight;
  pageHeight = (pageHeight)? pageHeight: document.documentElement.clientHeight;
  pageHeight = (pageHeight)? pageHeight: document.body.clientHeight;


  var posLeft = ((pageWidth-obj.offsetWidth)/2) + document.getScrollLeft();
  obj.style.left = (posLeft<0)?0+"px":posLeft+"px";
  var posTop = ((pageHeight-obj.offsetHeight)/2) + document.getScrollTop();
  obj.style.top = (posTop<0)?0+"px":posTop+"px";
}


function openModal(ObjName)
{

	var modalBox = document.createElement('div');
	modalBox.setAttribute("id",ObjName + 'dup');

	var modalDiv = document.createElement('div');
	modalDiv.setAttribute("id",ObjName + "_mod");

	//width & height
	width = document.body.clientWidth; //screen.width;
	height = document.body.clientHeight; //screen.height;

	if (document.all){
		modalDiv.style.setAttribute("cssText","width:"+(width) +"px;height:"+(height)+"px;position:absolute;top:0px;left:0px;z-index:9998;background-color:#FFFF00;filter: alpha(opacity=0)");
		modalBox.setAttribute("className",ObjName);
	}else{
		modalDiv.setAttribute("style","width:"+(width)+"px;height:"+(height)+"px;position:absolute;top:0px;left:0px;z-index:9998;background-color:#FFFF00;opacity:0;");
		modalBox.setAttribute("class",ObjName);
	}
	modalBox.style.display="block";
	modalBox.innerHTML = document.getElementById(ObjName).innerHTML;
	document.body.appendChild(modalDiv);
	document.body.appendChild(modalBox);
	document.getElementById(ObjName).style.display='none';
	posDiv(modalBox);
	ifrlayer.make(ObjName + 'dup');

	//alert("qsdqsd");
}


function closeModal(ObjName)
{
	ifrlayer.hide(ObjName + '_mod');
	ifrlayer.hide(ObjName + 'dup');
	document.body.removeChild($(ObjName + '_mod'));
	document.body.removeChild($(ObjName + 'dup'));
}