function doRegister(cmd){

	var elm = document.getElementById("emailfield");

	if (!emailChecker("emailfield"))return;

	createPopup("registrator.php?ajax=1&"+cmd+"&email="+elm.value);
	elm.value="";
	
}

function createPopup(url){

	var d = document.getElementById("transparentPane");
	if (d) closePopup();
	
	createContent("transparentPane","iframe");
	document.getElementById("transparentPane").contentWindow.document.write("<html><head><style>body {background:black;margin:0;padding:0;border:none;}</style></head><body></body></html>");
	document.getElementById("transparentPane").contentWindow.document.write("");

	
	createContent("contentPane","div");
	dw_Viewport.getScrollY();
	document.getElementById("contentPane").style.marginTop=dw_Viewport.scrollY + 100 + "px";
	ajax(url,"contentPane");
}


function closePopup()
{
	removeContent("contentPane");
	removeContent("contentFrame");
	removeContent("transparentPane");
}
function createContent(elm_id,tp)
{
	//var t = document.getElementById(elm_id);
	var elm = document.createElement(tp);
	elm.setAttribute('id',elm_id);
	elm.setAttribute('frameBorder','0');
	elm.setAttribute('border','0');
	elm.setAttribute('marginWeight','0');	
	elm.setAttribute('marginHeight','0');
	elm.setAttribute('scrolling','no');
	return document.body.appendChild(elm);
}

function removeContent(cnt)
{
	var div=document.getElementById(cnt);
	if (div)document.body.removeChild(div);
}

function autoResize(id){
	dw_Viewport.getScrollY();

    var newheight;
    var newwidth;

    if(document.getElementById){
        newheight=document.getElementById(id).contentWindow.document.body.scrollHeight;
        newwidth=document.getElementById(id).contentWindow.document.body.scrollWidth;
    }

	document.getElementById(id).style.marginTop=dw_Viewport.scrollY + 100 + "px";
    document.getElementById(id).style.height= (newheight) + "px";
    document.getElementById(id).style.width= (newwidth) + "px";
	
}
