// JavaScript Document
var ajaxTestimonialData;
var ajaxTestimonialTotalCnt=0;
var ajaxTestimonialCurrIndex=0;
TestimonialsData(); 
function getXMLHTTP() { 
	//fuction to return the xml http object
		var xmlhttp=false;	
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{		
			try{			
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				try{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}
		 	
		return xmlhttp;
    }
	
	
function TestimonialsData()
{
	

	var url = "testimonials/getTestimonialsAllData";	
	//var url="services/getServiceData1";
	var ajaxReqObj =getXMLHTTP();
//	var params = "homelinkID = "+linkID;	

		//alert(params);
		
	ajaxReqObj.open("POST",url,true);	   
	
	ajaxReqObj.setRequestHeader("Content-type","application/x-www-form-urlencoded");	
	//ajaxReqObj.setRequestHeader("Content-length", params.length);
	ajaxReqObj.setRequestHeader("Connection", "close");

	ajaxReqObj.onreadystatechange=function ()
	{
			var j=1;
		
		if(ajaxReqObj.readyState==4)
		{
			var ajaxResponseText = ajaxReqObj.responseText;
			//alert("Response is "+ajaxResponseText );
	
			var ajaxResponseArray=ajaxResponseText.split("#");

			if(document.getElementById("TestimonialsDataDivValue")!=null)
			{
					ajaxTestimonialTotalCnt=parseInt(ajaxResponseArray[1],10);
					if(ajaxTestimonialTotalCnt>0)
					{
						
						
						ajaxTestimonialData=(ajaxResponseArray[0]).split("EORECORD");
						var ajaxSplitTestimonialRec=(ajaxTestimonialData[0]).split("EOFIELD");
						document.getElementById("TestimonialsDataDivValue").innerHTML=ajaxSplitTestimonialRec[0]+"<br/>"+ajaxSplitTestimonialRec[1];
						
					}else{
							
					document.getElementById("TestimonialsDataDivValue").innerHTML = ajaxResponseArray[0];	
					}
			} //if(document.getElementById("TestimonialsDataDivValue")!=null)
							
			
		}
	}
	ajaxReqObj.send(null);
} 

function ShowTestimonialsData()
{
	if(ajaxTestimonialTotalCnt>0)
	{
				var tempSplitTestimonialRec="";
			
				if(	ajaxTestimonialCurrIndex < ajaxTestimonialTotalCnt-1)
					ajaxTestimonialCurrIndex++;
				else
					ajaxTestimonialCurrIndex=0

//alert(ajaxTestimonialCurrIndex);
		tempSplitTestimonialRec=(ajaxTestimonialData[ajaxTestimonialCurrIndex]).split("EOFIELD");
	document.getElementById("TestimonialsDataDivValue").innerHTML=tempSplitTestimonialRec[0]+"<br/>"+tempSplitTestimonialRec[1];	
	} else return false;
	

}
/* 
function TestimonialsData(linkIDDiv)
{
	
	var tempLinkID=linkIDDiv;
	//alert("Hello");
	//var tempLinkID="TestimonialsDataDiv134";
	var sampleText="TestimonialsDataDiv";
	var index=tempLinkID.search(/TestimonialsDataDiv/i) + sampleText.length;
	linkID=(tempLinkID.substring(index,tempLinkID.length));
	
	linkID=parseInt(linkID,10);
	
	if(isNaN(linkID))
		linkID=1;

	var url = "testimonials/getTestimonialsData";	
	//var url="services/getServiceData1";
	var ajaxReqObj =getXMLHTTP();
//	var params = "homelinkID = "+linkID;	
	var params = "uri_link="+linkID;	
		//alert(params);
		
	ajaxReqObj.open("POST",url,true);	   
	
	ajaxReqObj.setRequestHeader("Content-type","application/x-www-form-urlencoded");	
	ajaxReqObj.setRequestHeader("Content-length", params.length);
	ajaxReqObj.setRequestHeader("Connection", "close");

	ajaxReqObj.onreadystatechange=function ()
	{
			var j=1;
		
		if(ajaxReqObj.readyState==4)
		{
			var ajaxResponseText = ajaxReqObj.responseText;
			alert("Response is "+ajaxResponseText );
			 var ajaxResponseArray=ajaxResponseText.split("#");
			 
				document.getElementById("TestimonialsDataDivValue").innerHTML = ajaxResponseArray[0];
		
			//document.getElementById("TestimonialsData1").src= ajaxResponseArray[3];
			
			if(parseInt(ajaxResponseArray[1],10) < parseInt(ajaxResponseArray[2],10) )
			{
				j=parseInt(ajaxResponseArray[1],10);
				document.getElementById("TestimonialsDataDiv"+linkID).id="TestimonialsDataDiv"+(j+1);
				//alert(document.getElementById("TestimonialsDataDiv"+(j+1)).id);
            		
			}
			else
			{
				
				document.getElementById("TestimonialsDataDiv"+linkID).id="TestimonialsDataDiv"+(1);
				alert(document.getElementById("TestimonialsDataDiv1").id);
			}						
			
		}
	}
	ajaxReqObj.send(params);
} 
*/




