function showbox(text)
{

	if(text=="1")
	{
		document.getElementById('doc1').style.display='';
		document.getElementById('doc2').style.display='none';
	}

	if(text=="2")
	{
		document.getElementById('doc2').style.display='';
		document.getElementById('doc1').style.display='none';
	}

}

function validate_email(value){
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(value))
		return true;
	else
		return false;
}

function descarca(text)
{
	if(text=="1")
	{
		nume = document.getElementById('nume1').value;
		email =	document.getElementById('email1').value;
		companie = document.getElementById('companie1').value;
		if((nume=="")||(email=="")||(companie=="")||(!(validate_email(email))))
		{
			alert("Va rugam sa completati corect campurile de mai jos!");
		}
		else
		{
					var xmlHttp;
					try
					  {
					  // Firefox, Opera 8.0+, Safari
					  xmlHttp=new XMLHttpRequest();
					  }
					catch (e)
					  {
					  // Internet Explorer
					  try
						{
						xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
						}
					  catch (e)
						{
						try
						  {
						  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
						  }
						catch (e)
						  {
						  alert("Your browser does not support AJAX!");
						  return false;
						  }
						}
					  }
					  xmlHttp.onreadystatechange=function()
						{
						if(xmlHttp.readyState==4)
						  {
						  
						  }
						}
					  xmlHttp.open("GET","pdf/confirmare.php?nume="+nume+"&email="+email+"&companie="+companie+"&doc=CompanyPresentation_DEMASol_EN.pdf",true);
					  xmlHttp.send(null);
			 window.open("pdf/CompanyPresentation_DEMASol_EN.pdf", "_new");
		}
	}

	if(text=="2")
	{
		nume = document.getElementById('nume2').value;
		email =	document.getElementById('email2').value;
		companie = document.getElementById('companie2').value;
		if((nume=="")||(email=="")||(companie=="")||(!(validate_email(email))))
		{
			alert("Va rugam sa completati corect campurile de mai jos!");
		}
		else
		{
					var xmlHttp;
					try
					  {
					  // Firefox, Opera 8.0+, Safari
					  xmlHttp=new XMLHttpRequest();
					  }
					catch (e)
					  {
					  // Internet Explorer
					  try
						{
						xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
						}
					  catch (e)
						{
						try
						  {
						  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
						  }
						catch (e)
						  {
						  alert("Your browser does not support AJAX!");
						  return false;
						  }
						}
					  }
					  xmlHttp.onreadystatechange=function()
						{
						if(xmlHttp.readyState==4)
						  {
						  
						  }
						}
					  xmlHttp.open("GET","pdf/confirmare.php?nume="+nume+"&email="+email+"&companie="+companie+"&doc=CONTROLLING_mngt_tool_DEMASol_EN.pdf",true);
					  xmlHttp.send(null);
			 window.open("pdf/CONTROLLING_mngt_tool_DEMASol_EN.pdf", "_new");
		}
	}
}


function renunta()
{
	document.getElementById('doc1').style.display='none';
	document.getElementById('doc2').style.display='none';
}
