jQuery.noConflict();

function addShowHideSection() {
	aAr = document.getElementsByTagName("span");

	for(j=0; aAr[j]; j++) {
		if((aAr[j].getAttribute("class") && aAr[j].getAttribute("class") == "clicker") || aAr[j].className == "clicker") {
			jQuery(aAr[j]).click(doShowSection);
		}
	}

	aAr = document.getElementsByTagName("a");

	for(j=0; aAr[j]; j++) {
		if((aAr[j].getAttribute("class") && aAr[j].getAttribute("class") == "readMore") || aAr[j].className == "readMore") {
			jQuery(aAr[j]).click(stopP);
		}
	}

	hash = String(window.location.hash).replace("#", "");
	if (hash) {
		if(first = document.getElementById(hash)) {
			jQuery(first.parentNode.getElementsByTagName("table")[0]).css({visibility: "visible",display: "none", width: "100%", opacity: 1}).animate({
				"height": "toggle", "opacity": "toggle"
			}, "slow");
			first.setAttribute("shown", "1");
		}
	}
}

var target;

function doShowSection(event) {
	target = this;
	
	if(target.getAttribute("class") != "readMore") {

		if(target.getAttribute("shown") == "1") {
			jQuery(this.parentNode.getElementsByTagName("table")[0]).css({visibility: "visible",display: ""}).slideUp(300);
			target.setAttribute("shown", "0");
		} else {
			jQuery(this.parentNode.getElementsByTagName("table")[0]).css({visibility: "visible",display: "none", width: "100%", opacity: 1}).animate({
			"height": "toggle", "opacity": "toggle"
			}, "slow");
			target.setAttribute("shown", "1");
		}
	}
}

function stopP(event) {
	//event.preventDefault();
	event.stopPropagation();
}
var div;
function replaceMovie() { 
	var oAr = document.getElementsByTagName("object");
	var lAr = document.getElementsByTagName("a");
	var aAr = new Array();

	for(i=0; lAr[i]; i++) {
		if(lAr[i].getAttribute("class") == "video") {
			aAr.push(lAr[i]);
		}
	}

	
	for(i=0; oAr[i]; i++) {
		aAr.push(oAr[i]);
	}

	var src="";
	for(i=0; aAr[i]; i++) {
		/*if(aAr[i].getAttribute("class") == "vidbox")*/ {
			if(aAr[i].getAttribute("data") && aAr[i].getAttribute("data").match("youtube")) {
				a = document.createElement("a");
				a.setAttribute("src", aAr[i].getAttribute("data")+"&amp;autoplay=1");
				a.setAttribute("style", aAr[i].getAttribute("style"));
				
				div = document.createElement("div");
				div.setAttribute("class", "playBtn");
				if(!document.addEventListener) { div.className = "playBtn"; }
				
				img = document.createElement("img");
				imgSrc = aAr[i].getAttribute("data").replace("http://www.youtube.com/v/", "http://img.youtube.com/vi/");
				imgSrc = imgSrc.split("&")[0]+"/0.jpg";
				img.setAttribute("src", imgSrc);
				div.style.height = img.style.height = aAr[i].style.height;
				div.style.width  = img.style.width  = aAr[i].style.width;

				div.style.marginTop = "-"+aAr[i].style.height;

				div.style.background = "url(/vid/play.png) center center no-repeat";
				div.style.cursor = "pointer";
				
				a.appendChild(img);
				a.appendChild(div);
				
				div.onclick = function() { Videobox.open(this.parentNode.getAttribute("src"), " ","vidbox 800 600"); }
					
				aAr[i].parentNode.replaceChild(a, aAr[i]);
			} else if(aAr[i].getAttribute("class") && aAr[i].getAttribute("class") == "video" && (aAr[i].getAttribute("href").match("flv") || aAr[i].getAttribute("href").match("f4v"))) {
				iAr = aAr[i].getElementsByTagName("img");

				if(iAr[0]) {
					div = document.createElement("div");
					div.setAttribute("class", "playBtn");
					div.style.height = iAr[0].scrollHeight+"px";
					div.style.width  = iAr[0].scrollWidth+"px";
					div.style.marginTop = "-"+iAr[0].scrollHeight+"px";
					div.style.background = "url(/vid/play.png) center center no-repeat";
					
					aAr[i].appendChild(div);
				}
				
				aAr[i].onclick = function() { Videobox.open(this.getAttribute("href"), " ","vidbox 800 600"); return false; }
				
				

			}
			
			
		}
	}
}

function fixHomePageLink() {
	aAr = document.getElementsByTagName("a");

	for(i=0; aAr[i]; i++) {
		if(aAr[i].getAttribute("class") && aAr[i].getAttribute("class") == "contentpagetitle") {
			aAr[i].style.cursor = "default";
			aAr[i].onclick = function() {
				return false;
			}
		}
	}
}

function fixMenuBleu() {
	liAr  = document.getElementById("menu_bleu_container").getElementsByTagName("li");
	liAr2 = new Array();
	for(i=0; liAr[i]; i++) {
		if(liAr[i].getAttribute("class").match("ux-menu-item-main")){
			liAr2.push(liAr[i]);
		}	
	}
	if(liAr2.length >= 10) {
		for(i=0; liAr2[i]; i++) {
			liAr2[i].getElementsByTagName("a")[0].className = "menu7px "+liAr2[i].getElementsByTagName("a")[0].className;
		}
	} else if (liAr2.length >= 8) {
		for(i=0; liAr2[i]; i++) {
			liAr2[i].getElementsByTagName("a")[0].className = "menu8px "+liAr2[i].getElementsByTagName("a")[0].className;
		}
	}

}


