function showTutorial() {
	document.write (" \
			<object width='481' height='216'> \
				<param name='wmode' value='transparent' value='/lib/Tour.swf'></param> \
				<embed wmode='transparent' src='/lib/Tour.swf' type='application/x-shockwave-flash' width='579' height='466'></embed> \
			</object> \
	");
}

function fixflash(containerID) {
	var flashContainer = document.getElementById(containerID);
	var flashMovie = document.createElement("div");
	flashMovie.innerHTML = flashContainer.innerHTML.replace(/</g, "<").replace(/>/g, ">");
	flashContainer.parentNode.insertBefore(flashMovie, flashContainer);
	flashContainer.parentNode.removeChild(flashContainer);
	flashMovie.setAttribute("id",containerID);
}

function showAudioPlayer(urlid,autostart,playerid) {
	if (!autostart) autostart = "no";
	
	document.write ("\
		<script language='JavaScript' src='/js/audio-player.js'></script>\
			<object type='application/x-shockwave-flash' data='/swf/player.swf' id='audioplayer1' height='30' width='275'>\
			<param name='movie' value='/swf/player.swf'>\
			<param name='FlashVars' value='playerID=" + playerid + "&amp;autostart=" + autostart + "&amp;soundFile=http://www.ctmusicmanager.com/lib/mp3s/" + urlid + ".mp3'>\
			<param name='quality' value='high'>\
			<param name='menu' value='false'>\
			<param name='wmode' value='transparent'>\
		</object>\
	");
}

/* ************* */
/* MOUSEOVER BOX */
/* ************* */
function gi(i) {
     var itm=null;
     if(document.getElementById) {
         itm=document.getElementById(i);
     } else if(document.all) {
         itm=document.all[i];
     } else if(document.layers) {
         itm=document.layers[i];
     }
     return itm;
}

function addEvent(_o, _e, _f) {
     if(_o.addEventListener) {
         _o.addEventListener(_e, _f, false);
     } else {
         _o.attachEvent('on' + _e, _f);
     }
}

var skn = null;

function loadTheStuff() {
     skn = gi("PopUpBox");
     skn.style.visibility="visible";
     skn.style.display="none";
     addEvent(document, "mousemove", get_mouse);
}

function popup(Date) {
	if (skn) {
		skn.style.display="block";
		skn.style.margin="10px 0 0 -190px";
		skn.innerHTML = "\
			<div class='hoverpopup'>\
			 Last Login Attempt:<br />\
			 <b>" + Date + "</b><br/>\
			 <br /><center><span style='color: #808080;font-size:9px;'>[Click For Full History]</span></center>\
			</div>";
	}
}

function popuptext(txt) {
	if (skn) {
		skn.style.display="block";
		skn.style.margin="10px 0 0 0";
		skn.innerHTML = "\
			<div class='hoverpopup'>\
			" + txt + "\
			</div>";
	}
}

function showSongHistory(SongID) {
	var ajax = new njAJAX();
	ajax.SongID = SongID;
	ajax.getPage("/pagecontent/ajaxpage.php?Action=ShowSongHistory&ItemID=" + ajax.SongID, showSongHistoryCallback);	
}

function showSongHistoryCallback(obj) {
	theRawData = obj.getRawData();
	CTLightbox(theRawData);
}

function get_mouse(e){
	if (skn) {
		if(!e) e=window.event;
		skn.style.left=(e.pageX?e.pageX:e.clientX + (window.pageXOffset!=undefined?window.pageXOffset:(document.documentElement && document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft)))+"px";
		skn.style.top=(e.pageY?e.pageY:e.clientY + (window.pageYOffset!=undefined?window.pageYOffset:(document.documentElement && document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop)))+"px";
	}
}

function kill(){
	if (skn) {
		skn.style.display="none";
	}
}


