/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

function PopUp(url, width, height) {
        desktopURL = url;
        var desktop = window.open( desktopURL, "_blank", "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width="+width+",height="+height+"" );
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/


function init () {
	setDivHeight ();
	fixColOffset ();
	alignEncart ();
}
window.onload = init;

function setDivHeight () {
	if (document.getElementById) {
		var ref_e = document.getElementById ("innerLeft");
		if (ref_e) {
			var e = document.getElementById ("innerLeft_content");
			e.style.height = ref_e.offsetHeight + "px";
		}
	}
}

function ieHoverFix (holder) {
	if (document.all && document.getElementById) {
		var e_holder = document.getElementById (holder);
		if (e_holder) {			
			for (var i = 0; i < e_holder.childNodes.length; i++) {
				var e = e_holder.childNodes[i];				
				if (e.nodeName == "DIV") {
					e.onmouseover = function () {
						this.className += " over";				
					}
					e.onmouseout = function () {
						this.className = this.className.replace (" over", "");
					}
				}
			}
		} else {
			return;
		}
	}
}

function fixColOffset () {
	var ldHeight, rdHeight;
	var ld = document.getElementById ("leftCol");
	var rd = document.getElementById ("rightCol");
	var rd_inner = document.getElementById ("rightColInner");
	var logo = document.getElementById ("logoMediametrie");
	
	if (ld) {
		ldHeight = ld.offsetHeight;
	}
	if (rd) {
		rdHeight = rd.offsetHeight;
	}
	if (ld && rd && logo) {
		if (ldHeight > rdHeight) {
			var offset = rdHeight;
			rd.style.height = ldHeight + "px";
			logo.style.marginTop = (ldHeight - offset) + "px";
		} else if (ldHeight < rdHeight) {			
			ld.style.height = rdHeight + "px";
		}
	}	
}

function alignEncart () {
	if (document.getElementById) {
		var container = document.getElementById ("mainArticleCol");		
		if (container) {
			var encart_list = container.getElementsByTagName ("DIV");
			for (var i = 0; i < encart_list.length; i++) {
				if (encart_list[i].id == "innerLeft") {
					var e = encart_list[i];
					if (e) {
						var xPos = e.offsetLeft;
						if (xPos > 100) {
							e.className = "deleteRightMargin";
						}
					}
				} else if (encart_list[i].id.indexOf ("flash") != -1 || encart_list[i].className == "imgMedia") {
					var f = encart_list[i];
					if (f) {
						var xPos = f.offsetLeft;
						if (xPos > 100) {
							f.className += " deleteRightMargin";
						}
					} 
				}
			}
		} 
	}
}
