(function(){

//BYTE Mechanic - NameSpace
window['BYTE'] = {};

function isCompatible(other) {
// Use Detection to see if it can handle BYTE code
	if(other === false
		|| !Array.prototype.push
		|| !Object.hasOwnProperty
		|| !document.createElement
		|| !document.getElementsByTagName
		) {
		return false;
	}
	return true;
};
 
window['BYTE']['isCompatible'] = isCompatible;

function $() {
	var elements = new Array();
	//Find all Elements in DOM
	for(var i=0;i<arguments.length;i++){
	var element = arguments[i];
	
		//If it is a string then it's and ID
		if(typeof element == 'string'){
			element = document.getElementById(element);
			}
			
		//Return if I am the only Element
		if(arguments.length==1){
		return element;
		}
		//If more Elements then add to array	
		elements.push(element);
		}
		//Return array of Elements
		return elements;
};

window['BYTE']['$'] = $;

function addEvent(node,type,listener) {
	//Compatibility Check
	if(!isCompatible()) { return false }
	if(!(node=$(node))) { return false }

	if(node.addEventListener){
		//W3C Method
		node.addEventListener(type,listener,false);
		return true;
		}else if(node.attachEvent){
		//MSIE Method
		node['e'+type+listener] = listener;
		node[type+listener] = function(){
		node['e'+type+listener](window.event);
	}
	
	node.attachEvent('on'+type,node[type+listener]);
	return true;
	}
	//Catch if fails on both types
	return false;

 };
 
window['BYTE']['addEvent'] = addEvent;

function removeEvent(node,type,listener) { 
	if(!(node=$(node))) { return false }

	if(node.removeEventListener){
		//W3C Method
		node.removeEventListener(type,listener,false);
		return true;
	    } else if (node.detachEvent) {
	    // MSIE method
	    node.detachEvent( 'on'+type, node[type+listener] );
	    node[type+listener] = null;
	    return true;
    }
    
    //Catch if fails on both types
    return false;
};

window['BYTE']['removeEvent'] = removeEvent;

function getElementsByClassName(className,tag,parent) { 
	parent = parent || document;
	if(!(paent = $(parent))) { return false }
	
	//Locate all matching tags
	var allTags = (tag=="*"&& parent.all) ? parent.all : parent.getElementsByTagName(tag);
	var matchingElements =  new Array();
	
	//Create expression to determine if className is correct
    className = className.replace(/\-/g, "\\-");
    var regex = new RegExp("(^|\\s)" + className + "(\\s|$)");
    
    var element;
    //Check each Element
    for(var i=0; i<allTags.length; i++){
        element = allTags[i];
        if(regex.test(element.className)){
        matchingElements.push(element);
        }
    }
    //Return matching Elements
    return matchingElements;
};

window['BYTE']['getElementsByClassName'] = getElementsByClassName;

function toggleDisplay(node,value) { 
    if(!(node = $(node))) return false;
    if ( node.style.display != 'none' ) {
        node.style.display = 'none';
    } else {
        node.style.display = value || '';
    }
    return true;
};

window['BYTE']['toggleDisplay'] = toggleDisplay;

function insertAfter(node,referenceNode) {
    if(!(node = $(node))) return false;
    if(!(referenceNode = $(referenceNode))) return false;
    
    return referenceNode.parentNode.insertBefore(node, referenceNode.nextSibling);
};

window['BYTE']['insertAfter'] = insertAfter;

function removeChildren(parent) {
    if(!(parent = $(parent))) return false;
    
    //While child, then remove it
    while (parent.firstChild) {
         parent.firstChild.parentNode.removeChild(parent.firstChild);
    }
    //Return the parent so you can stack methods
    return parent;
};

window['BYTE']['removeChildren'] = removeChildren;

function prependChild(parent,newChild) {
    if(!(parent = $(parent))) return false;
    if(!(newChild = $(newChild))) return false;
    if(parent.firstChild) {
        //Already a child, insert before the first one
        parent.insertBefore(newChild,parent.firstChild);    
    } else {
        //No children, just append
        parent.appendChild(newChild);
    }
    //Return the parent so you can stack methods
    return parent;
};

window['BYTE']['prependChild'] = prependChild;

function bindFunction(obj, func){
	return function(){
	func.apply(obj,arguments);
	};
	};
window['BYTE']['bindFunction'] = bindFunction;

})();

var TrackTag = "http://fls.doubleclick.net/activityi;";

function GetTrackingTag(URL){
	var axel = Math.random()+"";
	var a = axel * 10000000000000;
	src = TrackTag + URL + 'ord=1;num='+ a + '?';
	
	if(GetTrackingTag){
		document.getElementById("tracking_tag").src = src;
		// alert(src);
	}
}
//Paul J Karlik 2007-2008 AVE A | RAZORFISH