// Other functions
 function ltrim(str)
 {
        var whitespace = new String(" \t\r\n");
        var s = new String(str);

        if (whitespace.indexOf(s.charAt(0)) != -1) {

            var j=0, i = s.length;

            while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
                j++;

            s = s.substring(j, i);
        }
        return s;
}

function rtrim(str)
{
        var whitespace = new String(" \t\r\n");
        var s = new String(str);
        if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
            var i = s.length - 1;       
            while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
              i--;
            s = s.substring(0, i+1);
        }
        return s;
}

function trim( str )
{
  return rtrim( ltrim(str) );
}

function isEmpty( str ){
	return ( trim(str) == "" );  
}

function validateObject(frmObj, objDType, errMsg) {
	if (objDType=="T") {
		if (isEmpty(frmObj.value)) {
			alert(errMsg);
			frmObj.focus();
			return false;
		}
		else
			return true;
		
	}	
}




function CheckMail(MailText)
{
var InValidEmail = false;
var NoOfChars = 0, MultipleAts = false, i=0, NoOfDots=0, NoOfAts=0;
var ch="", Msg=" ", chAt=0;

//  Check if email id is empty
NoOfChars = MailText.length;
if (NoOfChars == 0)
{
    InValidEmail = true;
    Msg = "E-mail cannot be Empty";
}
// check for each individual char
if (InValidEmail == false) 
{
for (i=0; i<NoOfChars && InValidEmail == false; i++)
{
    ch = MailText.charAt(i);
    if(ch == ".") 
    {
        NoOfDots += 1;
        if (MailText.charAt(i+1) == ".") //Check for continuously entered dots
        {
            Msg = "Invalid - Dots cannot appear continously in email";
            InValidEmail = true;
            break;
        }
    }
            
//Not to allow Multiple @s
    if(ch == "@")              
        NoOfAts +=1;
//Avoid any special characters
    if ((ch>="a" && ch <= "z") || (ch>="A" && ch <="Z"));
      else 
        if ((ch >="0" && ch<="9"));
          else 
         if ( (ch !="@") && (ch !="_") && (ch !=".") && (ch !="-"))
          {    
            Msg = "Invalid Character Set (Avoid Special Characters)  in email";
            InValidEmail = true;
         }
}
}
//Check last char is numeric
if (InValidEmail == false) 
{
if ((MailText.charAt(NoOfChars-1)>="0" &&  MailText.charAt(NoOfChars-1)<= "9"))
{
    Msg = "Invalid Email Id (Avoid numbers at the end)";
    InValidEmail = true;
}
}

if (InValidEmail == false) 
{
    if (NoOfDots <= 0 || NoOfAts <=0)   // . & @ don't exist
    {
        Msg = "In Valid Character Set (@ / . doesn't exist)  in email";
        InValidEmail = true;
    }
    if (NoOfAts > 1)  // Check for multiple @s
    {
        Msg = "In Valid Character Set (Multiple @s)  in email";
        InValidEmail = true;
    }

}
// Placement of the dot and at symbol

if (InValidEmail == false) 
{
    // Check @ is entered as first / last character
    if((MailText.indexOf("@",0) ==0)||(MailText.lastIndexOf("@",NoOfChars-1) == NoOfChars-1))
    {
        Msg = "Check @ is entered as first / last character  in email";
        InValidEmail = true;
    }
    // Check . is entered as first / last character
    if((MailText.indexOf(".",0) ==0)||(MailText.lastIndexOf(".",NoOfChars-1) == NoOfChars-1))
    {
        Msg = "Check . is entered as first / last character  in email";
        InValidEmail = true;
    }
    // Check . is entered before and not next to @ 
    if((MailText.indexOf(".",0) - MailText.indexOf("@",0))==1)
    {
        Msg = "Check . is entered before @ and also next to each other  in email";
        InValidEmail = true;
    }
    // Check @ & . is entered next to each other
    chAt=MailText.indexOf("@",0);
    if (MailText.charAt(chAt+1) == ".")
    {
        Msg = "Check @ & . is entered next to each other  in email";
        InValidEmail = true;
    }

}

if(InValidEmail == true)
{
    alert (Msg);
    return false;
}
else
{
//        alert("Correct ID");
    return true;
}
}   

function loadQS(sel)
{
	loadPage = sel.options[sel.selectedIndex].value;
        if (loadPage.toLowerCase() != "blank")
	    document.location.href=loadPage;
}