function thumbpopup(URLID) {
	if (skn) {
		skn.style.display="block";
		skn.style.margin="10px 0 0 0";
		skn.innerHTML = "\
			<div class='hoverpopup' style='width: 100px; padding: 5px;'>\
				<img src='"+TheFileLocation+"/lib/images/thumbs/" + URLID + ".jpg' alt='' border='0' />\
			</div>\
		";
	}
}

function showYouTubeVideo(VidID) {
	if (skn) {
		skn.style.display="block";
		skn.style.margin="10px 0 0 0";
		skn.innerHTML = "\
			<div class='hoverpopup' style='width: 150px; padding: 5px;'>\
				<object width='150' height='121'>\
					<param name='movie' value='http://www.youtube.com/v/" + VidID + "&hl=en&fs=0&autoplay=1&egm=1'></param>\
						<param name='allowFullScreen' value='false'></param>\
						<embed src='http://www.youtube.com/v/" + VidID + "&hl=en&fs=0&autoplay=1&egm=1' type='application/x-shockwave-flash' allowfullscreen='false' width='150' height='121'></embed>\
				</object>\
			</div>\
		";
	}	
}	

/* ******************** */
/* COLLAPSIBLE ELEMENTS */
/* ******************** */
function toggleContent(obj) {
	var hideObj = obj.nextSibling.nextSibling;
	if(hideObj.style.display=="none") {
		hideObj.style.display="block";
		obj.className="ContentItemHeader";
	} else {
		hideObj.style.display="none";
		obj.className="ContentItemHeaderOff";
	}
}


/* ************** */
/* HIDE FUNCTIONS */
/* ************** */
function hide(obj) {
	obj.style.display="none";
}


/* ********* */
/* CHECK ALL */
/* ********* */
function checkBox(obj,isEmail) {
	if(!isEmail) isEmail = 0;
	var Toggleobj = obj.name;
	var n = obj.parentNode;
	while(n.tagName != "FORM") n = n.parentNode;
	var Formname = n.name;
	
	for (i = 0; i < document[Formname][Toggleobj].length; i++) {
		document[Formname][Toggleobj][i].checked = (obj.checked?true:false);
		checkIt(document[Formname][Toggleobj][i],isEmail);
	}
}

function in_array(needle, haystack, strict) {
    var found = false, key, strict = !!strict;

    for (key in haystack) {
        if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
            found = true;
            break;
        }
    }

    return found;
}

function checkCategoryMembers(obj,ids,isEmail) {
	if(!isEmail) isEmail = 0;
	var Toggleobj = obj.name;
	var thememids = ids.split("|");

	n = document.getElementById("MassCheckDiv");
	checkIt(obj);

	while(n.tagName != "FORM") n = n.parentNode;
	var Formname = n.name;

	for (i = 0; i < document[Formname][Toggleobj].length; i++) {
		if (in_array(document[Formname][Toggleobj][i].value,thememids)) {
			document[Formname][Toggleobj][i].checked = (obj.checked?true:false);
			checkIt(document[Formname][Toggleobj][i],isEmail);
		}
	}
}

function checkIt(obj,isEmail) {
		if(!isEmail) isEmail = 0;
		var theLabel = obj;
		while(theLabel.tagName != 'LABEL') theLabel = theLabel.nextSibling;
		theLabel.style.color=(obj.checked?'#808080':'#000000');

		if(isEmail) {
			theSelect = obj.nextSibling; 
			while(theSelect && theSelect.tagName != 'SELECT') theSelect = theSelect.nextSibling;
			if(theSelect)theSelect.style.display=(obj.checked?'inline':'none');
		}
}


/* *********** */
/* LOADING BOX */
/* *********** */
function showLoadingBox(msg) {
	if(!msg) msg = "Loading...";
	document.getElementById("LoaderText").innerHTML = msg;
	document.getElementById("Loader").style.top = getScrollY() + "px";
	document.getElementById("Loader").style.display = "block";
}

function killLoadingBox() {
	document.getElementById("Loader").style.display = "none";
}


