
function boxSubmit()
{
	obj = document.getElementById("box_submit");
//	alert(obj.style.display);
	if("none" != obj.style.display)
		obj.style.display = "none";
	else
		obj.style.display = "block";
}

function clearField(sFiledId,sValue)
{
	var obj = document.getElementById(sFiledId);
	if(sValue == obj.value)
		obj.value = "";
	else if("" == obj.value)
		obj.value = sValue;
}

function searchSubmit()
{
	clearField('keywords','Keywords');
	clearField('location','Location');
	
}

function postPagging(sName,sValue)
{
	obj = document.getElementById("pagging_value");
	obj.name = sName;
	obj.value = sValue;
	document.pagging.submit();
}


$(document).ready(function(){
	

	
  	var x;
	var elementList;
	var rndm;
	x = loadXMLdoc();
	elementList = x.getElementsByTagName("id");	
	rndm = rndnumber();
	 document.getElementById("testimonials_txt").innerHTML= x.getElementsByTagName("quote")[rndm].childNodes[0].nodeValue;
	 document.getElementById("testimonials_name").innerHTML= x.getElementsByTagName("author")[rndm].childNodes[0].nodeValue;
	
	setInterval(displayTestimonial, 10000);
	function displayTestimonial()  {
		$('.testimonial').fadeOut("slow");
		
		setTimeout(displayQuote, 500);
		function displayQuote() {
			document.getElementById("testimonials_txt").innerHTML= x.getElementsByTagName("quote")[rndm].childNodes[0].nodeValue;
			document.getElementById("testimonials_name").innerHTML= x.getElementsByTagName("author")[rndm].childNodes[0].nodeValue;
		}
		$('.testimonial').fadeIn("slow");
		if(rndm >= (elementList.length-1))
			rndm = 0;
		else
			rndm++;
	}

	function loadXMLdoc() {
	
	var xmlDoc;
	
	if (window.XMLHttpRequest)
	  {
	  xmlDoc=new window.XMLHttpRequest();
	  xmlDoc.open("GET","/testimonials.xml",false);
	  xmlDoc.send("");
	  return xmlDoc.responseXML;
	  }
	// IE 5 and IE 6
	else if (window.ActiveXObject)
	  {
	  xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
	  xmlDoc.async=false;
	  xmlDoc.load("/testimonials.xml");
	  return xmlDoc;
	  }
	alert("Error loading document");
	return null;
	}
	
	function rndnumber(){
		var randscript = -1;
		while (randscript < 0 || randscript > elementList.length - 1) {
			randscript = parseInt(Math.random()*(elementList.length + 1))
		} return randscript
	}
	$("[name=equiry]").sb({
    	fixedWidth: true
	});


});

Array.prototype.inArray = function (value,caseSensitive)
	// Returns true if the passed value is found in the
	// array. Returns false if it is not.
{
	var i;
	for (i=0; i < this.length; i++) {
		// use === to check for Matches. ie., identical (===),
		if(caseSensitive){ //performs match even the string is case sensitive
			if (this[i].toLowerCase() == value.toLowerCase()) {
				return true;
			}
		}else{
			if (this[i] == value) {
				return true;
			}
		}
	}
	return false;
};