function returnHeader() 
{
document.write('<TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%" border=0> ')
document.write('  <TBODY> ')
document.write('    <TR>  ')
document.write('      <TD vAlign=top> <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0> ')
document.write('          <TBODY> ')
document.write('            <TR>  ')
document.write('              <TD height=36 colSpan=2 align=left bgcolor="#0066cc" > ')
document.write('            <TABLE cellSpacing=0 cellPadding=0 width=775 border=0> ')
document.write('              <TBODY> ')
document.write('              <TR> ')
document.write('                <TD width=610><IMG height=50  ')
document.write('                  src="/images/header.jpg" ') 
document.write('                  width=609><BR></TD> ')
document.write('                <TD vAlign=bottom width=165> ')
document.write('                  <DIV align=right><SPAN class=small> ')
document.write('                  <FORM name="ELMenu">  ')
document.write('                  <SELECT onchange="loadQS(this)" name="qs">') 
document.write('                     <OPTION selected value="blank">-- Quick Links --</OPTION> ')
document.write('                    <OPTION value="products.htm">Products </OPTION> ')
document.write('                    <OPTION value="services.htm">Services</OPTION> ')
document.write('                    <OPTION value="career.htm"> Careers </OPTION>   ')
document.write('                    <OPTION value="aboutus.htm">Company\'s Profile</OPTION>  ')
document.write('                    <OPTION value="ser_e&t.htm">Education & Training</OPTION> ')
document.write('                    <OPTION  value="career_council.htm">Career Counselling</OPTION>  ')
document.write('                    </SELECT>  ')
document.write('                  </FORM></SPAN></DIV></TD></TR></TBODY></TABLE></TD> ')
document.write('            </TR> ')
document.write('            <TR>  ')
document.write('              <TD height=20 colSpan=2 bgcolor="#ff6600"><IMG height=20  ')
document.write('            src="/images/transparent.gif"  ')
document.write('            width=1></TD> ')
document.write('            </TR> ')
//document.write('            <TR>  ')
//document.write('              <TD height=10 colSpan=2 bgcolor="#0066cc"><IMG height=10 src="/images/transparent.gif" width=1></TD> ')
//document.write('            </TR> ')
//document.write('            <TR>  ')
//document.write('              <TD colspan="2" vAlign=top>&nbsp;</TD> ')
//document.write('            </TR> ')
document.write('          </TBODY> ')
document.write('        </TABLE></TD> ')
document.write('    </TR> ')
document.write('  </TBODY> ')
document.write('</TABLE> ')
}


function returnFooter() 
{


document.write('      <TABLE cellSpacing=0 cellPadding=0 width="100%" bgColor=#0066c0 background="/images/test_foot_2.gif" border=0>')
document.write('        <TBODY>')
document.write('        <TR>')
document.write('              <TD align="right" class="sidemenu">Mail to <a href="mailto:info@enterprise-logic.com"><font color="#FFFFFF">info@Enterprise_logic.com</font></a></TD>')
document.write('            </TR>')
document.write('	</TBODY>')
document.write('	</TABLE>')
document.write('        <TABLE cellSpacing=0 cellPadding=0 width="100%" bgColor=#ff6600 background="/images/test_foot_1.gif" border=0>')
document.write('          <TBODY>')
document.write('        <TR>')
document.write('              <TD valign="top"> ')
document.write('                <DIV class=white align=center> Copyright © 2000 Enterprise Logic. All Right Reserved ')
document.write('	<IMG height=16 src="/images/transparent.gif" width=1>')
document.write('	</DIV>')
document.write('	</TD>')
document.write('	</TR>')
document.write('	</TBODY>')
document.write('	</TABLE>')
document.write('	</TD>')
document.write('	</TR>')
document.write('	</TBODY>')
document.write('	</TABLE>')
}


function returnDropDown() {
	document.write('	<select name="qlinks"  onChange="loadQLink(this);">');
	document.write('    <option value="blank" selected>Quick Links</option>')
	document.write('    <option value="/consulting/ivs_cs.html">Consulting Services</option>')
	document.write('    <option value="/erp/ivs_erp.html">ERP Solutions</option>')
	document.write('    <option value="/inhouse/ivs_ih.html">In house Designing/Development </option>')
	document.write('    <option value="/conversion/ivs_cm.html">Conversion/Migration Services </option>')
	document.write('    <option value="/webservices/ivs_wb.html">Web Services</option>')
	document.write('    <option value="/training/ivs_e&t.html">Education &amp; Training</option>')
	document.write('    <option value="blank">Cource Details</option>')
	document.write('    <option value="blank">Job Search</option>')
	document.write('    <option value="blank">Career Guidelines</option>')
	 document.write('   </select>')
}  