/* *********** */
/* FILE UPLOAD */
/* *********** */
function fileUploading(obj) {
	opener("ctoverlayonly");
	document.getElementById("LoaderInside").style.width = "300px";
	showLoadingBox("Uploading File... This may take a few minutes.");
}


/* ********** */
/* AJAX STUFF */
/* ********** */
function njAJAX() { // copyright Paul Taulborg (njaguar) d2jsp.org
	this.callback = 0;
	this.waitingResponse = 0;
	this.url = "";
	this.method = "GET";
	this.params = null;
	this.errorCallback = 0;
	this.xmlObj = 0;

	this.getPage = function(pageURL, pageCallback, donotshowloader) {
		var donotshowit = false;
		if (donotshowloader) var donotshowit = true;
		if(this.waitingResponse) return;
		if(pageURL) this.url = pageURL;
		if(pageCallback) this.callback = pageCallback;

		try {
			this.xmlObj = new XMLHttpRequest();
		} catch (error) {
			try {
				this.xmlObj = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (error) {
			}
		}
		if(!this.xmlObj) return;
		var o = this;
		this.xmlObj.onreadystatechange = function() {
			
			if (!donotshowit) { 
				showLoadingBox(); // SHOW LOADING BOX 
			}
			
			if(o.xmlObj && o.xmlObj.readyState == 4 && o.xmlObj.status == 200) {
				if(!o.xmlObj.responseXML && o.errorCallback) o.errorCallback();
				o.waitingResponse = 0;

				if(o.callback) o.callback(o);
				
				if (!donotshowit) { 
					killLoadingBox(); // KILL LOADING BOX 
				}
				
			}
		}
		this.xmlObj.open(this.method, this.url, true);
		this.xmlObj.send(this.params);
		this.waitingResponse = 1;
	}

	this.getElementNodeValue = function(eName, eIndex) {
		var e = this.xmlObj.responseXML.getElementsByTagName(eName);
		if(!eIndex) eIndex = 0;
		if(e && e[eIndex] && e[eIndex].childNodes && e[eIndex].childNodes[0]) return e[eIndex].childNodes[0].nodeValue;
	}
	
	this.getRawData = function() {
		var e = this.xmlObj.responseText;
		return e;
	}
}


/* ********************************* */
/* MARK RECORD AS ACTIVE OR INACTIVE */
/* ********************************* */
function updateStatus(itemid,linkobj,type,friendlyName) {
	var ajax = new njAJAX();
	ajax.theparenttr = linkobj.parentNode.parentNode;
	ajax.currentimgurl = linkobj.childNodes[0]; // get the child img node
	ajax.type = type;
	ajax.friendlyName = friendlyName;
	ajax.updateimgurl = "http://www.ctmusicmanager.com/images/icon_lightbulb_on.gif";
	ajax.verbage = "Active";
	if (ajax.updateimgurl == ajax.currentimgurl.src) {
		ajax.updateimgurl = "http://www.ctmusicmanager.com/images/icon_lightbulb_off.gif";
		ajax.verbage = "Inactive";
	}
	ajax.getPage("/pagecontent/ajaxpage.php?Type=" + type + "&ItemID=" + itemid + "&Action=updateStatus", updateStatusCallback);
}

function updateStatusCallback(obj) {
	if (obj.getRawData() == "success") {
		obj.currentimgurl.src = obj.updateimgurl;
		if (obj.verbage == "Inactive") { 
			theclass = "BadAlert";
			obj.theparenttr.className = "InactiveRecord";
		} else {
			theclass = "GoodAlert";
			obj.theparenttr.className = "ActiveRecord";	
		}
		var themsg = "The " + (obj.friendlyName?obj.friendlyName:obj.type) + " has been successfully marked as " + obj.verbage + ".";
	} else {
		var theclass = "BadAlert";
		var themsg = "Error updating the database.";
	}
	document.getElementById("AlertBox").className = theclass;
	document.getElementById("AlertBox").innerHTML = themsg;
}


/* ******************** */
/* UPDATE HIDDEN STATUS */
/* ******************** */
function updateHiddenStatus(itemid,linkobj,type) {
	var ajax = new njAJAX();
	ajax.theparenttr = linkobj.parentNode.parentNode;
	ajax.currentimgurl = linkobj.childNodes[0]; // get the child img node
	ajax.type = type;
	ajax.updateimgurl = "http://www.ctmusicmanager.com/images/icon_hidden_off.png";
	ajax.verbage = "Visible";
	if (ajax.updateimgurl == ajax.currentimgurl.src) {
		ajax.updateimgurl = "http://www.ctmusicmanager.com/images/icon_hidden_on.png";
		ajax.verbage = "Hidden";
	}
	ajax.getPage("/pagecontent/ajaxpage.php?Type=" + type + "&ItemID=" + itemid + "&Action=updateHiddenStatus", updateHiddenStatusCallback);
}

function updateHiddenStatusCallback(obj) {
	if (obj.getRawData() == "success") {
		var theclass = "GoodAlert";
		obj.currentimgurl.src = obj.updateimgurl;
		if (obj.verbage == "Hidden") { 
			for(i=0;i<obj.theparenttr.cells.length;i++) {
				if (obj.theparenttr.cells[i].className == "InactiveRecord") {
					obj.theparenttr.cells[i].className = "InactiveRecord";
				} else {
					obj.theparenttr.cells[i].className = "HiddenRecord";
				}
			}
		} else {
			for(i=0;i<obj.theparenttr.cells.length;i++) {
				if (obj.theparenttr.cells[i].className == "InactiveRecord") {
					obj.theparenttr.cells[i].className = "InactiveRecord";
				} else {
					obj.theparenttr.cells[i].className = "ActiveRecord";
				}
			}		
		}
		var themsg = "The " + obj.type + " has been successfully marked as " + obj.verbage + ".";
	} else {
		var theclass = "BadAlert";
		var themsg = "Error updating the database.";
	}
	document.getElementById("AlertBox").className = theclass;
	document.getElementById("AlertBox").innerHTML = themsg;
}


/* **************** */
/* DELETE FUNCTIONS */
/* **************** */
function deleteRecord(Name,ItemID,RecordType,LinkObj,RecordTypeFriendly,Page) {
	if (!RecordTypeFriendly) RecordTypeFriendly = "record";
	if (!Page) Page = RecordType + "s";
	if (confirm('Are you sure you want to delete the ' + RecordTypeFriendly + ' "' + Name + '"?')) {
		var ajax = new njAJAX();
		ajax.Name = Name;
		ajax.RecordType = RecordType;
		ajax.Page = Page;
		ajax.RecordTypeFriendly = RecordTypeFriendly;
		ajax.TRContainer = LinkObj.parentNode.parentNode; // get the parent tr node
		ajax.getPage("/index.php?Page=" + Page + "&" + RecordType + "ID=" + ItemID + "&Action=Delete", deleteRecordCallback);
	}
}

function deleteRecordCallback(obj) {
	if (obj.getRawData() == "success") {
		obj.TRContainer.style.display = "none";
		var themsg = "The " + obj.RecordTypeFriendly + " \"" + obj.Name + "\" has been successfully deleted.";
	} else {
		var themsg = (obj.getRawData() != ""?obj.getRawData():"Error deleting from the database.");
	}
	document.getElementById("AlertBox").className = "BadAlert";
	document.getElementById("AlertBox").innerHTML = themsg;
}

function deleteSticky(Title,ID) {
    if (confirm('Are you sure you want to delete the sticky titled ' + Title + '?')) {
        window.location.href = '/index.php?Page=TheWall&StickyID=' + ID + '&Action=Delete';
    }
}

function deleteStickyReply(Date,Name,ParentID,ID) {
    if (confirm('Are you sure you want to delete the sticky comment posted by ' + Name + ' on ' + Date + '?')) {
        window.location.href = '/index.php?Page=TheWall&StickyID=' + ParentID + '&StickyReplyID=' + ID +'&Action=DeleteStickyReply';
    }
}

function deleteEvent(Title, ID) {
    if (confirm('Are you sure you want to delete the event titled ' + Title + '?')) {
        window.location.href = '/index.php?Page=Calendar&EventID=' + ID + '&Action=Delete';
    }
}

function deleteSetList(Date,SetListID) {
    if (confirm('Are you sure you want to delete the set list from ' + Date + '?')) {
        window.location.href = '/index.php?Page=SetLists&SetListID=' + SetListID +'&Action=Delete';
    }
}

function deleteMember(Name,MemberID) {
    if (confirm('Are you sure you want to delete the account of ' + Name + '?')) {
        window.location.href = '/index.php?Page=Members&MemberID=' + MemberID + '&Action=Delete';
    }
}

function massDelete(obj) {
    if (confirm('Are sure you sure you want to delete the selected records(s)?')) {
        var n = obj.parentNode;
        while(n.tagName != "FORM") n = n.parentNode;
	var Formname = n.name;
	document[Formname].onsubmit();
    } else {
    	return false;
    }
}


/* ************ */
/* QUICK SEARCH */
/* ************ */
var Timeout = false;

function showHint(searchdata) {
	if (searchdata == "") {
		document.getElementById("QuickSearchResults").style.display = "none";
		document.getElementById("QuickSearchResults").innerHTML = "";
	} else {
		var searchdata = searchdata;
		clearTimeout(Timeout);
		Timeout = setTimeout("showHintNext('"+searchdata+"');",500);
	}
}

function showHintNext(searchdata) {
	var ajax = new njAJAX();
	ajax.searchdata = searchdata;
	ajax.getPage("/pagecontent/ajaxpage.php?SearchForSongTitle=" + ajax.searchdata, showHintCallback);	
}

function showHintCallback(obj) {
	theRawData = obj.getRawData();
	document.getElementById("QuickSearchResults").style.display = "block";
	document.getElementById("QuickSearchResults").innerHTML = theRawData;
}

var AudioPlayer=function(){var F=[];var C;var E="";var A={};var D=-1;function B(G){return document.all?window[G]:document[G]}return{setup:function(H,G){E=H;A=G},getPlayer:function(G){return B(G)},embed:function(K,O){var I={};var M;var G;var P;var H;var N={};var J={};var L={};for(M in A){I[M]=A[M]}for(M in O){I[M]=O[M]}if(I.transparentpagebg=="yes"){N.bgcolor="#FFFFFF";N.wmode="transparent"}else{if(I.pagebg){N.bgcolor="#"+I.pagebg}N.wmode="opaque"}N.menu="false";for(M in I){if(M=="pagebg"||M=="width"||M=="transparentpagebg"){continue}J[M]=I[M]}L.name=K;L.style="outline: none";J.playerID=K;audioplayer_swfobject.embedSWF(E,K,I.width.toString(),"24","9",false,J,N,L);F.push(K)},syncVolumes:function(G,I){D=I;for(var H=0;H<F.length;H++){if(F[H]!=G){B(F[H]).setVolume(D)}}},activate:function(G){if(C&&C!=G){B(C).close()}C=G},load:function(I,G,J,H){B(I).load(G,J,H)},close:function(G){B(G).close();if(G==C){C=null}},open:function(G){B(G).open()},getVolume:function(G){return D}}}()/* SWFObject v2.1 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var audioplayer_swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in audioplayer_swfobject){audioplayer_swfobject[q]=null}audioplayer_swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();


/* ************** */
/* LIGHTBOX STUFF */
/* ************** */
var opacity = null;
var speed = 8; // how fast the fade in and fade out will be
var ci = false;

function closeit() {
	if (ci!=true) {
		closer();
	} else {
		ci=false;
	}
}

function opener(command) {
	opacity = 0;
	if (command == "ctoverlayonly") {
		document.getElementById('ctoverlay').getAttributeNode('onClick').value=false;
	} else {
		document.getElementById("ctpopup").style.top = (getScrollY() + 75) + "px";
		document.getElementById('ctpopup').style.display='block';
	}
	var pageHeight = getPageHeight() + "px";
	document.getElementById('ctoverlay').style.height = pageHeight;
	document.getElementById('ctoverlay').style.display='block';
	fadein();
}

function closer() {
	opacity = 80;
	document.getElementById('ctpopup').style.display='none';
	fadeout();
}

function fadein() {
	opacity = opacity + speed;
	document.getElementById('ctoverlay').style.opacity=((opacity)/100);
	document.getElementById('ctoverlay').style.filter='alpha(opacity=' + (opacity) + ')'
	if (opacity<80) setTimeout("fadein()", 10);

}

function fadeout() {
	opacity = opacity - speed;
	document.getElementById('ctoverlay').style.opacity=((opacity)/100);
	document.getElementById('ctoverlay').style.filter='alpha(opacity=' + (opacity) + ')'
	if (opacity>0) {
		setTimeout("fadeout()", 10);
	} else {
		document.getElementById('ctoverlay').style.display='none';
	}
}

function getPageHeight() {
	var yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		yScroll = document.body.offsetHeight;
	}
	
	var windowHeight;

	if (self.innerHeight) {	// all except Explorer
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	return pageHeight;
}

function getScrollY() {
	var scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
	}
	return scrOfY;
}

