var isshow=0;
function ShowWindow()
{
  //  if(validateForm()&&isshow==0)
	if(isshow==0)
    {
      	var el=document.getElementById('idframe');
      	el.src="http://promodo.com/contact-form.html";
	var div1= document.createElement("div");
	var ClientW=0;
	var ClientH=0;
	if(document.documentElement.clientWidth!=0)
		ClientW=document.documentElement.clientWidth;
	else ClientW=document.body.clientWidth;

	if(document.documentElement.clientHeight!=0)
		ClientH=document.documentElement.clientHeight;
	else ClientH=document.body.clientHeight;
	div1.style.position="fixed";
	div1.style.left=ClientW/2-150+'px';
	div1.style.top=ClientH/2-50+'px';
	div1.style.width='300px';
	div1.style.height='100px';
	div1.style.backgroundColor="#eff0f1";
	div1.style.textAlign="center";
	div1.style.zIndex=65557;
	div1.id="thanksId";

	var divWrap= document.createElement("div");
	divWrap.style.position="absolute";
	divWrap.style.left=0+'px';
	divWrap.style.top=0+'px';
	divWrap.style.backgroundColor="#000";
	divWrap.style.opacity= 0.7;
	divWrap.style.width=document.body.offsetWidth+'px';
	divWrap.style.height=document.body.offsetHeight+'px';
	divWrap.style.margin=0+'px';
	divWrap.style.padding=0+'px';
	divWrap.style.zIndex=65555;;
	divWrap.style.filter='alpha(opacity=70)';
	divWrap.id="wrapId";

	isshow=1;
	div1.innerHTML='<div class="m" ><span>Thanks</span></div>We will contact you within 2-3 hours!<div class="enter" style="" onclick="removeWindow();"><a onclick="removeWindow();">Close</a></div>';
	var existingobject = document.getElementById("main");
	existingobject.appendChild(divWrap);
	existingobject.appendChild(div1);

    }
    return true;
}

function removeWindow()
{
	var d = document.getElementById('main');
	var divWrap=document.getElementById('wrapId');
  	var div1 = document.getElementById('thanksId');
  	d.removeChild(div1);
	d.removeChild(divWrap);
	var el=document.getElementById('idframe');
      	el.src="";
	isshow=0;
}


function matchwindow()
{
	if (isshow==1)
	{
	var ClientW=0;
	var ClientH=0;
	if(document.documentElement.clientWidth!=0)
		ClientW=document.documentElement.clientWidth;
	else ClientW=document.body.clientWidth;

	if(document.documentElement.clientHeight!=0)
		ClientH=document.documentElement.clientHeight;
	else ClientH=document.body.clientHeight;

	var el2=document.getElementById('thanksId');
	el2.style.left=ClientW/2-150+'px';
	el2.style.top=ClientH/2-50+'px';
	}}

window.onresize = function(e)
{
	matchwindow();
	var el=document.getElementById('wrapId');
		el.style.width=document.body.offsetWidth+'px';
		el.style.height=document.body.offsetHeight+'px';
}

function validateForm()
{		regex=/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
  		var el;
		var formV=document.forms.emailform;
  		if((formV.name.value == "")||(!regex.test(formV.email.value))||(formV.message.value == ""))
		{
            return false;
		}
		else return true;}
