var colorScroll = {
uniqueid: 'colorscroll',
style: { //style object for this marquee container (use quotes on both sides of the : as shown)
'width': '100%',
'height': '482px'
},
moveatleast: 0,
inc: 5, //speed - pixel increment for each iteration of this marquee's movement
stopped: true,
savedirection: true,
noAddedSpace: true,
mouse: 'cursor driven', //mouseover behavior ('pause' 'cursor driven' or false)
leftRight: function (dir){
clearTimeout(this.setup.timer);
this.inc = 4;
this.direction = dir;
return (this.stopped = false);
}
};	

var checkOutScroll = {
uniqueid: 'checkout',
style: { //style object for this marquee container (use quotes on both sides of the : as shown)
'width': '470px',
'height': '110px'
},
moveatleast: 0,
inc: 5, //speed - pixel increment for each iteration of this marquee's movement
stopped: true,
savedirection: true,
noAddedSpace: true,
mouse: 'cursor driven', //mouseover behavior ('pause' 'cursor driven' or false)
leftRight: function (dir){
clearTimeout(this.setup.timer);
this.inc = 3;
this.direction = dir;
return (this.stopped = false);
}
};

var otherPagesScroll = {
uniqueid: 'other_pages',
style: { //style object for this marquee container (use quotes on both sides of the : as shown)
'width': '638px',
'height': '448px'
},
moveatleast: 0,
inc: 5, //speed - pixel increment for each iteration of this marquee's movement
stopped: true,
savedirection: true,
noAddedSpace: true,
mouse: 'cursor driven', //mouseover behavior ('pause' 'cursor driven' or false)
leftRight: function (dir){
clearTimeout(this.setup.timer);
this.inc = 5;
this.direction = dir;
return (this.stopped = false);
}
};

var mainPageScroll = {
uniqueid: 'product_desc_text',
style: { //style object for this marquee container (use quotes on both sides of the : as shown)
'width': '110px',
'height': '225px'
},
moveatleast: 0,
inc: 5, //speed - pixel increment for each iteration of this marquee's movement
stopped: true,
savedirection: true,
noAddedSpace: true,
mouse: 'cursor driven', //mouseover behavior ('pause' 'cursor driven' or false)
leftRight: function (dir){
clearTimeout(this.setup.timer);
this.inc = 3;
this.direction = dir;
return (this.stopped = false);
}
};


// script to open links in new windows, except for this domain.
var excludedomains=["qugii.com|localhost"]
var auto=1

var excludedomains=excludedomains.join("|")
rexcludedomains=new RegExp(excludedomains, "i")

function dynamiclink(){
if (auto||(!auto&&document.targetmain.targetnew.checked)){
for (i=0; i<=(document.links.length-1); i++) {
if (document.links[i].hostname.search(rexcludedomains)==-1&&document.links[i].href.indexOf("http:")!=-1)
document.links[i].target="_blank";
document.links[i].rel="nofollow";
}
}
else
for (i=0; i<=(document.links.length-1); i++) {
if (document.links[i].hostname.indexOf(mydomain)==-1)
document.links[i].target=""
}
}


// Emailscript version 5 for hiding adresses for e-mail robots
var dom_ = new Array()
dom = "uqigi";
dom_[0] = ".com";
var mt_ = "mailto:";
var sa_ = "@";
var p_ = ".";

function mailin(name, tl, params)
{
	var s = eo(name,dom,tl);
	document.write('<a href="'+mt_+s+dom_[0]+'">'+params+'</a>');
}

function eo(name, dom, tl)
{
	var s = name+sa_;
	if (tl!=-2)
	{
		s+= dom;
		if (tl>=0)
			s+= p_+tld_[tl];
	}
	else
		s+= swapperin(dom);
	return s;
}
function swapperin(d)
{
	var s = "";
	for (var i=0; i<d.length; i+=2)
		if (i+1==d.length)
			s+= d.charAt(i)
		else
			s+= d.charAt(i+1)+d.charAt(i);
	return s.replace(/\?/g,'.');
}


// Starting scroll
function scrollElement(sElement, sHeight){
var elementH = d.getElementById(sElement).offsetHeight;
//alert('elementet er: '+elementH);
//alert('højden er sat til: '+sHeight);

if (sElement == 'colorscroll'){
if (index >= 4){
d.getElementById('button_up_colorscroll').style.visibility = "visible";
d.getElementById('button_down_colorscroll').style.visibility = "visible";
marqueeInit(colorScroll);
} else {
d.getElementById('colorscroll').style.visibility = "visible";
d.getElementById(sElement).style.height = sHeight;
}
}

if (sElement == 'checkout'){
if (elementH > sHeight){
d.getElementById('checkout_sub_spacer').style.display = 'block';
d.getElementById('button_up_checkout').style.visibility = "visible";
d.getElementById('button_down_checkout').style.visibility = "visible";
marqueeInit(checkOutScroll);
} else {
d.getElementById(sElement).style.height = elementH;
}
}
		
if (sElement == 'other_pages'){
if (elementH > sHeight){
d.getElementById('button_up_other_pages').style.visibility = "visible";
d.getElementById('button_down_other_pages').style.visibility = "visible";
marqueeInit(otherPagesScroll);
} else {
d.getElementById(sElement).style.height = sHeight;
}
}

if (sElement == 'product_desc_text'){
if (elementH >= sHeight){
d.getElementById('button_up_main_page').style.visibility = "visible";
d.getElementById('button_down_main_page').style.visibility = "visible";
marqueeInit(mainPageScroll);
} else {
d.getElementById(sElement).style.height = sHeight;
}
}
}


//Function to open pop up window
function openWin(theURL,winName,features) {
window.open(theURL,winName,features);
}


//Get elements by class name
function getElementsByClassName(oElm, strTagName, strClassName){
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	strClassName = strClassName.replace(/\-/g, "\\-");
	var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
	var oElement;
	for(var i=0; i<arrElements.length; i++){
		oElement = arrElements[i];
		if(oRegExp.test(oElement.className)){
			arrReturnElements.push(oElement);
		}
	}
	return (arrReturnElements)
}


//fading text
// set the opacity of the element (between 0.0 and 1.0) */
function setOpacity(eLayer, level) {
var element = document.getElementById(eLayer);
element.style.opacity = level;
element.style.MozOpacity = level;
element.style.KhtmlOpacity = level;
element.style.filter = "alpha(opacity=" + (level * 100) + ");";
}
 
function fadeIn(opc, eLayer){
for (i = 0; i <= 1; i += (1 / steps)) {
if(opc>=i){
setTimeout("setOpacity('" + eLayer + "'," + i + ")", i * duration);
}
}
}


//listen for body resize
function resListener() {
if (window.addEventListener)
window.addEventListener('resize', resizeDetector, false);
else if (window.attachEvent)
window.attachEvent('onresize', resizeDetector);
}
