// JavaScript Document

var c;
var f;
var n=0;
var t;
var timeoutId = 0;


function testimonialLoader(totalN,initN){
    
    //initN=0;
    if(timeoutId)   clearTimeout ( timeoutId );
    if (initN>=totalN){ initN=0; }
    $('tbox').style.display = "none";
	t = "testimonialLoader2("+totalN+","+(initN+1)+")";
    c = getTestimonial2(initN);
     timeoutId = setTimeout(t,0);
}
function testimonialLoader2(totalN,initN){
	if(timeoutId)   clearTimeout ( timeoutId );
	if (initN>=totalN){ initN=0; }
	t = "testimonialLoader2("+totalN+","+(initN+1)+")";
	c = getTestimonial2(initN);
	timeoutId = setTimeout(t,15000);
}

function randomLoader(var1)
{
	clearTimeout ( timeoutId );
	if(var1=='1'){ n=0;}
	n++;
	if(n==1){ c = getTestimonial(); }
	else { c = getTestimonial2();}
	timeoutId = setTimeout("randomLoader()",15000);
}

function autoBlur(){ 
if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") 
document.body.focus(); 
} 
document.onfocusin=autoBlur;

function changeImage(value,txt1)
{
	document.zoomimage.src = "show_image2.php?width=565&filename=upload_images/"+value;
	if(document.all){
    	document.getElementById('titlebox').innerText = txt1;
	} else{
		document.getElementById('titlebox').textContent = txt1;
	}
}
function showResponse (originalRequest) {
		//$('loading').style.display = "none";	
       // alert(originalRequest.responseText);
       //Effect.Fade('tbox',{delay:0,duration:0.3});
    	$('tbox').innerHTML = originalRequest.responseText;
       // document.getElementById('tbox').style.display='inline';
	   Effect.Appear('tbox',{delay:0.5,duration:1.0}); 
		
}
function fadeOld(){
		Effect.Fade('tbox',{delay:0,duration:0.3});
}
function showLoad () {
		//Effect.Fade('tbox',{delay:0,duration:0.5});        
     //$('tbox').style.display = "block";	
}

function getTestimonial(initN){
	var rand   = Math.random(9999);
	var url    = 'testimonial.php?' + "&ms=" + new Date().getTime() + "&rand=" + rand + "&orderN=" + initN;
    var pars   = 'type=';
    var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onComplete: showResponse} );
}
function getTestimonial2(initN){
	var fadeout = fadeOld();
	var rand   = Math.random(9999);
	var url    = 'testimonial.php?' + "&ms=" + new Date().getTime() + "&rand=" + rand + "&orderN=" + initN;
    var pars   = 'type=';
    var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: fadeOld(), onComplete: showResponse} );
}
function confirmDelete(delUrl) {
	var agree=confirm("Are you sure you wish to continue?");
	if (agree){
		parent.location=delUrl;
		return true ;
	}else{
		return false ;
	}
}