// onload manager
onloadFunctions = new Array();
onload = function() {
	for(i=0; i < onloadFunctions.length; i++) {
		onloadFunctions[i]();
	}
}

function onloadAdd(func) {
	onloadFunctions[(onloadFunctions.length++)] = func;
}

// input placeholders:
onloadAdd(function() {
	inputList = document.getElementsByTagName("INPUT");
	for(m=0; m < inputList.length; m++) {
		input = inputList[m];
		if(input.type == "text" && input.title) {
			input.classBackup = input.className;
			if(input.value == input.title) {
				input.className = input.classBackup+" blurred";
			}
			input.onfocus = function() {
				if(this.value == this.title) {
					this.value = "";
					this.className = this.classBackup
				}
			}
			input.onblur = function() {
				if(this.value == "") {
					this.value = this.title;
					this.className = this.classBackup+" blurred";
				}
			}
			input.onblur()
		}
	}
});

function toggle(object,display) {
	if(typeof(object) == "string") {
		object = document.getElementById(object);
	}
	if(object) {
		if(object.style.display != display) {
			object.style.display = display;
		} else {
			object.style.display = "none";
		}
	} else { return false; }
}

function goBar(barID, dir) {
	bar = document.getElementById("bar"+barID)
	if(dir == "up" ) {
		start = bar.pos - 1;
	} else {
		start = bar.pos + 1;
	}
	applyBar(barID, start);
	document.getElementById("face").innerHTML = "adf"+start;
	return false;
}

function applyBar(barID, start) {
	if(document.getElementById("scrollbar"+barID) == null) { return false }
	document.getElementById("scrollbar"+barID).className = "scroll";
	bar = document.getElementById("bar"+barID);
	scroller = document.getElementById("scroller"+barID);
	
	document.getElementById("top"+barID).barID = barID
	document.getElementById("top"+barID).onclick = function(){ goBar(this.barID,"up") }
	document.getElementById("bottom"+barID).barID = barID
	document.getElementById("bottom"+barID).onclick = function(){ goBar(this.barID,"down") }
	if((32*start+12) > 108) {
		startPoint = 108;
	} else if(start < 1) {
		startPoint = 12;
		if(start >= 0) {
			bar.pos = start;
		}
	} else {
		startPoint = 32*start+12;
		bar.pos = start
	}
	
	Drag.init(bar, null, 0, 0, 12, 108, scroller, startPoint);
}
function initSubscribe() {
	document.getElementById("subscribe").childNodes[0].style.display = "none";
	document.getElementById("subscribe").onmouseup = function() {
		document.getElementById("subscribePanel").style.display = "block";
		this.className = "down";
		setTimeout(function() { document.body.onclick = function() {
			setTimeout(function() {
				document.getElementById("subscribe").className = "";
				document.body.onclick = null;
				document.getElementById("subscribePanel").style.display = "none";
			}, 200);
		}},50);
	}
}
// on air scrollbar
onloadAdd(function() { applyBar("2",0); });
/**************************************************
 * dom-drag.js
 * 09.25.2001
 * www.youngpup.net
 **************************************************
 * 10.28.2001 - fixed minor bug where events
 * sometimes fired off the handle, not the root.
 **************************************************/