/* ************* */
/* CALENDAR PAGE */
/* ************* */
function grabCalendarContent(itemid) {
	var ajax = new njAJAX();
	ajax.getPage("/pagecontent/ajaxpage.php?ItemID=" + itemid + "&Action=GetCalendarContent", grabCalendarContentCallback);
}

function grabCalendarContentCallback(obj) {
	document.getElementById("ctjscontent").innerHTML = obj.getRawData();
	opener();
}


/* IMG GRAB */
function grabImage(url,desc) {
	if (!desc) desc = "";
	document.getElementById("ctjscontent").innerHTML = "\
		<img src='" + url + "' alt='' border='0' width='410' />\
		<div style='margin-top: 15px; padding-top: 10px; border-top: 1px solid #cccccc; background: url(/images/light_shadow.gif) 0 -10px repeat-x;'>\
			" + desc + "\
			<div style='text-align: right;'>\
				<a href='#' onclick='closer(); return false;' title='Close Window'><img src='/images/icon_close.gif' border='0' alt='Close' /></a>\
			</div>\
		</div>\
	";
	opener();
}

function CTLightbox(text,width) {
	if(width) document.getElementById("ctinsidecontainer").style.width = width;
	document.getElementById("ctjscontent").innerHTML = "\
		" + text + "\
		<div style='margin-top: 15px; height: 15px; border-top: 1px solid #cccccc; background: url(/images/light_shadow.gif) 0 -10px repeat-x;'></div>\
		<div style='text-align: right;'>\
			<a href='#' onclick='closer();return false;' title='Close Window'><img src='/images/icon_close.gif' border='0' alt='Close' /></a>\
		</div>\
	";
	opener();
}
	

