function image1(name, pic){
		if (document.images){
			document.images[name].src="images/upload/" + pic;
		}
	}
	
function image2(name, pic){
	if (document.images){
		document.images[name].src="images/upload/" + pic;
	}
}

function MM_preloadImages() { //v3.0
		var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function setCookie(c_name,value,expiredays) {
	var exdate=new Date();
    exdate.setDate(exdate.getDate()+expiredays);
    document.cookie=c_name+ "=" +escape(value)+
    ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getCookie(c_name)
{
    if (document.cookie.length>0)
      {
      c_start=document.cookie.indexOf(c_name + "=");
      if (c_start!=-1)
        {
        c_start=c_start + c_name.length+1;
        c_end=document.cookie.indexOf(";",c_start);
        if (c_end==-1) c_end=document.cookie.length;
        return unescape(document.cookie.substring(c_start,c_end));
        }
      }
    return "";
}

function loadFontSize(){
    if (getCookie('fontsize') == null) {
	    var fontsize = 100;
    } 
    else {
        var fontsize = getCookie('fontsize');
        if (fontsize != ""){
            changeTextSize(fontsize);
        }
        else{
            fontsize = 100;  
        }
    }     
}

function changeTextSizeLink(fontsize)
{
    if (document.getElementById('spanTextSize')){        
        document.getElementById('spanTextSize').innerHTML = (fontsize==125) ? "<a href='#' onclick='changeTextSize(100)'>Mindre tekst</a>" : "<a href='#' onclick='changeTextSize(125)'>Større tekst</a>";        
    }   
}

function changeTextSize (fontsize) {
    setCookie('fontsize',fontsize,365);
	if (document.getElementById('contentCell')){
	    document.getElementById('contentCell').style.fontSize = fontsize + '%';
	}
	changeTextSizeLink(fontsize);    	 
}

function cm_bwcheck(){
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent.toLowerCase()
	this.dom=document.getElementById?1:0
	this.ff =(this.agent.indexOf("firefox")>-1)
	this.op5=(this.agent.indexOf("opera 5")>-1 || this.agent.indexOf("opera/5")>-1) && window.opera 
	this.op6=(this.agent.indexOf("opera 6")>-1 || this.agent.indexOf("opera/6")>-1) && window.opera   
	this.op7=(this.agent.indexOf("opera 7")>-1 || this.agent.indexOf("opera/7")>-1) && window.opera   
	this.op8=(this.agent.indexOf("opera 8")>-1 || this.agent.indexOf("opera/8")>-1) && window.opera   
	this.op9=(this.agent.indexOf("opera 9")>-1 || this.agent.indexOf("opera/9")>-1) && window.opera 
	this.ie5 = (this.agent.indexOf("msie 5")>-1 && !this.op5 && !this.op6)
	this.ie55 = (this.ie5 && this.agent.indexOf("msie 5.5")>-1)
	this.ie6 = (this.agent.indexOf("msie 6")>-1 && !this.op5 && !this.op6)
	this.ie7 = (this.agent.indexOf("msie 7")>-1 && !this.op5 && !this.op6)
	this.ie4=(this.agent.indexOf("msie")>-1 && document.all &&!this.op5 &&!this.op6 &&!this.ie5&&!this.ie6)
	this.ie = (this.ie4 || this.ie5 || this.ie6 || this.ie7)
	this.mac=(this.agent.indexOf("mac")>-1)
	this.ns6=(this.agent.indexOf("gecko")>-1 || window.sidebar)
	this.ns4=(!this.dom && document.layers)?1:0;
	this.bw=(this.ie7 || this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.op5 || this.op6 || this.ff)
	this.usedom= this.ns6 || this.ff //Use dom creation
	this.reuse = this.ie||this.usedom //Reuse layers
	this.px=this.dom&&!this.op5?"px":""
	return this
}
var bw=new cm_bwcheck()

function TjekSearchField(form,text){	
	if ((eval('document.forms.' + form + '.searchStr.value==""')) || (eval('document.forms.' + form + '.searchStr.value.length < 2'))) {
		alert(text);
		return false;		
		}		
	}	
		
function ViewImage(name, width, height) {
	html =  '<html><head><title>Billede</title></head>' +
		'<body style="margin-top:0px; margin-left:0px; margin-right:0px; margin-bottom:0px;" onClick=\'self.close()\' bgcolor=black><table width=100% border=0 cellspacing=0 cellpadding=0><tr><td align="center">' +
		'<img src="../images/upload/' + name + '" /></td></tr><tr><td align=center><a href="javascript:self.close();"><font face="Verdana,Geneva,Arial,Helvetica,sans-serif" size="2" color=white>Luk vindue</font></a></td></tr></table></body></html>';
	
   	var isNav4, isIE4;
	if (parseInt(navigator.appVersion.charAt(0)) >= 4) {
		isNav4 = (navigator.appName == "Netscape") ? 1 : 0;				
		isIE4 = (navigator.appName.indexOf("Microsoft") != -1) ? 1 : 0;
	}
	var settings;	
	if (isNav4) {
		settings = 'width=' + (width + 18) + ',height=' + (height + 25) + ',scrollbars=no,status=no,resizable=no,menubar=no';				
	}
	else {
	settings = 'width=' + width + ',height=' + (height + 20) + ',scrollbars=no,status=no,resizable=no,menubar=no';
	}	
	
	var imgWin = window.open('', 'imgWindow', settings);
	
	imgWin.document.open();
	imgWin.document.write(html);
	imgWin.document.close();	
}
function PrintPopUp(){									
	var content = document.getElementById("contentCell").innerHTML	
	var html = '<html>' +
		'<head>' +
		'<link href="http://' + ServerName + '/_css/normal.css" rel="stylesheet" type="text/css">' +
        '<link href="http://' + ServerName + '/_css/webshop.css" rel="stylesheet" type="text/css">' +
		'<link href="http://' + ServerName + '/_css/print.css" rel="stylesheet" type="text/css">' +
		'<title>' + PageTitle + ' | ' + MenuName + '</title>' +
		'</head>' +
		'<body style="margin-top:10px; margin-left:10px">' + content + '</body>' + 
		'</html>';
	var settings = 'width=800,height=600,scrollbars=1,status=no,resizable=1,menubar=no';
	var win = window.open('', 'imgWindow', settings);
	win.document.open();
	win.document.write(html);
	win.print();
	win.document.close();
}

function TipAFriend(url){
    var settings = 'width=330,height=430,scrollbars=auto,status=no,resizable=1,menubar=no'; 
    var win = window.open('TipEnVen.asp?url='+url, 'imgWindow', settings);
}

function GetXmlHttpObject(){
    var objXMLHttp=null;
    try
      {
      // Firefox, Opera 8.0+, Safari
      objXMLHttp=new XMLHttpRequest();      
      }
    catch (e)
      {
      // Internet Explorer
      try
        {
        objXMLHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
      catch (e)
        {
        objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      }
    return objXMLHttp;
}

function getRSSFeed(articleID,targetID){ 
    var httpRequest;
 
	if (window.XMLHttpRequest) { // Mozilla, Safari, ...
	    httpRequest = new XMLHttpRequest();
	    if (httpRequest.overrideMimeType) {
	        httpRequest.overrideMimeType('text/xml');
	        // See note below about this line
	    }
	} 
	else if (window.ActiveXObject) { // IE
	    try {
	        httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
	        } 
	        catch (e) {
               try {
                    httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
                   } 
                 catch (e) {}
              }
	    }
	
	if (!httpRequest) {
	    alert('Giving up :( Cannot create an XMLHTTP instance');
	    return false;
	}  
	
	param = "articleID="+articleID;
				  						
    var url="_include/rss-reader.asp" + "?" + param;
    httpRequest.onreadystatechange=function() { updateDiv(httpRequest, targetID) };
    httpRequest.open("GET",url,true);
    httpRequest.send(null);	
}

function updateDiv(httpRequest, targetID){
    if(httpRequest.readyState == 1){
        if (document.getElementById(targetID)) {
            document.getElementById(targetID).innerHTML='';
		    document.getElementById(targetID).innerHTML = '<img src="/images/upload/ajax-loader.gif" width="16" height="16" alt="AJAX loader" border="0" />';
		}
    }
    if (httpRequest.readyState==4 || httpRequest.readyState=="complete"){ 	
        if (document.getElementById(targetID)) {	        			        			   		    
	        document.getElementById(targetID).innerHTML = httpRequest.responseText;
	        //alert(xmlHttp.responseText)
	    }	    
    }
}

function MenuMouseOver(RwNm) {
    RwNm.style.background = MenuRowColorOn;
}
function MenuMouseOut(RwNm) {
    RwNm.style.background = MenuRowColorOff;
}

