var xmlhttpreqs;
var lastset;
var firstsent = false;
var received = true;

function switchTab(set, tab, link, content, id) {

	var tab1 = document.getElementById(set+'-1');
	var tab2 = document.getElementById(set+'-2');
	var tab3 = document.getElementById(set+'-3');
	var tab4 = document.getElementById(set+'-4');

	var tab1l = document.getElementById(set+'-l1');
	var tab2l = document.getElementById(set+'-l2');
	var tab3l = document.getElementById(set+'-l3');
	var tab4l = document.getElementById(set+'-l4');
	var thetab = document.getElementById(tab);
	var thelink = document.getElementById(link);

	tab1.style.borderBottomWidth = '1px';
	tab1.style.backgroundColor = '#87c72b';
	tab1.style.backgroundImage = "url('http://www.myzipple.com/images/tabimage.jpg')";
	tab1l.style.color = '#3366cc';
	tab2.style.borderBottomWidth = '1px';
	tab2.style.backgroundColor = '#87c72b';
	tab2.style.backgroundImage = "url('http://www.myzipple.com/images/tabimage.jpg')";
	tab2l.style.color = '#3366cc';
	tab3.style.borderBottomWidth = '1px';
	tab3.style.backgroundColor = '#87c72b';
	tab3.style.backgroundImage = "url('http://www.myzipple.com/images/tabimage.jpg')";
	tab3l.style.color = '#3366cc';
	tab4.style.borderBottomWidth = '1px';
	tab4.style.backgroundColor = '#87c72b';
	tab4.style.backgroundImage = "url('http://www.myzipple.com/images/tabimage.jpg')";
	tab4l.style.color = '#3366cc';
	thetab.style.borderBottomWidth = '0px';
	//thetab.style.backgroundColor = '#97acd4';
	thetab.style.backgroundColor = '#ffffff';
	thetab.style.backgroundImage = '';
	thelink.style.color = '#ffa54e';
	

	lastset = set;

	if (firstsent) {
		//while (!received) {}
	}

	xmlhttpreqs=null
	if (window.XMLHttpRequest) {
		xmlhttpreqs=new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		xmlhttpreqs=new ActiveXObject("Microsoft.XMLHTTP");
	} else {
	}
	if (xmlhttpreqs!=null) {
 	 	xmlhttpreqs.onreadystatechange=state_Changelreqs;
		xmlhttpreqs.open('GET', 'http://www.myzipple.com/tabs/'+content+'.php?id='+id, true);
		xmlhttpreqs.send(null);
		firstsent = true;
		received = false;
	}

}

function state_Changelreqs()
{
if (xmlhttpreqs.readyState==4)
  {
  if (xmlhttpreqs.status==200)
    {
    document.getElementById(lastset).innerHTML = xmlhttpreqs.responseText;
	received = true;
    }
  else
    {

    }
  }
}