/* ******************** */
/* MASS EMAILER PREVIEW */
/* ******************** */
function showEmailPreview() {
	var ajax = new njAJAX();
	ajax.getPage("/functions/function_MassEmailer.php?", grabCalendarContentCallback);
}

function showEmailPreviewCallback(obj) {
	document.getElementById("ctjscontent").innerHTML = obj.getRawData();
	opener();
}

function showEmailPreview() {
	opener();
	var theSubject = document.MyForm.form_Subject.value;
	var theMessage = document.MyForm.form_Message.value;
	document.getElementById("ctjscontent").innerHTML = "\
		<h1>Preview</h1>\
		<div style='margin-bottom: 20px; padding: 10px; border: 1px solid #cfcfcf;'>\
			<table style='color: black; font: 12px Tahoma; width: 100%;' cellpadding='2' cellspacing='2'>\
				<tr>\
					<td style='border: 0;'><img src='http://www.ctmusicmanager.com/images/email_logo.gif' alt='' border='0' /></td>\
				</tr>\
				<tr>\
					<td style='border: 0;'><div style='border: 1px solid #cfcfcf; font-size: 1px; height: 4px;'>&nbsp;</div></td>\
				</tr>\
				<tr style='border: 0;'>\
					<td style='border: 0; padding: 10px; font-size: 18px; color: black;'>\
						" + theSubject + "<br />\
						<span style='font-size: 12px; color: #808080;'>From: </span>\
					</td>\
				</tr>\
				<tr>\
					<td style='border: 0; padding: 0 10px 10px 10px; color: black;'>" + theMessage + "</td>\
				</tr>\
				<tr>\
					<td style='border: 0;'><div style='border: 1px solid #cfcfcf; font-size: 1px; height: 4px;'>&nbsp;</div></td>\
				</tr>\
				<tr>\
					<td align='center' style='border: 0;'><a style='color: #cfcfcf;' href='http://www.ctmusicmanager.com/'>CTMusicManager.com &copy; 2008</td>\
				</tr>\
			</table>\
		</div>\
	";
}

