function checkfield(loginform)
{
	ok=true
	var pat = pat=/^[a-zA-Z ]+$/;
	if (trim(loginform.description.value) == "")
	{
		alert("Please specify your requirements.");
		loginform.description.focus();
		ok=false
	}	
	else if(trim(loginform.name.value)=="")
	{
		alert("Please Enter Your Name.")
		loginform.name.focus()
		ok=false
	}
	else if(!(loginform.name.value.match(pat)))
	{
		alert("Name should contain only characters and spaces.");
		loginform.name.focus();
		ok=false
	}
	else if (trim(loginform.email.value) == "")
	{
		alert("Please enter a value for the email field.");
		loginform.email.focus();
		ok=false
	}
	else if (!isEmailAddr(loginform.email.value))
	{
		alert("Please enter a complete email address in the form: yourname@yourdomain.com");
		loginform.email.focus();
		ok=false
	}
	else if(trim(loginform.country_code.value)=="")
	{
		alert("Please Enter Country Code.")
		loginform.country_code.focus()
		ok=false
	}
	else if(isNaN(loginform.country_code.value))
	{
		alert("Country Code must be a numeric value.")
		loginform.country_code.focus()
		ok=false	
	}
	else if(trim(loginform.area_code.value)=="")
	{
		alert("Please Enter Area Code.")
		loginform.area_code.focus()
		ok=false
	}
	else if(isNaN(loginform.area_code.value))
	{
		alert("Area Code must be a numeric value.")
		loginform.area_code.focus()
		ok=false	
	}
	else if(trim(loginform.tel_no.value)=="")
	{
		alert("Please Enter Phone Number.")
		loginform.tel_no.focus()
		ok=false
	}
	else if(isNaN(loginform.tel_no.value))
	{
		alert("Tel. No must be a numeric value.")
		loginform.tel_no.focus()
		ok=false	
	}
	else if(loginform.tel_no.value.length<6)
	{
		alert("Tel. No must be at least 6 digits long.")
		loginform.tel_no.focus()
		ok=false	
	}
	return ok
}

function isEmailAddr(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
	var pindex = theStr.indexOf(".",index);
	if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

function ValidateNum(input,event){
	var keyCode = event.which ? event.which : event.keyCode;
	if(parseInt(keyCode)>=48 && parseInt(keyCode)<=57){
		return true;
	}
	return false;
}
function trim(sString) 
{ 
	while (sString.substring(0,1) == ' ') 
	{ 
		sString = sString.substring(1, sString.length); 
	} 
	while (sString.substring(sString.length-1, sString.length) == ' ') 
	{ 
		sString = sString.substring(0,sString.length-1); 
	} 
	return sString; 
}


var myWidth = 0, myHeight = 0;


function source() 
{

if( typeof( window.innerWidth ) == 'number' ) {
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
   myWidth = document.body.clientWidth;
   myHeight = document.body.clientHeight;
  }
var h = window.pageYOffset ||
document.body.scrollTop ||
document.documentElement.scrollTop;
var browserName=navigator.appName; 

var intElemScrollHeight = document.getElementById('hdiv').scrollHeight;

var abc = document.getElementsByTagName('body')[0].scrollHeight;
var abc1 = abc-100;



var newh = intElemScrollHeight+150;
var s = intElemScrollHeight+150+0;


var newhn = intElemScrollHeight+150+h;


if (document.getElementById('sourcediv').className=="soff")
{
	document.getElementById('sourcediv').style.marginTop = newh+"px";
document.getElementById('sourcediv').className="bgsourcing";
}


if (newh < h || abc1 > h)
{
document.getElementById('sourcediv').style.marginTop = h+"px";

	if (abc1 < h)
	{
document.getElementById('sourcediv').style.marginTop = abc1+"px";
}
	
	if (newh > h)
	{
			document.getElementById('sourcediv').style.marginTop = newh+"px";
			
		}
		}

}



function cls()
{
document.getElementById('sourcediv').className="soff1";
}

function addEvent( obj, type, fn ){ 
   if (obj.addEventListener){ 
	  obj.addEventListener( type, fn, false );
   }
   else if (obj.attachEvent){ 
	  obj["e"+type+fn] = fn; 
	  obj[type+fn] = function(){ obj["e"+type+fn]( window.event ); } 
	  obj.attachEvent( "on"+type, obj[type+fn] ); 
   } 

}
addEvent(window, 'scroll', source);
addEvent(window, 'resize', source);

document.write('<DIV ID="sourcediv" CLASS="soff"><TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="446"><TR><TD valign="bottom" halign="center"><DIV CLASS="absoldiv"><div class="helpdesk"> <div class="help-desk-title"><div class="s_close"><a href="javascript:cls()">[X] <u>Close</u></a></div>Post Your Purchase Inquiry</div><DIV  class="on" ID="divinfo"><img SRC="/gifs/line.gif" width="229" height="1" /><div class="help-text"> <strong>Send us your requirements to receive response from trusted suppliers </strong><br /><form name="loginform" method="POST"  action="/buyer-services.html" onSubmit="return checkfield(loginform)"><table  border="0" cellspacing="0" cellpadding="2"><tr><td>Please describe your requirments: </td><td>&nbsp;</td><td width="146">&nbsp;</td></tr><tr><td rowspan="3"><textarea name="description" id="description" cols="20" rows="5"></textarea></td><td width="80">Your Name : </td><td><input name="name" id="name" type="text" size="15" /></td></tr><tr><td>Email : </td><td><input name="email" id="email" type="text" size="15" /></td></tr><tr><td>Phone:</td><td><table width="100%" border="0" cellspacing="1" cellpadding="0"><tr><td><input name="country_code" id="country_code" type="text" size="2" /></td><td><input name="area_code" id="area_code" type="text" size="2" /></td><td><input name="tel_no" id="tel_no" type="text" size="6" /></td></tr></table></td></tr><tr><td colspan="3" align="right"><input type="image" name="imageField" SRC="/gifs/submit.jpg" /></td></tr></table></form></div></DIV></div></DIV></TD></TR></TABLE></DIV>')