//http://www.w3schools.com/Ajax/ajax_source.asp

//window.onload=function(){
// matchVideo();
//}

var curr = 39;

function nextVideo() {
	if (curr ==  39) {	curr = 1; } else { curr = curr+1; }
	showVideo(curr);
}

function prevVideo() {
	if (curr == 1) { curr = 39; } else { curr = curr-1; }
	showVideo(curr);
}

function matchVideo(){


document.getElementById("next").onclick = function(){ nextVideo(); };
document.getElementById("prev").onclick = function(){ prevVideo(); };

document.getElementById("videonav").getElementsByTagName("a").href = "#videos";
}

var xmlHttp;

var titles = new Array();
titles[1] = "Ugly Duckling - Everybody C'Mon feat. People Under The Stairs (1999)";
titles[2] = "Thes One on The Price Is Right";
titles[3] = "The classic People Under The Stairs animation 'Finding bin Laden' (2002)";
titles[4] = "Kidd Lexus - 40oz Session (produced by Double K - 2002)";
titles[5] = "Thes, Dub K and JazMak doing O.S.T. Intro - Arizona, USA (2003)";
titles[6] = "Double K scratching - Perth, Australia (3rd Sept '04)";
titles[7] = "Drumbox - Perth, Australia (3rd Sept '04)";
titles[8] = "Blowin' Wax - Perth, Australia (3rd Sept '04)";
titles[9] = "San Francisco Knights - Brighton, UK (8th Oct '04)";
titles[10] = "Yield - Brighton, UK (8th Oct '04)";
titles[11] = "Double K on the decks - Brighton, UK (8th Oct '04)";
titles[12] = "Outrun - Los Angeles, USA (22nd Apr '05)";
titles[13] = "KK on decks, Thes on chinstruments - Denver, USA (24th Oct '05)";
titles[14] = "Pumpin' - Denver, USA (24th Oct '05)";
titles[15] = "Live Access - Chicago, USA (16th Dec '05)";
titles[16] = "Thes One freestyle - UGHH in-store, Boston, USA (17th May '06)";
titles[17] = "Youth Explosion - UGHH in-store, Boston, USA (17th May '06)";
titles[18] = "Yield - Los Angeles, USA (2nd June '06)";
titles[19] = "Tuxedo Rap live on Fuel TV (July '06)";
titles[20] = "Double K and Mekalek scratch soundcheck, Bristol, UK (13th May '07)";
titles[21] = "We Smokin' (goddam) - Tha Brothaload, LA, USA (29th June '07)";
titles[22] = "Australia TV Interview (Jan '08)";
titles[23] = "Double K - Plantation Music (Sept '08)";
titles[24] = "Fun DMC interview (Sept '08)";
titles[25] = "Rick James the B-Boy from Buffalo (Sept '08)";
titles[26] = "Hip Hop Official Interview - Artists Of The Week (Sept '08)";
titles[27] = "Hip Hop Official Interview - Origins (Sept '08)";
titles[28] = "Hip Hop Official Interview - The Fans (Sept '08)";
titles[29] = "People Under The Stairs - Step Bacc live (Sept '08)";
titles[30] = "People Under The Stairs - The Wiz (Sept '08)";
titles[31] = "Thes One speaks on scoring Street Dreams film (May '09)";
titles[32] = "Official Carried Away Snippets (Oct '09)";
titles[33] = "Trippin' at the Disco - Official Video!!! (Oct '09)";
titles[34] = "Vans x PUTS 'Hit the Top' Remix Contest (Oct '09)";
titles[35] = "People Under The Stairs In Brazil Pt. 1 (Oct '09)";
titles[36] = "People Under The Stairs In Brazil Pt. 2 (Oct '09)";
titles[37] = "People Under The Stairs In Brazil Pt. 3 (Oct '09)";
titles[38] = "People Under The Stairs In Brazil Pt. 4 (Oct '09)";
titles[39] = "Talking with Thes One of People Under The Stairs";

function showVideo(str)
{

curr = str;
document.getElementById('num').childNodes[0].nodeValue = (curr);
document.getElementById('titles').childNodes[0].nodeValue = (titles[str]);

if (str.length==0)
  { 
  document.getElementById("vidbox").innerHTML="";
  return;
  }
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
var url="/php/videos.php";
url=url+"?v="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("vidbox").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;
}
