var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
function mail(form,formNumber)
{
	if(formNumber == 1)
	{	
		var email = form.email.value;
		var fname = form.full_name.value;
		var phone = form.phone.value;
		var comp = form.company.value;
		var services = form.services.value;
		var budget = form.budget.value;
		var plan = form.plan.value;
		var overview = form.overview.value;
		
		var check = 1;
		document.getElementById('tabRes').style.display = 'none';
		document.getElementById('tabRes').innerHTML = document.getElementById('topquote').innerHTML;
		var div_height=document.getElementById('topquote').offsetHeight;
		document.getElementById('topquote').style.height=div_height+'px';
		var margin=div_height/2;
		document.getElementById('topquote').innerHTML="<img src='loading.gif' style='margin-top:"+margin+"px;margin-left:465px;' />";
		
		xmlhttp.open("GET", "js/sendmail.php?email="+email+"&fname="+fname+"&check="+check+"&phone="+phone+"&comp="+comp+"&services="+services+"&budget="+budget+"&plan="+plan+"&overview="+overview,true);
 		xmlhttp.onreadystatechange=function() 
		{
		  if (xmlhttp.readyState==4) 
		  {
			 if(xmlhttp.responseText == 'yes')
			 {
				document.getElementById('topquote').innerHTML = "<span style='margin-top:"+margin+"px;color:orange;display:block;float:left;font-size:19px;margin-bottom:20px;margin-top:0;width:100%;background:url(images/bullet1.png)no-repeat 0 5px; padding-left:18px; '>"+'Thanks for your interest in Bitwords Media. We will contact you shortly to address your queries'+"</span>";		 			 	
			 }
			 else
			 {
				document.getElementById('topquote').innerHTML = "<span style='margin-top:"+margin+"px;color:orange;display:block;float:left;font-size:19px;margin-bottom:20px;margin-top:0;width:100%;background:url(images/bullet1.png)no-repeat 0 5px; padding-left:18px; '>Email could not be send due to technical reasons.</span>";
			 }
			 
			 setTimeout('showDIV()',5000);
		}
	 }
		 xmlhttp.send(null)
	}
	else if(formNumber == 2)
	{
		var email_address = form.email_address.value;
		var first_name = form.first_name.value;
		var phone = form.phone.value;
		var last_name = form.last_name.value;
		var company_name = form.company_name.value;
		var address = form.address.value;
		var description = form.description.value;
		
		var check = 2;
		document.getElementById('tabRes').style.display = 'none';
		document.getElementById('tabRes').innerHTML = document.getElementById('contact_us').innerHTML;
		var div_height=document.getElementById('contact_us').offsetHeight;
		document.getElementById('contact_us').style.height=div_height+'px';
		var margin=div_height/2;
		document.getElementById('contact_us').innerHTML="<img src='loading.gif' style='margin-top:"+margin+"px;margin-left:285px;' />";
		
		xmlhttp.open("GET", "js/sendmail.php?email="+email_address+"&first_name="+first_name+"&check="+check+"&phone="+phone+"&last_name="+last_name+"&company_name="+company_name+"&address="+address+"&description="+description,true);
		 xmlhttp.onreadystatechange=function() {
		  if (xmlhttp.readyState==4) {
			 if(xmlhttp.responseText == 'yes'){
				document.getElementById('contact_us').innerHTML = "<span style='margin-top:"+margin+"px;margin-left:255px;color:green;font-size:14px;'>"+'Email Sent Successfully'+"</span>";		 	
			 }else{
				document.getElementById('contact_us').innerHTML =	 "<span style='margin-top:"+margin+"px;margin-left:255px;color:red;font-size:14px;'>"+xmlhttp.responseText+"</span>";
			 }
			 setTimeout('showDIV2()',5000);
		}
	 }
		 xmlhttp.send(null)
	}
	else if(formNumber == 3)
	{
		var email_address = form.email.value;
		var full_name = form.full_name.value;
		var phone = form.phone.value;
		var interested = form.interested.value;
		
		var check = 3;
		document.getElementById('tabRes').style.display = 'none';
		document.getElementById('tabRes').innerHTML = document.getElementById('btmQuote').innerHTML;
		var div_height=document.getElementById('btmQuote').offsetHeight;
		document.getElementById('btmQuote').style.height=div_height+'px';
		var margin=div_height/2;
		document.getElementById('btmQuote').innerHTML="<img src='loading.gif' style='margin-top:"+margin+"px;margin-left:365px;' />";
		
		xmlhttp.open("GET", "js/sendmail.php?email="+email_address+"&full_name="+full_name+"&check="+check+"&phone="+phone+"&interested="+interested,true);
		xmlhttp.onreadystatechange=function(){
		
		if (xmlhttp.readyState==4) 
		{
			 if(xmlhttp.responseText == 'yes'){
				document.getElementById('btmQuote').innerHTML = "<span style='margin-top:"+margin+"px;margin-left:315px;color:green;font-size:14px;'>"+'Email Sent Successfully'+"</span>";		 	
			 }else{
				document.getElementById('btmQuote').innerHTML =	 "<span style='margin-top:"+margin+"px;margin-left:315px;color:#fff;font-size:14px;'>"+xmlhttp.responseText+"</span>";
			 }
			 setTimeout('showDIV3()',5000);
		}
	 }
		 xmlhttp.send(null)
	}
	else if(formNumber == 4)
	{
		var time = form.time.value;
		var fname = form.txtRSFullName.value;
		var phone = form.txtRSPhone.value;
		
		var check = 4;
		
		document.getElementById('tabRes').style.display = 'none';
		document.getElementById('tabRes').innerHTML = document.getElementById('nameee').innerHTML;
		var div_height=document.getElementById('nameee').offsetHeight;
		div_height = 50;
		document.getElementById('nameee').style.height=div_height+'px';
		var margin=div_height/2;
		document.getElementById('nameee').innerHTML="<img src='loading.gif' style='margin-top:15px;margin-left:15px;' />";
		
		xmlhttp.open("GET", "js/sendmail.php?time="+time+"&fname="+fname+"&check="+check+"&phone="+phone,true);
		xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4) 
  	    {
			 if(xmlhttp.responseText == 'yes'){
				document.getElementById('nameee').innerHTML = "<span style='margin-top:"+margin+"px;color:orange;display:block;float:left;font-size:19px;margin-bottom:20px;margin-top:0;width:100%;background:url(images/bullet1.png)no-repeat 0 5px; padding-left:18px; '>"+'Thanks for your interest in Bitwords Media. We will contact you shortly to address your queries'+"</span>";		 	
			 }else{
				document.getElementById('nameee').innerHTML = "<span style='margin-top:"+margin+"px;color:orange;display:block;float:left;font-size:19px;margin-bottom:20px;margin-top:0;width:100%;background:url(images/bullet1.png)no-repeat 0 5px; padding-left:18px; '>Email could not be send due to technical reasons.</span>";
			 }
			setTimeout('showDIV4()',5000);
		}
	 }
		 xmlhttp.send(null)
	}
	else if(formNumber == 5)
	{
		var time = form.time.value;
		var fname = form.txtRSFullName.value;
		var phone = form.txtRSPhone.value;
		var intt = form.interest.value;
		
		var check = 4;
		
		document.getElementById('tabRes').style.display = 'none';
		document.getElementById('tabRes').innerHTML = document.getElementById('nameee2').innerHTML;
		var div_height=document.getElementById('nameee2').offsetHeight;
		div_height = 50;
		document.getElementById('nameee2').style.height=div_height+'px';
		var margin=div_height/2;
		document.getElementById('nameee2').innerHTML="<img src='loading.gif' style='margin-top:15px;margin-left:15px;' />";
		
		xmlhttp.open("GET", "js/sendmail.php?time="+time+"&fname="+fname+"&intt="+intt+"&check="+check+"&phone="+phone,true);
		xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4) 
  	    {
			 if(xmlhttp.responseText == 'yes'){
				document.getElementById('nameee2').innerHTML = "<span style='margin-top:"+margin+"px;color:orange;display:block;float:left;font-size:19px;margin-bottom:20px;margin-top:0;width:100%;background:url(images/bullet1.png)no-repeat 0 5px; padding-left:18px; '>"+'Thanks for your interest in Bitwords Media. We will contact you shortly to address your queries'+"</span>";		 			 	
			 }else{
				document.getElementById('nameee2').innerHTML = "<span style='margin-top:"+margin+"px;color:orange;display:block;float:left;font-size:19px;margin-bottom:20px;margin-top:0;width:100%;background:url(images/bullet1.png)no-repeat 0 5px; padding-left:18px; '>Email could not be send due to technical reasons.</span>";
			 }
			setTimeout('showDIV5()',5000);
		}
	 }
		 xmlhttp.send(null)
	}
}


function showDIV()
{
//	collapse('test5'); // collasping back the div
//	document.getElementById('topquote').innerHTML = document.getElementById('tabRes').innerHTML; // putting innerHTML FORM back

	document.getElementById('topquote').innerHTML = ''; // putting innerHTML FORM back
	document.getElementById('get_a_quote').style.display = 'none';
}

function showDIV2()
{
	document.getElementById('contact_us').innerHTML = document.getElementById('tabRes').innerHTML; // putting innerHTML FORM back
}
function showDIV3()
{
	document.getElementById('btmQuote').innerHTML = document.getElementById('tabRes').innerHTML; // putting innerHTML FORM back
}
function showDIV4()
{
	document.getElementById('nameee').innerHTML = ''; // putting innerHTML FORM back
	document.getElementById('callback_area').style.display = 'none';
}
function showDIV5()
{
	document.getElementById('nameee2').innerHTML = ''; // putting innerHTML FORM back
	document.getElementById('callback_area2').style.display = 'none';
}
