var ie	= document.all
var ns6	= document.getElementById && !document.all

function clientCoords()
{
    var offsetInfo = ""
    clientInfo = "The x coordinate is: " + window.event.clientX + "\r"
    clientInfo += "The y coordinate is: " + window.event.clientY + "\r"
    alert(clientInfo);
}


function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function show_shopimg(divclass, url, width, height) {

	document.onmousemove=get_mousepos;

	show_img_2009(divclass, url, width, height);
}

function show_destimg(divclass, url, width, height) {

	document.onmousemove=get_destmousepos;

	show_img_2009(divclass, url, width, height);
}

function show_img_2009(divclass, url, width, height) {

	var content ='<div class="'+divclass+'" style="background-image: url(/gfx/billede_bg.gif); background-repeat: repeat;"><img src="'+url+'" width="'+width+'" height="'+height+'" style="border: none;" alt="" /></div>';

	domok = document.getElementById;

	if (domok) {

		document.getElementById("topdecklink").innerHTML = content;

		skn = document.getElementById("topdecklink").style;
		skn.display = "block";

	}

}

function get_mousepos(e) {

	domok = document.getElementById;

	if (domok) {


		var curX = (ns6) ? e.pageX : event.clientX+ietruebody().scrollLeft;
		var curY = (ns6) ? e.pageY : event.clientY+ietruebody().scrollTop;

		//Find out how close the mouse is to the corner of the window
		var winwidth	= ie && !window.opera ? ietruebody().clientWidth : window.innerWidth-20;
		var winheight	= ie && !window.opera ? ietruebody().clientHeight : window.innerHeight-20;

		var rightedge	= ie && !window.opera ? winwidth-event.clientX : winwidth-e.clientX;
		var bottomedge	= ie && !window.opera ? winheight-event.clientY : winheight-e.clientY;

		var leftedge	= -1000;

		skn = document.getElementById("topdecklink");

		if (rightedge < skn.offsetWidth) {
			skn.style.left	= curX - skn.offsetWidth + "px";
		} else if (curX < leftedge) {
			skn.style.left = curX + 20 + "px";
		} else {
			skn.style.left	= curX + 20 + "px";
		}

		if (bottomedge < skn.offsetHeight) {
			skn.style.top	= curY - skn.offsetHeight - 10 +"px";
		} else {
			skn.style.top	= curY + 10 +"px"
		}
	}
}

function get_destmousepos(e) {

	domok = document.getElementById;

	if (domok) {


		var curX = (ns6) ? e.pageX : event.clientX+ietruebody().scrollLeft;
		var curY = (ns6) ? e.pageY : event.clientY+ietruebody().scrollTop;

		//Find out how close the mouse is to the corner of the window
		var winwidth	= ie && !window.opera ? ietruebody().clientWidth : window.innerWidth-20;
		var winheight	= ie && !window.opera ? ietruebody().clientHeight : window.innerHeight-20;

		var rightedge	= ie && !window.opera ? winwidth-event.clientX : winwidth-e.clientX;
		var bottomedge	= ie && !window.opera ? winheight-event.clientY : winheight-e.clientY;

		var leftedge	= -1000;

		skn = document.getElementById("topdecklink");

		if (rightedge < skn.offsetWidth) {
			skn.style.left	= curX - skn.offsetWidth + "px";
		} else if (curX < leftedge) {
			skn.style.left = curX + 20 + "px";
		} else {
			skn.style.left	= curX + 20 + "px";
		}

		if (bottomedge < skn.offsetHeight) {
			skn.style.top	= curY - skn.offsetHeight - 10 +"px";
		} else {
			skn.style.top	= curY + 10 +"px"
		}
	}

}

function hide_shopimg() {
	if (domok) {
		skn = document.getElementById("topdecklink").style;
		skn.display = "none";
	}
}


// find all elements a
function getElementsByClassName(str)
{
	arr = new Array();
	ele = document.getElementsByTagName('a');

	for (i = 0; i < ele.length; i++) {

		if (ele[i].className == str) {

			arr[arr.length] = ele[i];

		}
	}

	return arr;
}

// find all class elements fullsize
function classWindowOpen()
{
	arr = getElementsByClassName('external');

	for(i = 0; i < arr.length; i++) {

		arr[i].onclick = function() {

			if (window.open(this.href)) {

				return false;

			}
		}
	}

	arr = getElementsByClassName('fullsize');

	for(i = 0; i < arr.length; i++) {

		arr[i].onclick = function() {

			if (window.open(this.href, null, 'left=0,top=0,screenY=0,screenX=0,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no')) {

				return false;

			}
		}
	}
}

window.onload = classWindowOpen;

function embedFlash(file, width, height)
{
   document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ width +'" height="' + height + '" id="'+ file +'" align="middle">\n');
   document.write('<param name="allowScriptAccess" value="sameDomain" />\n');
   document.write('<param name="movie" value="' + file + '.swf" />\n');
   document.write('<param name="quality" value="high" />\n');
   document.write('<param name="bgcolor" value="#ffffff" />\n');
   document.write('<param name="wmode" value="transparent" />\n');
   document.write('<param name="menu" value="false" />\n');
   document.write('<embed wmode="transparent" src="'+ file +'.swf" quality="high" bgcolor="#ffffff" width="'+ width +'" height="'+ height +'" name="' + file + '" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n');
   document.write('</object>\n');
}