//v1.7
// SPD Ajax Control
// Detect Client Browser type
// Copyright 2009 ShockWave-Design.  All rights reserved.

//globale Instanz von XMLHttpRequest
var xmlHttp = false;
var lastsite = "";
var lastid = "";
var actid= 0;

var aktiv = window.setInterval("loadDataIntervall()", 6000);


//XMLHttpRequest-Instanz erstellen
//... für Internet Explorer

try {
    xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
    try {
        xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
    } catch(e) {
        xmlHttp  = false;
    }
}
//... für Mozilla, Opera, Safari usw.
if (!xmlHttp  && typeof XMLHttpRequest != 'undefined') {
    xmlHttp = new XMLHttpRequest();
}
 
//aktuelle Daten laden

function loadQuest()
{
	try {
    document.getElementById('treading').style.display = "none";
	document.getElementById('tquest').style.display = "block";
	document.all.treading.style.display = "none";
	document.all.tquest.style.display = "block";
	pageTracker._trackPageview("/writequestion");
    } catch(e) {
        return false;
    }
	
	return false;
}

function loadOwn()
{
	try {
    document.getElementById('treading').style.display = "none";
	document.getElementById('twriting').style.display = "block";
	document.all.treading.style.display = "none";
	document.all.twriting.style.display = "block";
	pageTracker._trackPageview("/writetestimonial" );
    } catch(e) {
        return false;
    }
	
	return false;
}

function loadTest()
{
	try {
    document.getElementById('treading').style.display = "block";
	document.getElementById('twriting').style.display = "none";
	document.getElementById('tquest').style.display = "none";
	document.all.treading.style.display = "block";
	document.all.twriting.style.display = "none";
	document.all.tquest.style.display = "none";
    } catch(e) {
        return false;
    }
	
	return false;
}

function monitornews(newstitle)
{
//alert(newstitle);
pageTracker._trackPageview("/"+newstitle);	
}

function loadDataIntervall()
{
	loadData('acttext','testimonials.php?tm='+(actid+1),(actid+1));
}

function loadData(id,http,nid)
{
lastsite = http;
lastid = id;
actid=nid;
 if (xmlHttp) {
     document.getElementById('trcswitchdisp').innerHTML  = "<div id='trcswitchdisp'><a href='javascript:reloadData();'><img src='http://www.motorradkiosk.de/wp-content/themes/k2/images/spinner.gif' border='0'></a></div>";

     xmlHttp.open('GET', http, true);
     xmlHttp.onreadystatechange = function () {
         if (xmlHttp.readyState == 4) {
			 document.getElementById('trcswitchdisp').innerHTML  = "<div id='trcswitchdisp'></div>";
             document.getElementById(id).innerHTML  = xmlHttp.responseText;
         }
     };
     xmlHttp.send(null);
 }
}


// noch mal laden

function reloadData()
{
http = lastsite;
id = lastid;
loadData(id,http);
}

function dt(cdisp, ctext)
{
	try {
		if(document.getElementById(cdisp).value == ctext)
		{
		document.getElementById(cdisp).value = "";
		}
	} catch(e) {
        return false;
    }
}


function wt(cdisp, ctext)
{
	try {
		if(document.getElementById(cdisp).value == "")
		{
		document.getElementById(cdisp).value = ctext;
		}
	} catch(e) {
        return false;
    }
}