function returnObjById(id)
{
	if (document.getElementById)
		var returnVar = document.getElementById(id);
	else if (document.all)
		var returnVar = document.all[id];
	else if (document.layers)
		var returnVar = document.layers[id];
	return returnVar;
}

function showUL(id)
{
	if (returnObjById(id).style.display == 'none')
		returnObjById(id).style.display = 'block';
	else
		returnObjById(id).style.display = 'none';
}

function createPopUp(page)
{
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    myWidth = window.innerWidth-20;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
  }
  var marginLeft;
  if(myWidth>990) marginLeft = (myWidth - 716)/2;
  else marginLeft = 136;
	var div = document.createElement('div');
	div.setAttribute('id', 'myPopup');
	div.innerHTML = "<div class=\"shadow\" ></div><div class=\"popUp\"  style=\"margin-left:" + marginLeft + "px;\" id=\"test\"><iframe id=\"testiframe\" name=\"testiframe\" src=\"" + page + ".php\" allowtransparency=\"true\" frameborder=\"0\" width=\"524\" height=\"640\" class=\"iframeContent\"></iframe><br></div>";
	document.body.appendChild(div);
}

function removeElement() {
	var olddiv = this.parent.returnObjById("myPopup");
	this.parent.document.body.removeChild(olddiv);
}

function createPopUpEditSpa(page, id)
{
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    myWidth = window.innerWidth-20;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
  }
  var marginLeft;
  if(myWidth>990) marginLeft = (myWidth - 716)/2;
  else marginLeft = 136;
	var div = document.createElement('div');
	div.setAttribute('id', 'myPopup');
	div.innerHTML = "<div class=\"shadow\" ></div><div class=\"popUp\"  style=\"margin-left:" + marginLeft + "px;\" id=\"test\"><iframe id=\"testiframe\" name=\"testiframe\" src=\"" + page + ".php?id="+ id + "\" allowtransparency=\"true\" frameborder=\"0\" width=\"524\" height=\"640\" class=\"iframeContent\"></iframe><br></div>";
	document.body.appendChild(div);
}
