// user settings
var totalShots; // Total number of shots
var delay; // time between shots in seconds
var secs; // Number of times between shots - tmp storage
var shotsleft; // Number of shots left
var timer; // Time left minuites!
var paused; // Booleon value if its paused or not
var constructed = false; // Booleon to tell if its been constructed
var shotsdone;
var random = 0;
var vidid;
var songname;
var artist;
var strseconds;
var ids = new Array(['Guru Josh Project','Infinity','w9KnuJZkBjg'],['Oasis','Wonderwall','6hzrDeceEKc'],['The Killers','Mr Brightside','SrkeWsQZNyU'],['The Killers','Human','ClV5eRnOW4g'],['Johny Cash','Ring Of Fire','0lhf9U5Wf3Q'],['Nickelback','Rockstar','zmA7HDGAZ6I'],['The Verve','Bittersweet Symphony','rV5VmhY3-Sw'],['Coldplay','Viva La Vida','1bJMxhvVf0o'],['Jimmy Eat World','The Middle','FV-HPOHu8mY'],['Coldplay','Yellow','GQxLTCQop2I'],['Survivor','Eye Of The Tiger','sI6r6APUwK0'],['Guns N Roses','Welcome To The Jungle','e6SDIpETcgE'],['Kanye West','Stronger','gG50h6ajBDg'],['Katy Perry','I Kissed A Girl','dO5uCKw4nl0'],['Athlete','Halflight','zHJEkR7aotY'],['Athlete','Wires','y3x_ZXyix-M'],['Red Hot Chili Peppers','By The Way','2M1qoUj_jsw'],['Red Hot Chili Peppers','Dani California','VpR0SAbNXmQ'],['Lostprophets','Rooftops','ikopFauUH48'],['Lostprophets','Last Train Home','NjKmCxyKmas'],['Stereophonics','Maybe Tomorrow','eX3KrXFAsd0'],['Sterophonics','Dakota','6XST_vsZ5bQ'],['The Wombats','Moving To New York','RT90JV-GGe8'],['The Wombats','Lets Dance To Joy Division','DCf84ov2MZ4'],['Snow Patrol','Run','AOBs8dU4Pb8'],['Queen of the Stone Age','go with the flow','bxnTdlnZlAk'],['Kings Of Leon','Use Somebody','vUFDOlO6B2w'],['Kings Of Leon','Charmer','vhm1DuyrIww'],['Kings Of Leon','Crawl','hHOyahv4hSE'],['Air Traffic','Shooting Star','tctCeUp7hxA'],['Klaxons','Gravitys Rainbow','qDrctb2BzLg'],['Klaxons','Golden Skans','41bmmaPdnY8'],['La Roux','In For The Kill','9lVaWYkKOdY'],['Kings Of Leon','Revelry','EZyGWg0uqkw'],['Dido','White Flag','d05zbvtGhtE'],['Green Day','Holiday','Mtp9gNx7nV0'],['Queen','Don\'t Stop Me Now','HgzGwKwLmgM'],['Prodigy','Omen','uVefPPr69NU'],['Pendulum','Propane Nightmares','y2KC1P9s6-Q'],['Lily Allen','The Fear','7F-lqOrRcIY'],['Hanson','Mmmbop','CFIkJMN7dFc'],['Metro','Shake it','DAvyzqbwFL8'],['2Pac','Ghetto Gospel','IxR4AweLeXE'],['Linkin Park','Numb Encore','oRNeI2oLBXw'],['Queen','Bohemian Rhapsody','cjKDk4aJJps'],['DMC','Its Tricky','1cYQV62WhkM'],['Europe','The Final Countdown','tt_ro2aerQg'],['Katy Perry','Hot N Cold','y-LhyAVzDBI'],['Bon Jovi','Living On A Prayer','5R_qnrezOZ8'],['Kasabian','Empire','HTsOmNllV1s'],['OK Go','Here It Goes Again','dTAAsCNK7RA'],['Lupe Fiasco','Superstar','lffn-O0ZA_I'],['Razorlight','America','lzNi3QjNRIc'],['Michael Jackson','Billie Jean','75sx7U6dAB4'],['Bryan Adams','Summer Of 69','9f06QZCVUHg'],['Jamiroquai','Canned Heat','hGjC0wbUXzk'],['Timbaland','Apologize','ePyRrb2-fzs'],['Rihanna','Umbrella','ePyRrb2-fzs'],['Fall Out Boy','Dance Dance','J7TTR6U3nwg'],['Plain White T\'s','Hey There Delilah','EbJtYqBYCV8'],['Ne-Yo','Closer','iZmXfmSLuo'],['Black Eyed Peas','Pump It','AM77ye_FpA0'],['The Police','Roxanne','z6xMdqjxqJI'],['Blur','Song 2','JATWwU3Aa-4'],['Feeder','Feeling the moment','MjgQLEZ6vjY'],['Feeder','Buck Rogers','zw0VqRoaq04'],['Travis','Why Does It Always Rain On me','Nwh3FmpZ7kg'],['Toploader','Dancing In the Moonlight','qB8eip3bgBs'],['Robie Williams','Angels','73KIIOBCfK0'],['Wheatus','Teenage Dirtbag','8jJWQkVgDs4'],['Muse','Starlight','Pgum6OT_VH8'],['Journey','Dont Stop Believin','rfUYuIVbFg0'],['The Jame','Town Called Malice','wT7xvMi6pzE'],['Undertones','Teenage Kicks','oskM5XD_Yc4&'],['LYNYRD SKYNYRD','Sweet Home Alabama','RHsDa9_HSlA'],['Blink182','I miss you','m2yStD2GWhU'],['Bloc Party','Flux','ttcboE1GrNg'],['Kate Nash','Foundations','ryH5cga0yUI'],['The beach boys','I Get Around','mN7Xs9WVNBU'],['Cornershop','Brimful Of Asha','cDe6regyJnU'],['Motorhead','Ace of spades','oZjEk2QEb8c'],['Electric Six','Gay Bar','HTN6Du3MCgI'],['Chesney Hawkes','I Am The One And Only','QNQdxCWm4KM'],['The Bloodhound Gang','The Bad Touch','iTW8oUV8Aq0'],['Nirvana','Smells Like Teen Spirit','zYxkezUr8MQ'],['Guns N Roses','Sweet Child Of Mine','oobDQ0vdm8M'],['REM','Losing My Religion','A_GfCi0UYoY&'],['The Police','Every Breath You Take','OMOGaugKpzs'],['Metallica','One','EzgGTTtR0kc'],['The Troggs','Wild Thing','4qHX493bB3U'],['MC Hammer','U Cant Touch This','2c4L4CPfQY8'],['David Bowie','Life On Mars','6C0RmRGTePw'],['Gym Class Heroes','Cookie Jar','7jKSp52DN58'],['Don MecLean','American Pie','mZ8miTErh-o'],['Deep Blue Something','Breakfast At Tifineys','RiI8r05Zoqc'],['Gym Class Heros','Clothes Off','Y7Rjh21dfMg'],['Oasis','Live Forever','R2poqYvWsyU'],['All Star','Smash Mouth','kdrgtWBy7c4'],['Owl City','Fireflies','psuRGfAaju4'],['Cheryl Cole','Fight For This Love ','4umc87T5UMs'],['Jay-Z','Empire State of Mind','bm61weFrK4c'],['Mumford & Sons','The Cave ','fNy8llTLvuA'],['Professor Green','I Need You Tonight','h4Fcb7ToaoA'],['Same Jeans','The View','GpF51y8udgY'],['The Lonely Island','Im On A Boat','UBCrsaet-2Q'],['Rick Astley','Never Gonna Give You Up','oHg5SJYRHA0'],['Yolanda Be Cool and Dcup','We No Speak Americano','cfCv_EgSM-0'],['Ellie Goulding','Starry Eyed','PULdPep_xfs'],['Eminem','Love The Way You Lie','uelHwf8o7_U'],['Jason Derulo','Ridin Solo','8ESdn0MuJWQ'],['Blink 182','All the small things','kKVePZMcqeI'],['Calvin Harris','I\'m Not Alone','a8TPXFoXO5A'],['Black Eyed Peas','I Gotta Feeling ','uSD4vsh1zDA'],['Journey','Don\'t stop beliving','OGzwNdTVHJo'],['Muse','Uprising','AtZV5XdfqrI'],['Death Cab For Cutie','I Will Follow You Into The Dark','j6XZsau7CSk'],['Lady Gaga','Paparazzi','XcHsE1ELzjo'],['Ke$ha','Tik Tok','oGhQNUCdQLU'],['Sidney Samson','Riverside','V775PPuBc7Y'],['The Libertines','Can\'t Stand Me Now','p2oTuxXjbO4'],['Katy Perry','Firework','cTfZXh427B0'],['Willow','Whip My Hair','MQSWE3KVdVw'],['Jamie T','Sheila','4-L7Cadb-c0'],['Lonely Island','I Just Had Sex','lQlIhraqL7o'],['Jay-Z','99 Problems','LeatgdBBqpc'],['Jason Derulo','Whatcha Say','pBI3lc18k8Q'],['Taio Cruz','Dirty Picture','RgnXl7fz0Bc'],['Black Eyed Peas','The Time','JwQZQygg3Lk'],['Rihanna','Love The Way You Lie','ZGT6AKt3eYM'],['David Guetta Feat. Kid Cudi','Memories','Yk2YoxzSKkw'],['Far East Movement','Like A G6','GvgJEznqtms'],['Usher ft Pitbull','Dj Got Us Falling in Love Again','oBhj-Tv4WHI'],['Lonely Island feat. Akon','I Just Had Sex','lQlIhraqL7o'],['The Black Eyed Peas','I Gotta Feeling ','uSD4vsh1zDA'],['Cee Lo Green','FUCK YOU','pc0mxOXbWIU'],['Chase & Status','Hypest Hype','W2Uwu5GR3eI'],['Oasis','Don\'t Look Back In Anger','r8OipmKFDeM'],['Bob Marley','Buffalo Solider','S5FCdx7Dn0o'],['Chase And Status','End Credits','ZK4qgveLlTE'],['Bloc Party','Flux','ttcboE1GrNg']);
var timer2;
// construct values
function construct(){
if(!constructed){
totalshots = document.config.totalshots.value;
delay = document.config.delay.value;
shotsleft = totalshots;
timer = ((shotsleft * delay)/60)-1;
paused = false;
constructed = true;
secs = delay;
shotsdone = 0;
//document.getElementById("start").value="Resume";
start();
ids.shuffle();
randvid();
}
else if(paused){
unpause();
}
}
// start
function start(){
if(!paused){
if(shotsleft == 0){
end();
}
else if (delay > 0) {
delay--;
}
else if(delay == 0){
// next song on youtube
shotsleft--;
delay = secs;
timer = ((shotsleft * delay)/60)-1;
shotsdone = (totalshots - shotsleft);
randvid();
}
if(delay < 10){
strseconds = "0" + delay;
}
else{
strseconds = delay;
}
document.getElementById('seconds').innerHTML = strseconds;
document.getElementById('shotsdone').innerHTML = shotsdone;
document.getElementById('shotsleft').innerHTML = shotsleft;
document.getElementById('minuites').innerHTML = timer;
timer2 = setTimeout('start()', 1000);
}
}
// stop
function end(){
window.location = "completed.php"
}
// Pause
function pausecent(){
if(paused){
unpause();
}
else{
pause();
clearTimeout(timer2);
paused = true;
}
}
//unpause
function unpause(){
paused = false;
play();
start();
}
//restart
function restart(){
window.location.reload()
}
// load random video
function randvid(){
if(random >= ids.length){
random = 0;
}
vidid = ids[random][2];
songname = ids[random][1];
artist = ids[random][0];
random = random + 1;
ytplayer.loadVideoById(vidid, 5);
document.getElementById('songname').innerHTML = songname;
document.getElementById('artist').innerHTML = artist;
}
// shuffle function - return array
Array.prototype.shuffle = function(){
this.sort(function(){return Math.round(Math.random()) - .5;});
return this;
};