//(c)2006-2012 Max Edwards - www.maxedwards.com
//
function insertMTL() {
var e = 'info /#/ inspiratron.com'.replace(' /#/ ', '@');
document.write('<a href="m' + 'ai' + 'lt' + 'o:' + e + '">' + e + '</a>');
}
var serverName='www.inspiratron.com';
var appPath='';
var activeCC='??';
var fallbackCC='US';
var loadCSSH=false
function replaceAll(s, text, by, ignoreCase) {
var rai = -1;
var textlc=text.toLowerCase();
if(ignoreCase) rai = s.toLowerCase().indexOf(textlc);else rai = s.indexOf(text);
var its = 0;
while (rai>=0 && its < 5000) {
its++;
if(rai>0)
s = s.slice(0, rai) + by + s.slice(rai+text.length);
else
s = by + s.slice(rai+text.length);
if(ignoreCase) rai = s.toLowerCase().indexOf(textlc, rai+by.length);else rai = s.indexOf(text, rai+by.length);
}
if(its>=5000) alert('OVERFLOW!');
return s;
}
function trim(s) {return ltrim(rtrim(s));}
var whitespace = ' \t\n\r';
function rtrim(s) {
while (whitespace.indexOf(s.charAt(s.length-1)) >= 0 && s.length > 0)
if(s.length == 1) s='';else s = s.slice(0, -1);
return s;
}
function ltrim(s) {
while (whitespace.indexOf(s.charAt(0)) >= 0 && s.length > 0)
if(s.length == 1) s='';else s = s.slice(1);
return s;
}
function getRefToDiv(divID) {return getRefToElement(divID);}
function getRefToElement(id) {
if( document.layers ) {
return document.layers[id];}
if( document.getElementById ) {
return document.getElementById(id);}
if( document.all ) {
return document.all[id];}
if( document[id] ) {
return document[id];}
return false;
}
function keypress_ShowDivIfCapsLockOn(divID, e){
kc = e.keyCode?e.keyCode:e.which;
sk = e.shiftKey?e.shiftKey:((kc == 16)?true:false);
if(((kc >= 65 && kc <= 90) && !sk)||((kc >= 97 && kc <= 122) && sk))
getRefToElement(divID).style.visibility = 'visible';
else
getRefToElement(divID).style.visibility = 'hidden';
}
function getInnerText(obj) {
if(typeof(obj.innerText) != 'undefined') return (obj.innerText);
if(typeof(obj.textContent) != 'undefined') return(obj.textContent);
if(typeof(obj.text) != 'undefined') return(obj.text);
return null;
return obj.innerText || obj.textContent || obj.text;
}
function setInnerText(obj, txt) {
if(typeof(obj.innerText) != 'undefined') {obj.innerText = txt;return}
if(typeof(obj.textContent) != 'undefined') {obj.textContent = txt;return}
if(typeof(obj.text) != 'undefined') {obj.text = txt;return}
return null;
}
function addEvent(obj, eventname, func) {
if(typeof obj.addEventListener != 'undefined')
obj.addEventListener(eventname, func, false);
else
if(typeof obj.attachEvent != 'undefined') {
obj.attachEvent('on' + eventname, func);
}else {
eval('obj.on' + eventname + ' = func;');
}
}
function addLoadEvent(func) {
if(typeof window.addEventListener != 'undefined')
window.addEventListener('load', func, false);
else
if(typeof document.addEventListener != 'undefined')
document.addEventListener('load', func, false);
else
if(typeof window.attachEvent != 'undefined')
window.attachEvent('onload', func);
else {
if(typeof window.onload == 'function') {
var existing = window.onload;
window.onload = function() {
existing();
func();
}
}
else window.onload = func;
}
}
function addResizeEvent(func) {
if(typeof window.addEventListener != 'undefined')
window.addEventListener('resize', func, false);
else
if(typeof document.addEventListener != 'undefined')
document.addEventListener('resize', func, false);
else
if(typeof window.attachEvent != 'undefined')
window.attachEvent('onresize', func);
else {
if(typeof window.onload == 'function') {
var existing = window.onresize;
window.onresize = function() {
existing();
func();
}
}
else window.onresize = func;
}
}
function XMLfetch(loc, async, asyncCallbackFunction) {
var XMLrequest = createXMLHttpRequest();
if(XMLrequest) {
if(typeof(async) == 'undefined') async = false;
if(async) {
if(typeof(asyncCallbackFunction) == 'undefined') {
asyncCallbackFunction = function() {
if(XMLrequest.readyState==4) {
}
}
}
XMLrequest.onreadystatechange = asyncCallbackFunction;
}else {
try {XMLrequest.timeout=700;}catch (e) {}
}
try {XMLrequest.open("GET", loc, async);}catch (e) {
}
var ok = false;
try {XMLrequest.send('');ok = true;}catch (e) {}
if(!ok)
try {XMLrequest.send();ok = true;}catch (e) {}
if(ok && !async) return XMLrequest.responseText;else return '';
}else {
return '';
}
}
function createXMLHttpRequest() {
if(window.XMLHttpRequest) {
try { return new XMLHttpRequest();}catch(e) {}
}
if(window.ActiveXObject) {
try { return new ActiveXObject("Msxml2.XMLHTTP.5.0");}catch (e) {}
try { return new ActiveXObject("Msxml2.XMLHTTP.4.0");}catch (e) {}
try { return new ActiveXObject("Msxml2.XMLHTTP.3.0");}catch (e) {}
try { return new ActiveXObject("Msxml2.XMLHTTP");}catch (e) {}
try { return new ActiveXObject("Microsoft.XMLHTTP");}catch (e) {}
}
return null;
}
function dumpObject(obj) {
n = '';
for (property in obj) {
n += property + ' = \'' + eval('obj.' + property) + '\' ';
}
alert(n)
}
function setAllCheckboxes(aForm, aValue) {
var all = aForm.elements;
for (var i = 0;i < all.length;++i) {
if(all[i].nodeName.match(/^input$/i) && all[i].type.match(/^checkbox$/i))
all[i].checked = aValue;
}
}
function Random(N) {
return Math.floor(N * (Math.random() % 1));
}
function randomInt(MinV, MaxV) {
return MinV + Random(MaxV - MinV + 1);
}
var abIDcount = 0;
function makeAutoBanner(width, height, rangeStart, rangeFinish, keywords, baseURL) {
if(!baseURL) baseURL = appPath;
var urlJoin = '?';
var coun = '';
if(activeCC != '' && activeCC != '??') coun = activeCC;
var src= baseURL + '/autoban2_' + width + 'x' + height + coun + '/' + rangeStart + '/' + rangeFinish;
if(keywords) if(keywords != '') {
src += urlJoin + 'q=' + escape(keywords);
urlJoin = '&';
}
abIDcount += 1;
if(abIDcount == 1) {
src += urlJoin + 'id=1';
urlJoin = '&';
}
document.write('<iframe frameborder="0" width="' + width + '" height="' + height + '" src="' + src + '" border="0" marginwidth="0" marginheight="0" scrolling="no" style="background:transparent;"></iframe>');
}
function getStyle(obj,styleProp)
{
if(obj.currentStyle)
return obj.currentStyle[styleProp];
else if(window.getComputedStyle)
return document.defaultView.getComputedStyle(obj,null).getPropertyValue(styleProp);
return eval('obj.style.' + styleProp);
}
function elementVisible(obj) {
do {
if(getStyle(obj,'display').toUpperCase()=='NONE') return false;
if(getStyle(obj,'visibility').toUpperCase()=='HIDDEN') return false;
obj=obj.parentNode;
}while (obj.tagName.toUpperCase() != 'BODY');
return true;
}
var _SR_divPrefix;
var _SR_width;
var _SR_height;
var _SR_numBans;
var _SR_sideScroll;
var _SR_animate_interval_ms = 50;
var _SR_animate_duration_ms = 1000;
var _SR_minSecondsSpacing = 15;
var _SR_maxSecondsSpacing = 21;
var _SR_deferInit = true;
var __SR = new Array();
function SR_createRotator() {
__SR.length++;
__SR[__SR.length-1] = new SR_rotatorObject(__SR.length-1);
}
function SR_rotatorObject(arrayIndex) {
this.myIndex = arrayIndex;
this.prefix = _SR_divPrefix;
this.width = _SR_width;
this.height = _SR_height;
this.sideScroll = _SR_sideScroll;
this.numBans = _SR_numBans;
this.animate_interval_ms = _SR_animate_interval_ms;
this.animate_duration_ms = _SR_animate_duration_ms;
this.minSecondsSpacing = _SR_minSecondsSpacing;
this.maxSecondsSpacing = _SR_maxSecondsSpacing;
this.deferInit = _SR_deferInit;
this.banNew = randomInt(1, this.numBans);
this.banOld = -1;
if(this.sideScroll)
this.destVal = this.width;
else
this.destVal = this.height;
this.curVal = this.destVal;
var steps = this.animate_duration_ms / this.animate_interval_ms;
if(this.sideScroll)
this.animate_increment = Math.round(this.width / steps, 0);
else
this.animate_increment = Math.round(this.height / steps, 0);
if(this.animate_increment < 1) this.animate_increment = 1;
this.ensureNextBannerLoaded = function() {
var objNew = getRefToElement(this.prefix + this.banNew);
var objLinks = objNew.getElementsByTagName('a');
if(objLinks.length>0) {
var objImgs = objLinks[0].getElementsByTagName('img');
if(objImgs.length>0) {
var defSrc = getAttr(objImgs[0], 'defSrc');
if(defSrc) if(defSrc!='') if(defSrc.indexOf('http') == 0) {
objImgs[0].src = defSrc;
objImgs[0].removeAttribute('defSrc');
}
}
}
return true;
}
this.doNextStep = function() {
var objNew = getRefToElement(this.prefix + this.banNew);
this.ensureNextBannerLoaded();
if(this.banOld < 0) {
if(this.sideScroll) {
objNew.style.display = 'inline';
}else {
objNew.style.display = 'block';
}
}else {
this.curVal += this.animate_increment;
if(this.curVal > this.destVal) this.curVal = this.destVal;
if(this.sideScroll) {
objNew.style.width = this.curVal + 'px';
objNew.style.display = 'inline';
}else {
objNew.style.height = this.curVal + 'px';
objNew.style.display = 'block';
}
objNew.style.visibility = 'visible';
var objOld = getRefToElement(this.prefix + this.banOld);
if(this.curVal == this.destVal) {
objOld.style.display = 'none';
}else {
if(this.sideScroll)
objOld.style.width = (this.destVal - this.curVal) + 'px';
else
objOld.style.height = (this.destVal - this.curVal) + 'px';
}
}
if(this.curVal == this.destVal) {
var prog = (this.banNew-1) / (this.numBans-1);
var delay = this.minSecondsSpacing * prog + this.maxSecondsSpacing * (1 - prog);
this.banOld = this.banNew;
this.banNew = (this.banNew % this.numBans) + 1;
this.curVal = 0;
if(delay>3)
setTimeout('__SR[' + this.myIndex + '].ensureNextBannerLoaded();', Math.round((delay - 3) * 1000, 0));
else
this.ensureNextBannerLoaded();
setTimeout('__SR[' + this.myIndex + '].doNextStep();', Math.round(delay * 1000, 0));
}else {
setTimeout('__SR[' + this.myIndex + '].doNextStep();', this.animate_interval_ms);
}
}
this.doNextStep();
}
function getAttr(node, attr) {
var v = '';
try {v=node.getAttribute(attr);}catch (e) {
return '';
}
return v;
}
function availableWidth() {
if(typeof(window.innerWidth) != 'undefined') return window.innerWidth;
if(typeof(document.documentElement.clientWidth) != 'undefined') return document.documentElement.clientWidth;
return document.body.clientWidth;
}
function availableHeight() {
if(typeof(window.innerHeight) != 'undefined') return window.innerHeight;
if(typeof(document.documentElement.clientHeight) != 'undefined') return document.documentElement.clientHeight;
return document.body.clientHeight;
}
var uagent = navigator.userAgent.toLowerCase();
function isSmartphone() {
if(uagent.search('symbian')>=0) return true;
if(uagent.search('android')>=0) return true;
if(uagent.search('phone')>=0) return true;
if(uagent.search('ipad')>=0) return true;
if(uagent.search('ipod')>=0) return true;
if(uagent.search('nokia')>=0) return true;
if(uagent.search('windows')>=0) return false;
if(uagent.search('macos')>=0) return false;
if(uagent.search('linux')>=0) return false;
if(uagent.search('nix')>=0) return false;
if(uagent.search('webkit')>=0) return true;
return false;
}
function isMobile() {
return navigator.userAgent.match(/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|vodafone|o2|pocket|kindle|mobile|treo|ipaq|palm|nokia|blackberry|opera mini|lg|htc|mot|psp|sonyericsson|sgh|android|iphone|ipod)/i);
}
function googleVideo(docID, wid, hei, startP) {
var r = '';
r += '<embed style="width:' + wid + 'px;height:' + hei + 'px;" id="VideoPlayback" flashvars="initialTime=' + startP + '"';
r += ' type="application/x-shockwave-flash" quality="best" bgcolor="#000000"';
r += ' src="http://video.google.com/googleplayer.swf?docId=' + docID + '"></embed>';
return r;
}
function youTube(docID, wid, hei, dummy) {
var r = '';
r += '<object width="' + wid + '" height="' + hei + '">';
r += '<param name="movie" value="http://www.youtube.com/v/' + docID + '"></param>';
r += '<embed src="http://www.youtube.com/v/' + docID + '" type="application/x-shockwave-flash"';
r += ' width="' + wid + '" height="' + hei + '"></embed></object>';
return r;
}
function makeGoogleSearch(kw) {
var h = '';
var asID = '3u8fi7n9s2a';
if(asID!='') {
h += '<br /><br /><form action="http://www.google.com/cse" id="cse-search-box">';
h += '<div>';
h += '<input type="hidden" name="cx" value="partner-pub-3891734730917860:' + asID + '" />';
h += '<input type="hidden" name="ie" value="ISO-8859-1" />';
h += '<input type="text" name="q" size="31" value="' + kw + '"/>';
h += '<input type="submit" name="sa" value="Search" />';
h += '</div>';
h += '</form>';
h += '<scr' + 'ipt type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&amp;lang=en"></scr' + 'ipt>';
}
document.write(h);
}
function html5mp3OK() {
var audioTag = document.createElement('audio');
if(!(!!(audioTag.canPlayType) && ("no" != audioTag.canPlayType("audio/mpeg")) && ("" != audioTag.canPlayType("audio/mpeg")))) {
return false;
}
return true;
}
function getSel(){
var w=window,d=document,gS='getSelection';
return (''+(w[gS]?w[gS]():d[gS]?d[gS]():d.selection.createRange().text)).replace(/(^\s+|\s+$)/g,'');
}
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i = 0;i < vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable) {
return pair[1];
}
}
return null;
}
var topReps = 10;var topRepGap = 200;
var botReps = 10;var botRepGap = 120;
var fadeBy = 1;
var fadeGapMS = 90;
var fadeDelaySecs = 7;
var vagasList = new Array(
'...on E ...End!',
'...on A ...into D!',
'...on C ...into A!',
'...on B ...continue');
var tempoChanges = new Array(
'Dead slow',
'Slow & sleazy',
'Ease off',
'Double time',
'Half time',
'Pick it up',
'Faster!!',
'Full speed ahead!');
var keyChanges = new Array(
'E minor',
'F minor',
'F sharp minor',
'G minor',
'Ab minor',
'A minor',
'Bb minor',
'B minor',
'C minor',
'C sharp minor',
'D minor',
'Eb minor',
'E major',
'G major',
'C major',
'D major',
'A major',
'B major',
' GO MAJOR!',
'+1 semitone',
'+2 semitones',
'+3 semitones',
'-1 semitones',
'-2 semitones',
'-3 semitones');
var banterList = new Array(
'Keys vs Guitar',
'Keys vs Vocal',
'Vocal vs Guitar',
'Bass vs Keys',
'Bass vs Guitar',
'Bass vs Vocal',
'Bass vs Drums');
var soloList = new Array(
'Drums',
'Guitar',
'Keyboard',
'Bass',
'Scat vocal');
var breakList = new Array(
'Just the drums',
'Just drums & bass',
'Just drums & keys',
'Just drums & guitar',
'Just drums & vocal',
'Just guitar & vocal',
'Just bass & guitar',
'Just guitar & keys',
'Just bass & keys',
'Just bass & vocal',
'Just keys & vocal',
'Just the bass',
'Just the guitar',
'Just the keys',
'Drums drop out',
'Bass drop out',
'Guitar drop out',
'Keys drop out',
'END!',
'1 bar pause');
var styleList = new Array(
'80s Funk',
'James Brown!',
'Electro funk',
'Minimal funk',
'Latin',
'Folk',
'Country',
'Psychadelic',
'Glam',
'Ska',
'Dub',
'Reggae',
'Techno',
'Breakbeat',
'House',
'Disco',
'Blues',
'Soul');
var chordProgressions = new Array(
'12 bar blues',
'I-IV-I-V');
var changes = new Array;
var types = new Array;
addChanges('TEMPO', tempoChanges);
addChanges('VEGAS', vagasList);
addChanges('BANTER', banterList);
addChanges('KEY', keyChanges);
addChanges('SOLO', soloList);
addChanges('DROP', breakList);
addChanges('STYLE', styleList);
addChanges('CHORDS', chordProgressions);
function addChanges(type, list) {
if(list.length < 2) {
alert('Cannot add ' + type);
return;
}
changes.length ++;
changes[changes.length-1] = list;
types.length ++;
types[types.length-1] = type;
}
var curType = -1;
var nextType = -1;
var curSel = -1;
var nextSel = -1;
var allowFade = false;
function pickFromArray(arr) {
var i = Math.random() * (arr.length - 1);
return Math.round(i, 0);
}
function keyPressed() {
allowFade = false;
txt2.style.backgroundColor = '#000';
txt2.style.color = '#000';
txt2.innerHTML = '';
go(topReps, botReps);
}
function go(n1, n2) {
if(n1 > 0) {
var nextType = doChange(txt1, types, curType, true);
if(n1 == 1) {
curType = nextType;
txt1.innerHTML += ':';
txt2.style.backgroundColor = txt1.style.color;
txt2.style.color = txt1.style.backgroundColor;
}
setTimeout('go(' + (n1-1) + ',' + n2 + ');', topRepGap);
return;
}
if(n2 > 0) {
doChange(txt2, changes[curType], -1, false);
setTimeout('go(0,' + (n2-1) + ');', botRepGap);
}else {
allowFade = true;
setTimeout('doFade()', fadeDelaySecs * 1000);
}
}
var doneAll = true;
function doFade() {
if(!allowFade) return;
doneAll = true;
txt1.style.color = fadeColour(curColor(txt1));
txt1.style.backgroundColor = fadeColour(curBGcol(txt1));
txt2.style.color = fadeColour(curColor(txt2));
txt2.style.backgroundColor = fadeColour(curBGcol(txt2));
if(!doneAll) setTimeout('doFade()', fadeGapMS);
}
function fadeColour(txtCol) {
var col = new Array(0,0,0);
if(txtCol.charAt(0) == '#') {
var hb;
for (var i=0;i<=2;i++) {
hb = txtCol.slice(1 + 2 * i, 3 + 2 * i);
col[i] = parseHexByte(hb);
if(col[i] == 'NaN') alert(txtCol + '\n\nHex byte ' + i + ' = ' + hb + '\n\nNaN!');
}
}else {
col = txtCol.replace(' ', '').replace(' ','').replace('rgb(', '').replace(')', '');
col = col.split(',');
}
for (var i=0 ;i<=2;i++) {
col[i] -= fadeBy;
if(col[i] < 0) col[i] = 0;else doneAll = false;
}
var r = 'rgb(' + col[0] + ',' + col[1] + ',' + col[2] + ')';
if(r.indexOf('NaN') >= 0) {
alert(txtCol + '\n\nNaN!');
}
return r;
}
function curColor(obj) {
if( window.getComputedStyle )
return window.getComputedStyle(obj,null).color;
else {
return obj.currentStyle.color;
}
}
function curBGcol(obj) {
if( window.getComputedStyle )
return window.getComputedStyle(obj,null).backgroundColor;
else
return obj.currentStyle.backgroundColor;
}
function hexDigit(d) { if(d<10) return d;else return String.fromCharCode(55+d);}
function hexByte(d) {
var h = Math.floor(d/16);
var l = d-(16*h);
return '' + hexDigit(h) + hexDigit(l);
}
function parseHex(h) {
var asc = h.toString().toUpperCase().charCodeAt(0);
if(asc < 64) return (asc-48);else return (asc-55);
}
function parseHexByte(h) {return parseInt(parseHex(h.slice(0,1))*16 + parseHex(h.slice(1,2))*1);}
function doChange(div, selList, avoid, doCols) {
if(selList.length < 1) return 0;
var newP = pickFromArray(selList);
if((newP == avoid || newP == div.tmpSel) && selList.length > 1) {
return doChange(div, selList, avoid, doCols)
}
if(doCols) {
var cols = colourPairs[pickFromArray(colourPairs)];
div.style.backgroundColor = cols[0];
div.style.color = cols[1];
}
div.innerHTML = selList[newP];
div.tmpSel = newP;
return newP;
}
var allCols = new Array('000','00F','0F0','F00','FF0','FA0','AF0','F0F','F0A','A0F','0FF','0FA','0AF','FFF','AFF','FAF','FFA');
var colourPairs = new Array();
function makeColourSchemes() {
var c;
for (var i = 0;i < allCols.length;i++) {
c = allCols[i];
addCol(c, swapIt(c, '110'));
addCol(c, swapIt(c, '101'));
addCol(c, swapIt(c, '011'));
addCol(c, swapIt(c, '111'));
}
}
var xxx = true;
makeColourSchemes();
function addCol(c1, c2) {
colourPairs.length ++;
colourPairs[colourPairs.length - 1] = new Array('#' + repIt(c1), '#' + repIt(c2));
}
function repIt(s) {
var r = '';
var c;
for (var i=0;i<=2;i++) {
c = s.slice(i, i+1);
r += c + c;
}
return r;
}
function swapIt(col, mask) {
var r = '';
var c;
for (var i=0;i<=2;i++) {
c = col.slice(i, i+1);
if(mask.slice(i, i+1) == '1') {
if(c == '0')
r += 'F';
else
r += '0';
}else {
r += c;
}
}
return r;
}
if(document.all) {
document.onkeypress = keyPressed;
}else {
if(document.layers) document.captureEvents(Event.KEYPRESS);
if(typeof window.addEventListener != 'undefined')
window.addEventListener('keypress', keyPressed, false);
else
if(typeof document.addEventListener != 'undefined')
document.addEventListener('keypress', keyPressed, false);
else
if(typeof window.attachEvent != 'undefined')
window.attachEvent('onkeypress', keyPressed);
}
// JSOK
