// xhtml strict EXTERNAL LINKS FUNCTION  
function externallinks()
{
    var c=document.getElementById('holder');
    if(c)
    {
        var ls=c.getElementsByTagName('a');
        for(var i=0;i<ls.length;i++){
            if(ls[i].getAttribute('rel')=='external')
            {
                ls[i].title+='(Link opens in new window)';
                ls[i].onclick=function(){window.open(this.href);return false}
            }
			else if(ls[i].getAttribute('rel')=='pdf')
            {
                ls[i].title+='(PDF opens in new window)';
				ls[i].className+='pdf';
                ls[i].onclick=function(){window.open(this.href);return false}
            }
			else if(ls[i].getAttribute('rel')=='doc')
            {
                ls[i].title+='(Document opens in new window)';
				ls[i].className+='doc';
                ls[i].onclick=function(){window.open(this.href);return false}
            }
			else if(ls[i].getAttribute('rel')=='real')
            {
                ls[i].title+='(Audio/video file opens in realPlayer)';
				ls[i].className+='real';
            }
        }
    }
}



// SHOW FEATURE
function showfeature(meoff,meon) {
	var turnoff=document.getElementById(meoff);
	var turnon=document.getElementById(meon);
	turnoff.className="featureoff";
	turnon.className="featureon";
}

// PICK RANDOM FEATURE
function pickfeature() {
	var showthis="feature0"+(Math.floor ( Math.random ( ) * (2) + 1 ));
	var showme=document.getElementById(showthis);
	showme.className="featureon";
}

// ONLOAD CALLS
window.onload=function(){
    if(!document.getElementById && !document.createTextNode){return;}
    externallinks();
}

// SWITCH IMAGE AND CAPTIONS
function showimage(n,caption) {
	thisimg="uploads/artists/cheung-gordon/image"+(n)+".jpg";
	document.getElementById("mainimage").src=(thisimg);
	document.getElementById("mainimage").title=(caption);
	document.getElementById("imagecaption").innerHTML=(caption);
}

// SET IMAGE TAB HIGHLIGHT OFF
function turnhioff(taboff) {
	var turntaboff=document.getElementById(taboff);
	turntaboff.className="norm";
}

// SET ALL OTHER IMAGE TAB HIGHLIGHTS OFF
function turntabsoff() { 
  var times = 20;
  for (i = 1; i <= (times); i++) { 
 	n = "tab"+(i);
	o = document.getElementById(n);
	if (o) {
		turnhioff(n);
	} else {
		times = (i);
	}
  } 
}




// *************** NEW FEATURES CODE *************** 

// TURN THIS FEATURE OFF
function turnfeatoff(foff) {
	document.getElementById(foff).className="featureoff";
}

// HIDE ALL FEATURES
function turnfeaturesoff() { 
  var times = 10;
  for (i = 1; i <= (times); i++) { 
 	p = "feature0"+(i);
	q = document.getElementById(p);
	if (q) {
		turnfeatoff(p);
	} else {
		times = (i);
	}
  } 
}

// HIDE FEATURE TAB SETS
function turnftabsoff(set) { 
  var times = 20;
  for (i = 1; i <= (times); i++) { 
 	n = (set)+(i);
	o = document.getElementById(n);
	if (o) {
		turnhioff(n);
	} else {
		times = (i);
	}
  } 
}

// SHOW SPECIFIC FEATURE AND TAB
function showmyfeature(divid,turnon) {
	turnfeaturesoff();
	k = "feature0"+(turnon);
	document.getElementById(k).className="featureon";
	b = "tab"+(divid);
	C = "tab"+(turnon)+(turnon);
	turnftabsoff(b);
	document.getElementById(C).className="hi";
}

// *************** NEW FEATURES CODE *************** 





// SET IMAGE TAB HIGHLIGHT ON
function changetab(tabon) {
	var turntabon=document.getElementById(tabon);
	turntabsoff();
	turntabon.className="hi";
}

// DYN BODGE SWITCH IMAGE AND CAPTIONS
function showdynimage(imgpath,n,caption) {
	thisimg=(imgpath)+(n)+".jpg";
	document.getElementById("mainimage").src=(thisimg);
	document.getElementById("mainimage").title=(caption);
	document.getElementById("imagecaption").innerHTML=(caption);
}

// DYN BODGE SWITCH IMAGE, CAPTIONS + TAB
function showtabimage(imageFile,n,caption) {
	//thisimg=(imgpath)+(n)+".jpg";
	thisimg=imageFile;
	thistab="tab"+(n);
	document.getElementById("mainimage").src=(thisimg);
	document.getElementById("mainimage").title=(caption);
	document.getElementById("imagecaption").innerHTML=(unescape(caption));
	turntabsoff();
	document.getElementById(thistab).className="hi";
}

// DYN BODGE SWITCH IMAGE, CAPTIONS + TAB
function showfeatureimage(imageFile,n,caption,url) {
	//thisimg=(imgpath)+".jpg";
	thistab="tab"+(n);
	captionlink="<a href='"+(url)+"'>"+(caption)+"&nbsp;&gt;</a>"
	document.getElementById("mainimage").src=(imageFile);
	document.getElementById("mainimage").title=(caption);
	document.getElementById("imagecaption").innerHTML=(captionlink);
	turntabsoff();
	document.getElementById(thistab).className="hi";
}

