function openContactwindow()
{
	window.open("goservices_contactmail.php","mywindow","menubar=1,resizable=1,width=600,height=600");
}
function sendMail(obj)
{
	if(!validate(obj))
	{
		return false;
	}else
	{
		return true;
	}
	
}
function validate(obj1)
{

	obj = document.getElementById('form1');
	obj.yourname.value=trim(obj.yourname.value);
	obj.company.value =trim(obj.company.value);
	obj.jobtitle.value =trim(obj.jobtitle.value);
	obj.description.value =trim(obj.description.value);
	if(obj.yourname.value=="")		
	{
		alert("Please enter contact name.");
		obj.yourname.focus();
		return false;

	}
	if(obj.emailid.value=="")		
	{
		alert("Please enter email.");
		obj.emailid.focus();
		return false;

	}
	 if (validateEmail(obj.emailid.value,1,1)==false)
	 {
		 	obj.emailid.focus();
			return false;
	}
	if(obj.company.value=="")		
	{
		alert("Please enter comapny Name.");
		obj.company.focus();
		return false;
	}
	if(obj.jobtitle.value=="")		
	{
		alert("Please enter job title.");
		obj.jobtitle.focus();
		return false;

	}
	if(obj.description.value=="")		
	{
		alert("Please enter Message.");
		obj.description.focus();
		return false;

	}
	return true;
}

function trim(s)
{
	var l=0; var r=s.length -1;
	while(l < s.length && s[l] == ' ')
	{	l++; }
	while(r > l && s[r] == ' ')
	{	r-=1;	}
	return s.substring(l, r+1);
}

var height;
function open_for_email(){


obj = document.getElementById('form1');
		var yourname = obj.yourname.value;
		var emailid = obj.emailid.value;
		var company = obj.company.value;
		var description = obj.description.value;
		var jobtitle = obj.jobtitle.value;
		var phone = obj.phone.value;
		var sendmail="send Mail";
var params ="yourname="+yourname+"&emailid="+emailid+"&company="+company+"&description="+description+"&jobtitle="+jobtitle+"&phone="+phone+"&sendmail="+sendmail;
		var url="/goservices_sendmail.php?"+params;
		divMinusOne();
		xmlHttp=GetXmlHttpObject(emailSend)
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)
}
function emailSend() 
{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{
					height=20;
			document.getElementById('mydiv').innerHTML='<font color="#FF0000">Thank you for mail. Your query has been send to concern person.</font>';
		}
}

function divMinusOne() {
	if(height >= 20) {
 		height = height - 1;
		document.getElementById('mydiv').style.height=height + 'px';
 		window.setTimeout('divMinusOne()', 2);
 	} 
	
} 

function closedMe()
{
		document.getElementById('mydiv').innerHTML='';

}
function emailthis(){
	sd=0;
	var rtimer;
	mydiv_obj=document.getElementById('mydiv');
	height=mydiv_obj.style.height
	height=height.substr(0,height.length - 2)
	mydiv_obj.style.visibility='visible';
mydiv_obj.innerHTML='<form name="form1" id ="form1" action="javascript:open_for_email();" onSubmit="return validate(this);" method="get"><table border="0" width="400" cellspacing=1 cellpadding=1 bgcolor="#CCCCCC"><tr><td colspan=3>&nbsp;</td></tr><tr><td nowrap>&nbsp;</td><td nowrap>Full Name :<font color="#FF0000">*</font></td><td><input type="text" id ="yourname" name="yourname"  size=30></td></tr><tr><td nowrap>&nbsp;</td><td nowrap width=40%>Telephone (optional) :</td><td><input type="text" id ="phone" name="phone"  size=30></td></tr><tr><td nowrap>&nbsp;</td><td>Email Address :<font color="#FF0000">*</font></td><td><input type="text" name ="emailid" id="emailid"  size=30></td></tr><tr><td nowrap>&nbsp;</td><td>Company :<font color="#FF0000">*</font></td><td><input type="text" name ="company" id="company"  size=30></td></tr><tr><td nowrap>&nbsp;</td><td>Job Title :<font color="#FF0000">*</font></td><td><input type="text" name ="jobtitle" id="jobtitle"  size=30></td></tr><tr><td nowrap>&nbsp;</td><td colspan=2 >Message : <font color="#FF0000">*</font></td><tr><tr><td nowrap>&nbsp;</td><td colspan=2><textarea name="description" id ="description" cols="75" rows="12"></textarea></td></tr><tr><td nowrap>&nbsp;</td><td colspan=2 align=center><input type=submit name ="sendmail" value="Send Mail">&nbsp;<input type="button" name ="closed" value="Closed" onClick="javascript:closedMe();"></td></tr></table></form>';
	 
	if(height <= 350){	
		height=(height * 1) + 10;
		mydiv_obj.style.height=height+'px';	
		sd=1
	}
	if(sd==1){
		rtimer=setTimeout('emailthis()',50);
	}else
	clearTimeout(rtimer);
	
}