var opac = new Array()
opac = 100
var dtime = 3000
var play = 1
var y
var target
var FadeMethod = (0-5)
var Speed = 5
var curb1 = 1
var curb2 = 1
var curb3 = 1
var curs = 1
var a = new Image()
a.src = "Images/Purchase2.png"
a.src = "Images/Free2.png"

function Over(target)
{
	var Button = target + "Button"
	document.getElementById(Button).src = 'Images/' + target + '2.png'
}

function Out(target)
{
	var Button = target + "Button"
	document.getElementById(Button).src = 'Images/' + target + '.png'
}

function Play()
{
	play = 1
	y = setTimeout("Fade()",dtime)
}

function Stop()
{
	clearTimeout(y)
	play = 0
}

function Next()
{
	clearTimeout(y)
	Fade()
}

function Prev()
{
	clearTimeout(y)
	curb1 = curb1 - 2
	curb2 = curb2 - 2
	curb3 = curb3 - 2
	curs = curs - 2
	if (curb1 == 0)
	{
		curb1 = maxb1 - 1
	}
	if (curb2 == 0)
	{
		curb2 = maxb2 - 1
	}
	if (curb3 == 0)
	{
		curb3 = maxb3 - 1
	}
	if (curs == 0)
	{
		curs = maxs - 1
	}
	if (curb1 == -1)
	{
		curb1 = maxb1 - 2
	}
	if (curb2 == -1)
	{
		curb2 = maxb2 - 2
	}
	if (curb3 == -1)
	{
		curb3 = maxb3 - 2
	}
	if (curs == -1)
	{
		curs = maxs - 2
	}
	Fade()
}

function Fast()
{
	dtime = dtime / 2
	if (dtime < 50)
	{
		dtime = 50
	}
	else
	{
		Speed = Speed - (0-1)
	}
	document.getElementById("SpeedDiv").innerHTML = Speed
}

function Slow()
{
	Speed = Speed - 1
	if (Speed < 0)
	{
		Speed = 0
	}
	else
	{
		dtime = dtime * 2
	}
	document.getElementById("SpeedDiv").innerHTML = Speed
}

function Swapb1()
{
	curb1 = curb1 - (0-1)
	if (curb1 > maxb1)
	{
		curb1 = 1
	}
	var id = Banners1[curb1]
	var choice = "Banners"
  xmlHttpb1=GetXmlHttpObject()
  if (xmlHttpb1==null)
  {
    alert ("Browser does not support HTTP Request")
    return
  } 
  var url="Swap.php?choice=" + choice + "&id=" + id + "&sid="+Math.random()
  xmlHttpb1.onreadystatechange=DoSwapb1
  xmlHttpb1.open("GET",url,true)
  xmlHttpb1.send(null)
}

function DoSwapb1() 
{ 
  if ((xmlHttpb1.readyState==4 || xmlHttpb1.readyState=="complete"))
  { 
    document.getElementById("Banners1").innerHTML=xmlHttpb1.responseText
  }
}

function Swapb2()
{
	curb2 = curb2 - (0-1)
	if (curb2 > maxb2)
	{
		curb2 = 1
	}
	var id = Banners2[curb2]
	var choice = "Banners"
  xmlHttpb2=GetXmlHttpObject()
  if (xmlHttpb2==null)
  {
    alert ("Browser does not support HTTP Request")
    return
  } 
  var url="Swap.php?choice=" + choice + "&id=" + id + "&sid="+Math.random()
  xmlHttpb2.onreadystatechange=DoSwapb2
  xmlHttpb2.open("GET",url,true)
  xmlHttpb2.send(null)
}

function DoSwapb2() 
{ 
  if ((xmlHttpb2.readyState==4 || xmlHttpb2.readyState=="complete"))
  { 
    document.getElementById("Banners2").innerHTML=xmlHttpb2.responseText
  }
}