var Drag = {

	obj : null,

	init : function(o, oRoot, minX, maxX, minY, maxY, scrollBox, start, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)
	{
		o.onmousedown  = Drag.start;

		o.hmode      = bSwapHorzRef ? false : true ;
		o.vmode      = bSwapVertRef ? false : true ;
			
		o.root = oRoot && oRoot != null ? oRoot : o ;
		
		o.box = scrollBox;

		if (o.hmode  && isNaN(parseInt(o.root.style.left  ))) o.root.style.marginLeft   = "0px";
		if (o.vmode  && isNaN(parseInt(o.root.style.marginTop   ))) o.root.style.marginTop    = "0px";
		if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right  = "0px";
		if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";

		o.minX  = typeof minX != 'undefined' ? minX : null;
		o.minY  = typeof minY != 'undefined' ? minY : null;
		o.maxX  = typeof maxX != 'undefined' ? maxX : null;
		o.maxY  = typeof maxY != 'undefined' ? maxY : null;

		o.xMapper = fXMapper ? fXMapper : null;
		o.yMapper = fYMapper ? fYMapper : null;

		o.root.onDragStart  = new Function();
		o.root.onDragEnd  = new Function();
		o.root.onDrag		= new Function();
		o.root.style.marginTop = start+"px";
		o.box.style.marginTop = -Math.round((o.box.scrollHeight-200)*((start-12)/96))+"px"
  },

  start : function(e)
  {
		var o = Drag.obj = this;
		e = Drag.fixE(e);
		var y = parseInt(o.vmode ? o.root.style.marginTop  : o.root.style.bottom);
		var x = parseInt(o.hmode ? o.root.style.marginLeft : o.root.style.right );
		o.root.onDragStart(x, y);

		o.lastMouseX  = e.clientX;
		o.lastMouseY  = e.clientY;

		if (o.hmode) {
			if (o.minX != null)  o.minMouseX  = e.clientX - x + o.minX;
			if (o.maxX != null)  o.maxMouseX  = o.minMouseX + o.maxX - o.minX;
		} else {
			if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
			if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;
		}

		if (o.vmode) {
			if (o.minY != null)  o.minMouseY  = e.clientY - y + o.minY;
			if (o.maxY != null)  o.maxMouseY  = o.minMouseY + o.maxY - o.minY;
		} else {
			if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;
		  if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;
		}

		document.onmousemove  = Drag.drag;
		document.onmouseup		= Drag.end;

		return false;
  },

  drag : function(e)
  {
		e = Drag.fixE(e);
		var o = Drag.obj;

		scroller = o.box;

		var ey  = e.clientY;
		var ex  = e.clientX;
		var y = parseInt(o.vmode ? o.root.style.marginTop  : o.root.style.bottom);
		var x = parseInt(o.hmode ? o.root.style.marginLeft : o.root.style.right );
		var nx, ny;

		if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
		if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
		if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
		if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);

		nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
		ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));

		if (o.xMapper)		 nx = o.xMapper(y)
		else if (o.yMapper)  ny = o.yMapper(x)

		Drag.obj.root.style[o.hmode ? "marginLeft" : "right"] = nx + "px";
		Drag.obj.root.style[o.vmode ? "marginTop" : "bottom"] = ny + "px";
		Drag.obj.lastMouseX  = ex;
		Drag.obj.lastMouseY  = ey;
		
		Drag.obj.root.onDrag(nx, ny);
		o.box.style.marginTop = -Math.round((o.box.scrollHeight-200)*((ny-12)/96))+"px"; 
		o.root.pos = Math.round(ny/108)
		
		return false;
  },

  end : function()
  {
		document.onmousemove = null;
		document.onmouseup   = null;
		Drag.obj.root.onDragEnd(  parseInt(Drag.obj.root.style[Drag.obj.hmode ? "marginLeft" : "right"]), 
								  parseInt(Drag.obj.root.style[Drag.obj.vmode ? "marginTop" : "bottom"]));
		Drag.obj = null;
  },

  fixE : function(e)
  {
		if (typeof e == 'undefined') e = window.event;
		if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
		if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
		return e;
  }
};
function launchMo() {
	window.open("http://www.movideo.com/syndicated?clientid=25","movid",'width=832,height=670,resizable=1,scrollbars=0,status=1',true);
}
function iframe(doc,div,filterType){
	// DOM (used to set height of iFrame on this page)
	var oDOMiFrame = document.getElementById('framey');
	var oDOMiFrameDocument = doc;
	if((oDIVwholePage = doc.getElementById(div)) == null) {
		oDIVwholePage = doc.getElementsByName(div)[0];
	}
	if(filterType == "x-rater") {
		oDOMiFrame.height = oDIVwholePage.offsetHeight+30;
	} else {
		oDOMiFrame.height = oDIVwholePage.offsetHeight+20; 
	}
}
function viewTweets() {
	window.open("http://twitter.com/scottyandnige","twitter");
}