function CoverBody(div_color, page)
{
    this.div_color      = div_color;
    this.page_size      = PageSize.getPageSize();
    this.page_scrool    = PageSize.getPageScroll();
    this.objBody        = document.getElementsByTagName("body").item(0);
    this.objOverId      = "over";
    this.objCloseId     = "close";
    this.objInnerId     = "inner";
    this.objInnerWidth  = 562;
    this.objInnerHeight = 343;
    this.objCloseHeight = 100;
    this.objInnerSrc                = "/"+page;

}

CoverBody.prototype.CreateOver = function ()
{
    this.objOver                    = document.createElement("div");
    this.objOver.id                 = this.objOverId;
    this.objOver.name               = this.objOverId;
    this.objOver.style.position     = 'absolute';
    this.objOver.style.top          = '0';
    this.objOver.style.left         = '0';
    this.objOver.style.zIndex       = '99';
    this.objOver.style.width        = '100%';
    this.objBody.insertBefore(this.objOver, this.objBody.firstChild);
    this.objOver.style.height       = (this.page_size[1] + 'px');
    this.objOver.style.display      = 'block';
    this.objOver.style.border       = '0px;';
    this.objOver.style.background   = this.div_color;
    this.objOver.style.opacity      = '0.5';
    this.objOver.style.filter       = 'alpha(opacity=50 )';

}


CoverBody.prototype.CreateInner = function()
{
    this.objInner                   = document.createElement("div");
    this.objInner.id                = this.objInnerId;
    this.objInner.style.position    = 'absolute';
    this.objInner.style.zIndex      = '100';
    this.objInner.style.background  = '#ffffff';
    this.objInner.style.border      = "none";
    this.objBody.appendChild(this.objInner);
    this.objInner.style.top         = (this.page_scrool[1] + ((this.page_size[3]  - this.objInnerHeight) / 2) + 'px');
    this.objInner.style.left        = (((this.page_size[0] -  this.objInnerWidth) / 2) + 'px');


    this.objInnerFrame                  = document.createElement("iframe");
    this.objInnerFrame.style.width      = this.objInnerWidth+ "px";
    this.objInnerFrame.style.height     = this.objInnerHeight + "px";
    this.objInnerFrame.frameBorder      = "0";
    this.objInnerFrame.border           = "0";
    this.objInnerFrame.scrolling        = "no";
    this.objInnerFrame.name        	 = "ed_quote";
    this.objInnerFrame.id        	 = "ed_quote";
    this.objInnerFrame.src              = this.InnerSrc();
    this.objInner.appendChild(this.objInnerFrame);
//    alert(this.objInnerFrame.name);

}

CoverBody.prototype.CreateClose = function ()
{
    this.objClose                   = document.createElement("div");
    this.objClose.id                = this.objCloseId;
    this.objClose.style.position    = 'absolute';
    this.objClose.style.right       = '5px';
    this.objClose.style.top         = '8px';
    this.objClose.style.zIndex      = '200';
    this.objClose.style.background  = '';
    this.objClose.onclick           = "remov()";
    this.objClose.innerHTML         = '';
    this.objInner.appendChild(this.objClose);
}

CoverBody.prototype.Create = function () {
    this.CreateOver();
    this.CreateInner();
    this.CreateClose();
}

CoverBody.prototype.InnerSrc = function ()
{
    return this.objInnerSrc;

}

CoverBody.prototype.Remove = function()
{
   var objOver = $(this.objOverId)
   var objInner= $(this.objInnerId);
    try {
        this.objBody.removeChild(objOver);
        this.objBody.removeChild(objInner);
        //top.window.location.reload(false);
    } catch(e) {

    }

}




function request_keye() {
	var error = '';
	var phone = document.getElementById("id_from_phone");
	var phone_number = phone.value;
	if(phone_number.length == 0){
		alert("Completeaza-ti numarul de telefon");
		phone.focus();
	} else {
		var objRegExp  =  /07(\d+){8}/;
		if(objRegExp.test(phone_number)){
			cvr_edit = new CoverBody("#ffffff", "acckeye.php?phone=" + phone_number);
			cvr_edit.Create();
		} else {
			alert("Ai completat gresit numarul de telefon");
			phone.focus();
		}
	}
}
function remov()
{
    cvr_edit.Remove();
    var phone = document.getElementById("id_acckey");
    phone.focus();
    phone.select();
}