function Swapb3()
{
	curb3 = curb3 - (0-1)
	if (curb3 > maxb3)
	{
		curb3 = 1
	}
	var id = Banners3[curb3]
	var choice = "Banners"
  xmlHttpb3=GetXmlHttpObject()
  if (xmlHttpb3==null)
  {
    alert ("Browser does not support HTTP Request")
    return
  } 
  var url="Swap.php?choice=" + choice + "&id=" + id + "&sid="+Math.random()
  xmlHttpb3.onreadystatechange=DoSwapb3
  xmlHttpb3.open("GET",url,true)
  xmlHttpb3.send(null)
}

function DoSwapb3() 
{ 
  if ((xmlHttpb3.readyState==4 || xmlHttpb3.readyState=="complete"))
  { 
    document.getElementById("Banners3").innerHTML=xmlHttpb3.responseText
  }
}

function Swaps()
{
	curs = curs - (0-1)
	if (curs > maxs)
	{
		curs = 1
	}
	var id = Services[curs]
	var choice = "Services"
  xmlHttps=GetXmlHttpObject()
  if (xmlHttps==null)
  {
    alert ("Browser does not support HTTP Request")
    return
  } 
  var url="Swap.php?choice=" + choice + "&id=" + id + "&sid="+Math.random()
  xmlHttps.onreadystatechange=DoSwaps
  xmlHttps.open("GET",url,true)
  xmlHttps.send(null)
}

function DoSwaps() 
{ 
  if ((xmlHttps.readyState==4 || xmlHttps.readyState=="complete"))
  { 
    document.getElementById("Services").innerHTML=xmlHttps.responseText
  }
}

function Fade()
{
	clearTimeout(y)
	opac = Math.floor(opac + FadeMethod)
	document.getElementById("Banners1").style.filter="alpha(opacity=" + opac + ")"
	document.getElementById("Banners1").style.MozOpacity=(opac / 100)
	document.getElementById("Banners1").style.opacity=(opac / 100)
	document.getElementById("Banners2").style.filter="alpha(opacity=" + opac + ")"
	document.getElementById("Banners2").style.MozOpacity=(opac / 100)
	document.getElementById("Banners2").style.opacity=(opac / 100)
	document.getElementById("Banners3").style.filter="alpha(opacity=" + opac + ")"
	document.getElementById("Banners3").style.MozOpacity=(opac / 100)
	document.getElementById("Banners3").style.opacity=(opac / 100)
	document.getElementById("Services").style.filter="alpha(opacity=" + opac + ")"
	document.getElementById("Services").style.MozOpacity=(opac / 100)
	document.getElementById("Services").style.opacity=(opac / 100)
	if (opac == 0)
	{
		Swapb1()
		Swapb2()
		Swapb3()
		Swaps()
		FadeMethod = FadeMethod * (0-1)
		y = setTimeout("Fade()",500)
	}
	else if (opac == 100)
	{
		FadeMethod = FadeMethod * (0-1)
		if (play == 1)
		{
			y = setTimeout("Fade()",dtime)
		}
	}
	else
	{
		y = setTimeout("Fade()",10)
	}
}

function Start()
{
	y = setTimeout("Fade()",dtime)
}

function Go(choice)
{
	document.location = choice;
}

function AJAX_FUNCTION(DOVAR)
{
  xmlHttp=GetXmlHttpObject()
  if (xmlHttp==null)
  {
    alert ("Browser does not support HTTP Request")
    return
  } 
  var url="PHP_PAGE.php?VAR=" + DOVAR + "&sid="+Math.random()
  xmlHttp.onreadystatechange=AJAXCALL
  xmlHttp.open("GET",url,true)
  xmlHttp.send(null)
}

function AJAXCALL() 
{ 
  if ((xmlHttp.readyState==4 || xmlHttp.readyState=="complete"))
  { 
    document.getElementById("AJAXDIV").innerHTML=xmlHttp.responseText
  }
}

function GetXmlHttpObject()
{
  var xmlHttp=null;
  try
  {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
  }
  catch (e)
  {
    //Internet Explorer
    try
    {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e)
    {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}