sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

var email_kb = "<a href=\"mai";
email_kb += "lto:apply";
email_kb += "@tetcos";
email_kb += ".com?Subject=Careers: Application\"><img src=\"i/emailid.gif\" width=\"123\" height=\"19\" alt=\"\" border=\"0\"></a>";
var email_sls = "<a href=\"mai";
email_sls += "lto:sales";
email_sls += "@tetcos";
email_sls += ".com?Subject=Software: Support\"><img src=\"i/emailid_sls.gif\" width=\"118\" height=\"19\" alt=\"\" border=\"0\"></a>";

function delspace(feild){
	var thisval=feild.value;
	var re = / /g;
	thisval=thisval.replace(re,"");
	feild.value=thisval;
}

function isDigit(c)	{
	if ((c >= '0') && (c <= '9')) 
	return true;
	return false;
}

function isChar(c)	{
	if ((c >= 'a') && (c <= 'z'))
	return true;
	if ((c >= 'A') && (c <= 'Z'))
	return true;
	return false;
}

function isNumber(s)	{
	for (var i = 0; i < s.length; i++){
	var onechar=s.charAt(i);
		if (onechar < "0" || onechar > "9")
		return false		
	}
	return true;
}

function isEmpty(str) {
	return ((str == null) || (str == ""));
}



function selectitem(field){
		if (field.selectedIndex) return false;
		return true;

}

function validate(f){
    var err = "";
    var focus = "";

    if (isEmpty(document.getElementById('ContactName').value)){
        if (isEmpty(err))
            focus="#contactname";
        err += "You must provide your Contact Name.\n";};
		
	if (isEmpty(document.getElementById('CompanyName').value)){
        if (isEmpty(err))
            focus="#name";
        err += "You must provide your Company Name.\n";};
			
		
	if (isEmpty(document.getElementById('Address1').value)){
        if (isEmpty(err))
            focus="#address1";
        err += "You must provide your Address.\n";};
		
	 if (isEmpty(document.getElementById('City').value)){
        if (isEmpty(err))
            focus="#city";
        err += "You must provide City.\n";};
			if (isEmpty(document.getElementById('Country').value)){
        if (isEmpty(err))
            focus="#country";
        err += "You must provide Country.\n";};
	if (isEmpty(document.getElementById('Pincode').value)){
        if (isEmpty(err))
            focus="#pincode";
        err += "You must provide Pincode.\n";};
		if (isEmpty(document.getElementById('Phone').value)){
        if (isEmpty(err))
            focus="#phone";
        err += "You must provide Phone.\n";};
		
	if (isEmpty(document.getElementById('Email').value)){
        if (isEmpty(err))
            focus="#email";
        	err += "You must provide your email address.\n";
    }
    else {
	        tempstring = document.getElementById('Email').value;
        	if ((tempstring.indexOf('@') == -1 ) || (tempstring.indexOf('.') == -1 )){
    	      err += "Ensure that your email address is valid.\n";
        	  focus="#email";
    	   	}
   	};		
if (isEmpty(document.getElementById('Comments').value)){
        if (isEmpty(err))
            focus="#comments";
        err += "You must enter some text in the message box.\n";};
		
	
    // check if any errors have been generated, if so display alert

    if (err != "") {
        var msg = "The form was not submitted.\n";
        msg += "Please fill in all required fields and resubmit. Thank you.\n\n" + err;
        alert(msg);
        return false;
    }
    // all checks validated, allow form to be submitted
    return true;
}


var msgwin = null;
var winwide = screen.availWidth;

function open_window(URL,wt,ht,tp,lft)	{

msgwin=window.open(URL,"NewWindow","toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+ wt +",height="+ ht +",top=" + tp + ",left=" + lft +"resizable=no")
}

function shutIt() {
  if (msgwin != null && msgwin.open) msgwin.close();
}
window.onfocus=shutIt;

