// JavaScript Document

function imgOver(obj) {
	var imgName = obj.src.split("/")[obj.src.split("/").length-1];
	
	if (imgName.split("_over").length == 1) {
		var imgNum = imgName.split(".")[0];
		obj.src = "images/" + imgNum + "_over.gif";
		
		obj.onmouseout = function() {
			obj.src = "images/" + imgNum + ".gif";
		}
	}
}

function initForms() {
	for (var i=0; i< document.forms.length; i++) {
		document.forms[i].onsubmit = function() {return validForm();}
	}
}

function validForm() {
	var allGood = true;
	var allTags = document.getElementsByTagName("*");

	for (var i=0; i<allTags.length; i++) {
		if (!validTag(allTags[i])) {
			allGood = false;
		}
	}
	return allGood;

	function validTag(thisTag) {
		var outClass = "";
		var allClasses = thisTag.className.split(" ");
	
		for (var j=0; j<allClasses.length; j++) {
			outClass += validBasedOnClass(allClasses[j]) + " ";
		}
	
		thisTag.className = outClass;
	
		if (outClass.indexOf("invalid") > -1) {
			thisTag.focus();
			if (thisTag.nodeName == "INPUT") {
				thisTag.select();
			}
			return false;
		}
		return true;
		
		function validBasedOnClass(thisClass) {
			var classBack = "";
		
			switch(thisClass) {
				case "":
				case "invalid":
					break;
				case "reqd":
					if (allGood && thisTag.value == "") classBack = "invalid ";
					classBack += thisClass;
					break;
				default:
					classBack += thisClass;
			}
			return classBack;
		}
	}
}

window.onload = initForms;

function toggleBox(szDivID, iState) { // 1 visible, 0 hidden
	if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
       // obj.style.visibility = iState ? "visible" : "hidden";
		obj.style.display= iState ? "" : "none"; 
        //obj.style.zIndex=0
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
}
function getTestimonial(){
	var randomnumber=Math.floor(Math.random()*5)+1;
	var sText="";
	var sName="";
	var sCompany="";
	
	
	if (randomnumber==1){
		sText="NCG has no equal in the carrier services industry for their professionalism, outstanding service, and complete commitment to their customers. Product knowledge, and willingness to assist their customers in the crazy, confusing world of circuit services sets them apart from their competition time and time again."
		sName="Tim Briggs"
		sCompany="Standard Tel"
	}
	if (randomnumber==2){
		sText="I have been with NCG for about six years, and they have saved me a great deal of time and money.  They are familiar with how the phone companies operate and are able to explain, in English, what the various phone plans mean and do. And when they don't have an instant answer, they find it for you.  In sum, competent and qualified service is what they provide."
		sName="Steve Murray"
		sCompany="APC"
	}
	if (randomnumber==3){
		sText="It is rare to find telephone service vendors who even come close to any kind of quality of service. Network Consulting Group has repeatedly exceeded my expectations and made my life easier."
		sName="Rick Arvielo"
		sCompany="New American Financial"
	}
	if (randomnumber==4){
		sText="I can honestly say they are the best in the industry. Great service and great value for your money. They really know their stuff! You just don't mess with a winning team. Instead, you hire them!"
		sName="John Willenbring"
		sCompany="MVE & Partners, Inc."		
	}
	if (randomnumber==5){
		sText="NCG (Shane &amp; Scott) did such a wonderful job, I don't know how I could have done this [in reference to handling a 13 Site MPLS Role out and Corporate Head Quarter Relocation] without them."
		sName="Kathy"
		sCompany="ASB"
	}
	document.write('<div class="testimonial"><div class="quote">' + sText + '</div><div class="by">-- ' + sName + ', ' + sCompany + '</div></A></div>')
}

