/*quickcontact*/

function validation3(){
chkqname();
chkqemail();
chkqcompany();

if(errors==0){
	return true;
	}
	else{
		return false;
	}
}


function chkqname(){
	var dep=Trim(document.getElementById("fqname").value);
	if(String(dep)=="" || String(dep)=="Enter name" ){
		document.getElementById('fqname').value='Enter name';
		document.getElementById("fqname").className="qc_ipred";
		errors=1;
	}
	else{
		document.getElementById("fqname").className="qc_ip";
		}
}

function chkqemail(){
	var dep=Trim(document.getElementById("fqemail").value);
	if(String(dep) != "" || String(dep) != "Enter email address" || String(dep) != "Enter valid email address"){
	if(!checkmail(String(dep))){
		document.getElementById('fqemail').value='Enter valid email address';
		document.getElementById("fqemail").className="qc_ipred";
		errors=1;
}
else{
	document.getElementById("fqemail").className="qc_ip";
	errors=0
	}
}
else{
	document.getElementById('fqemail').value='Enter email address';
	document.getElementById("fqemail").className="qc_ipred";
	errors=1;
}
}

function chkqcompany(){
	var dep=Trim(document.getElementById("fqcomment").value);
	if(String(dep)=="" || String(dep)=="Enter Company" ){
		document.getElementById('fqcomment').value='Enter Comments';
		document.getElementById("fqcomment").className="qc_ipred";
		errors=1;
	}
	else{
		document.getElementById("fqcomment").className="qc_ip";
		}
}





function reKeyPress(event, keyRE) {
        var strr = "";
        for(var i in event) {
            strr += "\n" + i + " - " + event[i];
        }

        if (    ( typeof(event.keyCode) != 'undefined' && event.keyCode > 0 && String.fromCharCode(event.keyCode).search(keyRE) != (-1) ) ||
            ( typeof(event.charCode) != 'undefined' && event.charCode > 0 && String.fromCharCode(event.charCode).search(keyRE) != (-1) ) ||
            ( typeof(event.charCode) != 'undefined' && event.charCode != event.keyCode && typeof(event.keyCode) != 'undefined' && event.keyCode.toString().search(/^(8|9|13|45|46|35|36|37|39)$/) != (-1) ) ||
            ( typeof(event.charCode) != 'undefined' && event.charCode == event.keyCode && typeof(event.keyCode) != 'undefined' && event.keyCode.toString().search(/^(8|9|13)$/) != (-1) ) ) {

		    return true;
        } else {
            return false;
        }
    }

function checkmail(no)
{
    var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
    if (!no.match(re))
    {

       return(false);
    }
    else{

     return(true);
     }
}

/*
==================================================================
LTrim(string) : Returns a copy of a string without leading spaces.
==================================================================
*/
function LTrim(str)
/*
   PURPOSE: Remove leading blanks from our string.
   IN: str - the string we want to LTrim
*/
{
   var whitespace = new String(" \t\n\r");

   var s = new String(str);

   if (whitespace.indexOf(s.charAt(0)) != -1) {
      // We have a string with leading blank(s)...

      var j=0, i = s.length;

      // Iterate from the far left of string until we
      // don't have any more whitespace...
      while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
         j++;

      // Get the substring from the first non-whitespace
      // character to the end of the string...
      s = s.substring(j, i);
   }
   return s;
}

/*
==================================================================
RTrim(string) : Returns a copy of a string without trailing spaces.
==================================================================
*/
function RTrim(str)
/*
   PURPOSE: Remove trailing blanks from our string.
   IN: str - the string we want to RTrim

*/
{
   // We don't want to trip JUST spaces, but also tabs,
   // line feeds, etc.  Add anything else you want to
   // "trim" here in Whitespace
   var whitespace = new String(" \t\n\r");

   var s = new String(str);

   if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
      // We have a string with trailing blank(s)...

      var i = s.length - 1;       // Get length of string

      // Iterate from the far right of string until we
      // don't have any more whitespace...
      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
         i--;


      // Get the substring from the front of the string to
      // where the last non-whitespace character is...
      s = s.substring(0, i+1);
   }

   return s;

}

/*
=============================================================
Trim(string) : Returns a copy of a string without leading or trailing spaces
=============================================================
*/
function Trim(str)
/*
   PURPOSE: Remove trailing and leading blanks from our string.
   IN: str - the string we want to Trim

   RETVAL: A Trimmed string!
*/
{
   return RTrim(LTrim(str));
}

function showOthers()
{
	
	if (document.getElementById('checkothers').checked==true){
		document.getElementById('others').style.display='';
		}
		else{
			document.getElementById('others').style.display='none';
			}
	}

