function safemail(cryptmail) {
	window.location = "mailto:" + cryptmail.replace("¤", "@")
}

function preloadImages() {
	if (!document.aryPics) document.aryPics = new Array();
	var i,j=document.aryPics.length,args=preloadImages.arguments;
	for (i=0; i<args.length; i++)
		if (args[i].indexOf("#") != 0) { 
			document.aryPics[j] = new Image; document.aryPics[j++].src = args[i]; 
		}
}

function toggle(id, mode){ 


	dom = document.getElementById ? 1 : 0; 
	ie4 = (document.all && !dom) ? 1 : 0; 
	opera = (navigator.userAgent.indexOf('Opera')!=-1) ? 1 : 0; 
	supported = ((dom||ie4) && !(opera)) ? 1 : 0; 
	
	if(!supported) 
	return; 
	
	if (dom && !document.all) 
	document.all = document.getElementsByTagName("*") 
	
	obj = (dom) ? document.getElementById(id) : document.all(id) 
	
	if(mode=='1') { 
	
    //obj.style.left = 563 + (document.body.clientWidth >= 946 ? ((document.body.clientWidth - 946) / 2) : 0);
	
	obj.style.visibility='visible'; 
	}
	
	else 
	obj.style.visibility='hidden'; 

} 

function printpage(url) {
	var options = "status=no,menubar=no,resizable=yes,location=no,directories=no,scrollbars=yes,toolbar=yes,width=580,height=400";
	window.open(url, "Luksus", options);
}

function openlogin() {
	toggle('divLogin', '1');
	
}

function openmyprofile() {
	toggle('divLogin', '1');
}

function setCookie(name, value, expires, path, domain, secure) {
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

function getCookie(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}


function openquestionnaire() {
	if (getCookie("questionnaire2") == null) {
		toggle('divQuest2', '1');
	}
}

function questionnaire_participate() {
	var expiration = new Date();
	expiration.setTime(expiration.getTime() + 5184000000);
	setCookie("questionnaire2", "yes", expiration);
	closequestionnaire();
	questwindow  = window.open('http://3.netminers.dk/Tracker/Presentor.aspx?survey_id=84&cid=netminers','SV_Questwindow','BORDER=yes,resizable=yes,scrollbars=yes,WIDTH=550,HEIGHT=700,top=150,left=150');questwindow.focus();
}

function questionnaire_decline() {
	var expiration = new Date();
	expiration.setTime(expiration.getTime() + 5184000000);
	setCookie("questionnaire2", "no", expiration);
	closequestionnaire();
}

function questionnaire_later() {
	var expiration = new Date();
	expiration.setTime(expiration.getTime() + 86400000);
	setCookie("questionnaire2", "later", expiration);
	closequestionnaire();
}

function closequestionnaire() {
	toggle('divQuest2', '0');
}

function closelogin() {
	toggle('divLogin', '0');
}

function ordermagazine(id, magid) {
var paywindow = window.open('/magazine_shop.asp?page=3&magid='+ magid +'&selecteditems=' + id,'MZ_Paywindow','BORDER=yes,scrollbars=yes,WIDTH=700,HEIGHT=550,top=150,left=150');	
paywindow.focus();
}