// GORMS SWITCH IMAGE AND CAPTIONS
function showimage2(imageFile,caption) {
	thisimg=imageFile;
	document.getElementById("mainimage").src=(thisimg);
	document.getElementById("mainimage").title=(caption);
	document.getElementById("imagecaption").innerHTML=(unescape(caption));
}


// ARTIST LIST PAGE
function goback(prev,year) {
	var hideback="back"+(year);
	var showback="back"+(prev);
	var hidenext="next"+(year);
	var shownext="next"+(prev);
	var hideyear="yr"+(year);
	var showyear="yr"+(prev);
	// SHOW THE RIGHT BACK BUTTON DIV
	document.getElementById(hideback).className="skiplink";
	document.getElementById(showback).className="backarw";
	// SHOW THE RIGHT FORWARD BUTTON DIV
	document.getElementById(hidenext).className="skiplink";
	document.getElementById(shownext).className="nextarw";
	// SHOW THE RIGHT YEAR DIVS
	document.getElementById(hideyear).className="artistlisthide";
	document.getElementById(showyear).className="artistlist";
}

// HIDE ALL BACK BUTTON DIVS
function hidebackbuttons() {
	document.getElementById('back2001').className="hideme";
	document.getElementById('back2002').className="hideme";
	document.getElementById('back2003').className="hideme";	
	document.getElementById('back2004').className="hideme";
	document.getElementById('back2005').className="hideme";
	document.getElementById('back2006').className="hideme";
	document.getElementById('back2007').className="hideme";
	document.getElementById('back2008').className="hideme";
}

// HIDE ALL NEXT BUTTON DIVS
function hidenextbuttons() {
	document.getElementById('next2001').className="hideme";
	document.getElementById('next2002').className="hideme";
	document.getElementById('next2003').className="hideme";	
	document.getElementById('next2004').className="hideme";
}

// HIDE ALL YEAR DIVS
function hideallyears() {
	document.getElementById('yr2001').className="hideme";
	document.getElementById('yr2002').className="hideme";
	document.getElementById('yr2003').className="hideme";	
	document.getElementById('yr2004').className="hideme";
	document.getElementById('yr2005').className="hideme";
	document.getElementById('yr2006').className="hideme";
	document.getElementById('yr2007').className="hideme";
	document.getElementById('yr2008').className="hideme";
}

// 2001 STATE
function year2001() {
	hideallyears();
	document.getElementById('yr2001').className="artistlist";
	document.getElementById('yr2002').className="artistlist";
	document.getElementById('yr2003').className="artistlist";
	document.getElementById('yr2004').className="artistlist";
	hidebackbuttons();
	hidenextbuttons();
	document.getElementById('next2001').className="nextarw";
}

// 2002 STATE
function year2002() {
	hideallyears();
	document.getElementById('yr2002').className="artistlist";
	document.getElementById('yr2003').className="artistlist";
	document.getElementById('yr2004').className="artistlist";
	document.getElementById('yr2005').className="artistlist";
	hidebackbuttons();
	document.getElementById('back2002').className="backarw";
	hidenextbuttons();
	document.getElementById('next2002').className="nextarw";
}

// 2003 STATE
function year2003() {
	hideallyears();
	document.getElementById('yr2003').className="artistlist";
	document.getElementById('yr2004').className="artistlist";
	document.getElementById('yr2005').className="artistlist";
	document.getElementById('yr2006').className="artistlist";
	hidebackbuttons();
	document.getElementById('back2003').className="backarw";
	hidenextbuttons();
	document.getElementById('next2003').className="nextarw";
}

// 2004 STATE
function year2004() {
	hideallyears();
	document.getElementById('yr2004').className="artistlist";
	document.getElementById('yr2005').className="artistlist";
	document.getElementById('yr2006').className="artistlist";
	document.getElementById('yr2007').className="artistlist";
	hidebackbuttons();
	document.getElementById('back2004').className="backarw";
	hidenextbuttons();
	document.getElementById('next2004').className="nextarw";
}

// 2005 STATE
function year2005() {
	hideallyears();
	document.getElementById('yr2005').className="artistlist";
	document.getElementById('yr2006').className="artistlist";
	document.getElementById('yr2007').className="artistlist";
	document.getElementById('yr2008').className="artistlist";
	hidebackbuttons();
	document.getElementById('back2004').className="backarw";
	hidenextbuttons();
}

// 2006 STATE
function year2006() {
	hideallyears();
	document.getElementById('yr2005').className="artistlist";
	document.getElementById('yr2006').className="artistlist";
	document.getElementById('yr2007').className="artistlist";
	document.getElementById('yr2008').className="artistlist";
	hidebackbuttons();
	document.getElementById('back2005').className="backarw";
	hidenextbuttons();
}

// 2007 STATE
function year2007() {
	hideallyears();
	document.getElementById('yr2005').className="artistlist";
	document.getElementById('yr2006').className="artistlist";
	document.getElementById('yr2007').className="artistlist";
	document.getElementById('yr2008').className="artistlist";
	hidebackbuttons();
	document.getElementById('back2005').className="backarw";
	hidenextbuttons();
}

// 2008 STATE
function year2008() {
	hideallyears();
	document.getElementById('yr2005').className="artistlist";
	document.getElementById('yr2006').className="artistlist";
	document.getElementById('yr2007').className="artistlist";
	document.getElementById('yr2008').className="artistlist";
	hidebackbuttons();
	document.getElementById('back2005').className="backarw";
	hidenextbuttons();
}










