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');
}


function addtofav(lang) {

	var ua			= navigator.userAgent.toLowerCase();

	var isKonq		= (ua.indexOf('konqueror')	!= -1);
	var isSafari	= (ua.indexOf('webkit')		!= -1);
	var isMac		= (ua.indexOf('mac')		!= -1);

	var key			= (isMac?'Command':'CTRL') + ' + ' + (isKonq?'B':'D');

	var title		= document.title;
	var url			= self.location;

	var string		= '';
	var manually	= '';

	if(lang == 'de') {

		string		= 'Zum Einfügen eines Lesezeichens für diese Seite drücken Sie bitte ' + key + '.';
		manually	= 'Benutzen Sie die entsprechende Funktion Ihres Browsers um manuell ein Lesezeichen für diese Seite einzufügen.';

	} else if(lang == 'uk') {

		string		= 'You need to press ' + key + ' to bookmark this page.';
		manually	= 'To bookmark this page you must do so manually through your browser.';

	} else if(lang == 'no') {

		string		= 'Du må trykke ' + key + ' å bokmerke denne siden.';
		manually	= 'For å bokmerke denne siden, må du gjøre det manuelt via browseren din.';

	} else if(lang == 'nl') {

		string		= 'U moet druk op ' + key + ' om bookmark deze pagina.';
		manually	= 'Om bookmark deze pagina, moet u dit handmatig doen via uw browser.';

	} else if(lang == 'se') {

		string		= 'Du måste trycka på ' + key + ' till bokmärke denna sida.';
		manually	= 'Till Bokmärk denna sida, måste du göra det manuellt via din browser.';

	} else if(lang == 'eu') {

		string		= 'You need to press ' + key + ' to bookmark this page.';
		manually	= 'To bookmark this page you must do so manually through your browser.';

	} else {

		string		= 'Du skal trykke på ' + key + ' for at bogmærke denne side.';
		manually	= 'For at bogmærke denne side, skal du gøre det manuelt via din browser.';

	}

	if(document.all) { // IE

		window.external.AddFavorite(url, title);

	} else if(isKonq) { // Konqueror

		//alert('You need to press CTRL + B to bookmark this page');
		alert(string);

	} else if(window.opera) {  // Opera

		//alert('You need to press CTRL + D to bookmark this page');
		alert(string);

	} else if(window.home || isSafari) { // Firefox, Netscape, Safari, iCab

		//alert('You need to press ' + key + ' + D to bookmark this page!');
		alert(string);

	} else if(!window.print || isMac) { // IE5/Mac and Safari 1.0

		//alert('You need to press Command + D to bookmark this page!');
		alert(string);

	} else {

		//alert('To bookmark this page you must do so manually through your browser.');
		alert(manually);

    }

}