/**
 * FlashObject v1.2.3: Flash detection and embed - http://blog.deconcept.com/flashobject/
 *
 * FlashObject is (c) 2005 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof com == "undefined") var com = new Object();
if(typeof com.deconcept == "undefined") com.deconcept = new Object();
if(typeof com.deconcept.util == "undefined") com.deconcept.util = new Object();
if(typeof com.deconcept.FlashObjectUtil == "undefined") com.deconcept.FlashObjectUtil = new Object();
com.deconcept.FlashObject = function(swf, id, w, h, ver, c, useExpressInstall, quality, redirectUrl, detectKey){
   this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
   this.skipDetect = com.deconcept.util.getRequestParameter(this.DETECT_KEY);
   this.params = new Object();
   this.variables = new Object();
   this.attributes = new Array();

   if(swf) this.setAttribute('swf', swf);
   if(id) this.setAttribute('id', id);
   if(w) this.setAttribute('width', w);
   if(h) this.setAttribute('height', h);
   if(ver) this.setAttribute('version', new com.deconcept.PlayerVersion(ver.toString().split(".")));
   if(c) this.addParam('bgcolor', c);
   var q = quality ? quality : 'high';
   this.addParam('quality', q);
   this.setAttribute('redirectUrl', '');
   if(redirectUrl) this.setAttribute('redirectUrl', redirectUrl);
   if(useExpressInstall) {
   // check to see if we need to do an express install
   var expressInstallReqVer = new com.deconcept.PlayerVersion([6,0,65]);
   var installedVer = com.deconcept.FlashObjectUtil.getPlayerVersion();
      if (installedVer.versionIsValid(expressInstallReqVer) && !installedVer.versionIsValid(this.getAttribute('version'))) {
         this.setAttribute('doExpressInstall', true);
      }
   } else {
      this.setAttribute('doExpressInstall', false);
   }
}
com.deconcept.FlashObject.prototype.setAttribute = function(name, value){
	this.attributes[name] = value;
}
com.deconcept.FlashObject.prototype.getAttribute = function(name){
	return this.attributes[name];
}
com.deconcept.FlashObject.prototype.getAttributes = function(){
	return this.attributes;
}
com.deconcept.FlashObject.prototype.addParam = function(name, value){
	this.params[name] = value;
}
com.deconcept.FlashObject.prototype.getParams = function(){
	return this.params;
}
com.deconcept.FlashObject.prototype.getParam = function(name){
	return this.params[name];
}
com.deconcept.FlashObject.prototype.addVariable = function(name, value){
	this.variables[name] = value;
}
com.deconcept.FlashObject.prototype.getVariable = function(name){
	return this.variables[name];
}
com.deconcept.FlashObject.prototype.getVariables = function(){
	return this.variables;
}
com.deconcept.FlashObject.prototype.getParamTags = function(){
   var paramTags = ""; var key; var params = this.getParams();
   for(key in params) {
        paramTags += '<param name="' + key + '" value="' + params[key] + '" />';
    }
   return paramTags;
}
com.deconcept.FlashObject.prototype.getVariablePairs = function(){
	var variablePairs = new Array();
	var key;
	var variables = this.getVariables();
	for(key in variables){
		variablePairs.push(key +"="+ variables[key]);
	}
	return variablePairs;
}
com.deconcept.FlashObject.prototype.getHTML = function() {
    var flashHTML = "";
    if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
        if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "PlugIn"); }
        flashHTML += '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" id="'+ this.getAttribute('id') + '" name="'+ this.getAttribute('id') +'"';
		var params = this.getParams();
        for(var key in params){ flashHTML += ' '+ key +'="'+ params[key] +'"'; }
		pairs = this.getVariablePairs().join("&");
        if (pairs.length > 0){ flashHTML += ' flashvars="'+ pairs +'"'; }
        flashHTML += '></embed>';
    } else { // PC IE
        if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "ActiveX"); }
        flashHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" id="'+ this.getAttribute('id') +'">';
        flashHTML += '<param name="movie" value="' + this.getAttribute('swf') + '" />';
		var tags = this.getParamTags();
        if(tags.length > 0){ flashHTML += tags; }
		var pairs = this.getVariablePairs().join("&");
        if(pairs.length > 0){ flashHTML += '<param name="flashvars" value="'+ pairs +'" />'; }
        flashHTML += '</object>';
    }
    return flashHTML;
}
com.deconcept.FlashObject.prototype.write = function(elementId){
	if(this.skipDetect || this.getAttribute('doExpressInstall') || com.deconcept.FlashObjectUtil.getPlayerVersion().versionIsValid(this.getAttribute('version'))){
		if(document.getElementById){
		   if (this.getAttribute('doExpressInstall')) {
		      this.addVariable("MMredirectURL", escape(window.location));
		      document.title = document.title.slice(0, 47) + " - Flash Player Installation";
		      this.addVariable("MMdoctitle", document.title);
		   }
			document.getElementById(elementId).innerHTML = this.getHTML();
		}
	}else{
		if(this.getAttribute('redirectUrl') != "") {
			document.location.replace(this.getAttribute('redirectUrl'));
		}
	}
}
/* ---- detection functions ---- */
com.deconcept.FlashObjectUtil.getPlayerVersion = function(){
   var PlayerVersion = new com.deconcept.PlayerVersion(0,0,0);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = new com.deconcept.PlayerVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
		}
	}else if (window.ActiveXObject){
	   try {
   	   var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
   		PlayerVersion = new com.deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
	   } catch (e) {}
	}
	return PlayerVersion;
}
com.deconcept.PlayerVersion = function(arrVersion){
	this.major = parseInt(arrVersion[0]) || 0;
	this.minor = parseInt(arrVersion[1]) || 0;
	this.rev = parseInt(arrVersion[2]) || 0;
}
com.deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
	if(this.major < fv.major) return false;
	if(this.major > fv.major) return true;
	if(this.minor < fv.minor) return false;
	if(this.minor > fv.minor) return true;
	if(this.rev < fv.rev) return false;
	return true;
}
/* ---- get value of query string param ---- */
com.deconcept.util.getRequestParameter = function(param){
	var q = document.location.search || document.location.href.hash;
	if(q){
		var startIndex = q.indexOf(param +"=");
		var endIndex = (q.indexOf("&", startIndex) > -1) ? q.indexOf("&", startIndex) : q.length;
		if (q.length > 1 && startIndex > -1) {
			return q.substring(q.indexOf("=", startIndex)+1, endIndex);
		}
	}
	return "";
}

/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}

/* add some aliases for ease of use / backwards compatibility */
var getQueryParamValue = com.deconcept.util.getRequestParameter;
var FlashObject = com.deconcept.FlashObject;
