var ajaxObj = new XMLHTTP("mybic_server.php");
ajaxObj.debug = 0;

var quote=new Array();
  quote[0]='Give a person a fish and you feed them for a day. Teach that person to use the Internet and they won\'t bother you for weeks. -Author Unknown';    
  quote[1]='The internet is just a world passing around notes in a classroom. -Jon Stewart';
  quote[2]='A journey of a thousand sites begins with a single click. -Author Unknown';
  quote[3]='One of the Internet\'s strengths is its ability to help consumers find the right needle in a digital haystack of data. -Jared Sandberg';
  quote[4]='The Internet is a telephone system that\'s gotten uppity. -Clifford Stoll';
  quote[5]='The Internet is the most important single development in the history of human communication since the invention of call waiting. -Dave Barry';
  quote[6]='Almost overnight, the Internet\'s gone from a technical wonder to a business must. -Bill Schrader';
  quote[7]='If you have a web site, it makes your small business look big. -Natalie Sequera';
  quote[8]='The Internet is not just one thing, it\'s a collection of things - of numerous communications networks that all speak the same digital language. -Jim Clark';
  quote[9]='Just as we could have rode into the sunset, along came the Internet, and it tripled the significance of the PC. -Andy Grove';
  quote[10]='There are three kinds of death in this world.  There\'s heart death, there\'s brain death, and there\'s being off the network. -Guy Almes';
  quote[11]='Getting information off the Internet is like taking a drink from a fire hydrant. -Mitchell Kapor';
  quote[12]='The new information technology... Internet and e-mail... have practically eliminated the physical costs of communications. -Peter Drucker';
  
var speed=6000;    /*this is the time in milliseconds adjust to suit*/
var q=0;

function showQuote() {
	var colors=new Array(); // regular array (add an optional integer
	colors[0]="#c8e59c";       // argument to control array's size)
	colors[2]="#FFFFE1";
	var randomnumber=Math.floor(Math.random()*2)
	document.getElementById("quote").style.color = colors[randomnumber];
    document.getElementById("quote").innerHTML=quote[q];
     q++;
if(q==quote.length) {
     q=0;
  }
}
setInterval('showQuote()',speed);

function sendEmail(){
	var $name = document.contactus.name;
	var $email = document.contactus.email;
	var $subject = document.contactus.subject;
	var $message = document.contactus.message;
	if($email.value){
		if (($email.value.indexOf('@') == -1) || ($email.value.indexOf('.') == -1)) {
			document.getElementById("pointer_email").style.display = "inline";
			document.getElementById("error_email_msg").innerHTML = "Enter valid email";
			document.getElementById("email").style.border = "thin solid red";
			document.getElementById("email").focus();
		}else{
			document.getElementById("pointer_email").style.display = "none";
			document.getElementById("email").style.border = "1px solid #464442";
			if($message.value){
				document.getElementById("pointer_message").style.display = "none";
				document.getElementById("message").style.border = "1px solid #464442";
				ajaxObj.method="GET";
				var form_vars = ajaxObj.getForm('contactus'); 
				ajaxObj.call('action=sendemail'+form_vars, showResults);
			}else{
				document.getElementById("pointer_message").style.display = "inline";
				document.getElementById("message").style.border = "thin solid red";
				document.getElementById("message").focus();
			}
		}
	}else{
		document.getElementById("pointer_email").style.display = "inline";
		document.getElementById("error_email_msg").innerHTML = "Enter your email";
		document.getElementById("email").style.border = "thin solid red";
		document.getElementById("email").focus();
	}
}
function showResults(resp){
	if(resp) {
		if(resp == true){
			document.getElementById("contactus").style.display = "none";
			document.getElementById("contactus_header").style.display = "none";
			document.getElementById("message_sent").style.display = "inline";
		}else{
			document.getElementById("pointer_number").style.display = "inline";
			document.getElementById("error_sent").innerHTML=resp;
		}
	} else {
		// console.info('error...');
	}
}
function sendQuestion(){
	var $email = document.questionus.email;
	var $question = document.questionus.question;
	if($email.value){
		if (($email.value.indexOf('@') == -1) || ($email.value.indexOf('.') == -1)) {
				document.getElementById("pointer_email").style.display = "inline";
				document.getElementById("error_email_msg").innerHTML = "Enter valid email";
				document.getElementById("email").style.border = "thin solid red";
				document.getElementById("email").focus();
		}else{
			document.getElementById("pointer_email").style.display = "none";
			document.getElementById("email").style.border = "1px solid #464442";
			if($question.value){
				document.getElementById("pointer_question").style.display = "none";
				document.getElementById("question").style.border = "1px solid #464442";
				ajaxObj.method="GET";
				var form_vars = ajaxObj.getForm('questionus'); 
				ajaxObj.call('action=sendquestion'+form_vars, showQuestionResults);
			}else{
				document.getElementById("pointer_question").style.display = "inline";
				document.getElementById("question").style.border = "thin solid red";
				document.getElementById("question").focus();
			}
		}
	}else{
		document.getElementById("pointer_email").style.display = "inline";
		document.getElementById("error_email_msg").innerHTML = "Email?";
		document.getElementById("email").style.border = "thin solid red";
		document.getElementById("email").focus();
	}
}

