var ajax_putinbasket_obj = false;

function getMeta(metatag)
{
    try {
        var nodeList;
        if ((navigator.appName=='Netscape') && (navigator.appVersion.charAt(0)<'5'))
            nodeList = parent.prosa.document.tags["META"];
        else
            nodeList = parent.prosa.document.getElementsByTagName("META");
        for (var i = 0; i < nodeList.length; i++)
            if (nodeList[i].name == metatag)
                return (nodeList[i].content);
    } catch (e) {
    }
    return "";
}

function changeProsaHref(newhref)
{
	prosalocation.href=newhref;
}

function replaceProsaHref(newhref)
{
	    prosalocation.replace(newhref);
}

function changeArticle(ident)
{
    changeProsaHref(showarticle+"?ident="+ident+"&wfw="+(new Date()).getTime());
}

function replaceArticle(ident)
{
    replaceProsaHref(showarticle+"?ident="+ident+"&wfw="+(new Date()).getTime());
}

function showBasket()
{
	var inbasket = "";
	pos = prosalocation.href.indexOf("ident=");
	if (pos > -1) {
		if (prosalocation.href.substring(pos+6, pos+20) == "oaseShowBasket")
			inbasket="_not";
	}
	replaceProsaHref(schillingbase+"/servlet/oase.div.redir2?wfw="+(new Date()).getTime()+"&kurv_urlbefore"+inbasket+"="+escape(prosalocation.href)+"&url="+escape(showarticle+"?ident="+schillingbasketident+"&wfw="+(new Date()).getTime()));
}

function SchGoBeforeBasket()
{
	if (schillingurlbeforebasket != null && schillingurlbeforebasket != "")
		changeProsaHref(schillingurlbeforebasket);
	else
		window.history.go(-1);
}

function showLogin(event)
{
	if (event==null)
		changeProsaHref(showarticle+"?ident=loginCombo&wfw="+(new Date()).getTime());
	else
		changeProsaHref(showarticle+"?ident=loginCombo&kurv_event="+event+"&wfw="+(new Date()).getTime());
}

function showHome()
{
	_top.location.href="/";
}

function SAL(catid, ident)
{
	if (frames['prosa'] != null)
		frames['prosa'].location.href = "/servlet/oase.article.showArticle?art_event=GET_CATEGORY&art_categoryId="+catid+"&ident="+schillinglistprefix+ident+"&art_sorttype=VTXT_ASC";
}

function SA(catid, ident)
{
	changeProsaHref(schillingbase + "/servlet/oase.article.showArticle?art_event=GET_CATEGORY&art_categoryId="+catid+"&ident="+schillinglisteprefix+ident+"&art_sorttype=VTXT_ASC");
}

function OAA(warn, artnr, antal)
{
		
	if (warn && globalwarnnostock) {
		doContinue = confirm("Varen er ikke på lager.\n\nVil du bestille alligevel?");
		if (doContinue != true)
			return;
	}
	document.basketForm.kurv_vnr.value = artnr;
	if (antal > 0)
		document.basketForm.kurv_antal.value = antal;
	else
		document.basketForm.kurv_antal.value = 1;
	document.basketForm.submit();
}

function OAAM(warn, artnr, antal, minantal)
{
	if (warn && globalwarnnostock) {
		doContinue = confirm("Varen er ikke på lager.\n\nVil du bestille alligevel?");
		if (doContinue != true)
			return;
	}
	document.basketForm.kurv_vnr.value = artnr;
	if (minantal == 0 ) {
		if (antal > 0)
			document.basketForm.kurv_antal.value = antal;
		else
			document.basketForm.kurv_antal.value = 1;
	} else {
		if ( ( antal < minantal)) {
			doContinue = confirm("Varen s‘lges i minimum "+minantal+" stk.\n\nVil du bestille alligevel?");
			if (doContinue != true)
				return;
			document.basketForm.kurv_antal.value = minantal;
		} else
			document.basketForm.kurv_antal.value = antal;
	}
	// Only update menu-frame
	document.basketForm.target = "info";
	document.basketForm.action = parent.frames['info'].window.location.href
//	dummy = alert("URL: "+parent.frames['info'].document.URL+"\nreferrer: "+parent.frames['info'].document.referrer);
//	dummy = alert("Refresh: "+document.basketForm.action+"\nident="+document.basketForm.ident.value);
	document.basketForm.submit();
}

function OAAMSIP(warn, artnr, antal, minantal, abtype, ident, pgp)
{
	if (warn == true && globalwarnnostock && abtype == "") {
		doContinue = confirm("Varen er ikke på lager.\n\nVil du bestille alligevel?");
		if (doContinue != true)
			return;
	}
	if (minantal == 0 ) {
		if (antal <= 0)
			antal = 1;
	} else {
		if ( ( antal < minantal)) {
			doContinue = confirm("Varen s.lges i minimum "+minantal+" stk.\n\nVil du bestille alligevel?");
			if (doContinue != true)
				return;
			antal = minantal;
		}
	}
	if (ajax_putinbasket_enabled)
		SchAjaxPutInBasket(schillingbase+"/servlet/oase.article.showCleanArticle?ajax=1&ident="+ajax_putinbasket_update_ident+"&wfw="+(new Date()).getTime()+"&kurv_event=KURV_ADD&kurv_vnr="+artnr+"&kurv_antal="+antal+"&abtype="+abtype);
	if (ajax_putinbasket_enabled == false)
		orderlocation.replace(schillingbase+"/servlet/oase.div.redir2?wfw="+(new Date()).getTime()+"&kurv_event=KURV_ADD&kurv_vnr="+artnr+"&kurv_antal="+antal+"&kurv_abtype="+abtype+"&url="+escape(orderlocation.href));
}

function OAAMSI(warn, artnr, antal, minantal, abtype, ident)
{
	return OAAMSIP(warn, artnr, antal, minantal, abtype, ident, '');
}

function OAWAAMFKAA(warn, artnr, antal, minantal, forpak, kurvantal, abtype, abogrp)
{
	// Not aboready
    return OAAMF(warn, artnr, antal, minantal, forpak, kurvantal);
}

function OAWAAMFKAAE(warn, artnr, antal, minantal, forpak, kurvantal, abtype, abogrp, e)
{
	var characterCode;
	if (e && e.which) { //if which property of event object is supported (NN4)
		e = e;
		characterCode = e.which //character code is contained in NN4's which property
	} else {
		e = event
		characterCode = e.keyCode //character code is contained in IE's keyCode property
	}
	if (characterCode == 13) { //if generated character code is equal to ascii 13 (if enter key)
		OAAMF(warn, artnr, antal, minantal, forpak, kurvantal);
		return false
	} else {
		return true
	}
}

function OAAMS(warn, artnr, antal, minantal, abtype)
{
	//document.basketForm.kurv_abtype.value = abtype;
	OAAMSI(warn, artnr, antal, minantal, abtype, '');
}

function OAAMF(warn, artnr, antal, minantal, forpak, kurvantal)
{
	var totalantal = Math.round(antal) + Math.round(kurvantal);
	if (warn && globalwarnnostock) {
		doContinue = confirm("Varen er ikke på lager.\n\nVil du bestille alligevel?");
		if (doContinue != true)
			return;
	}
	document.basketForm.kurv_vnr.value = artnr;
	if (minantal < 1 ) {
		if (antal > 0)
			document.basketForm.kurv_antal.value = antal;
		else
		document.basketForm.kurv_antal.value = 1;
	} else {
		if (totalantal < minantal) {
			doContinue = confirm("Varen s‘lges i minimum "+minantal+" stk.\n\nVil du bestille alligvel?");
			if (doContinue != true)
				return;
			antal = minantal;
			document.basketForm.kurv_antal.value = minantal;
		} else
			document.basketForm.kurv_antal.value = antal;
	}
	if (forpak > 0) {
		if ((antal % forpak) > 0) {
			doContinue = confirm("Varens forpakning er "+forpak+" stk.\n\nVil du bestille alligevel ");
			if (doContinue != true)
				return;
			antalgange = Math.round(antal / forpak);
			antalgange2 = antal / forpak;
			if (antalgange2 > antalgange)
				antalgange = antalgange + 1;
			antal = forpak * antalgange;
			document.basketForm.kurv_antal.value = antal;
		} else {
			document.basketForm.kurv_antal.value = antal;
		}
	}
	replaceProsaHref(schillingbase+"/servlet/oase.div.redir2?wfw="+(new Date()).getTime()+"&kurv_event=KURV_ADD&kurv_vnr="+artnr+"&kurv_antal="+antal+"&url="+escape(location.href));
	return false;
}

function OA(warn, artnr)
{
	if (warn && globalwarnnostock) {
		doContinue = confirm("Varen er ikke på lager.\n\nVil du bestille alligevel?");
		if (doContinue != true)
			return;
	}
	//document.basketForm.kurv_vnr.value = artnr;
	//document.basketForm.submit();
	abtype=""
	orderlocation.replace("/servlet/oase.div.redir2?wfw="+(new Date()).getTime()+"&kurv_event=KURV_ADD&kurv_vnr="+artnr+"&kurv_antal="+antal+"&abtype="+abtype+"&url="+escape(orderlocation.href));
}

function EAN13check(field)
{
	var csumTotal = 0;
	if (field.value.length == 0) return true;
	if (field.value.length != 13)
	{
		alert('Der skal indtastes 13 cifre i EAN-feltet.');
		field.focus();
		return false;
	}
	for (charPos = 11; charPos >= 0; charPos--)
	{
		if (charPos / 2 == parseInt(charPos/2))
			csumTotal = csumTotal + (parseInt(field.value.substring(charPos,charPos+1)));
		else
			csumTotal = csumTotal + (3 * parseInt(field.value.substring(charPos,charPos+1)));
	}
	var remainder = csumTotal - parseInt(csumTotal/10) * 10;
	if (remainder == 0)
		checksumDigit = '0';
	else
		checksumDigit = String.fromCharCode(48+10-remainder);
	if (field.value.substring(12,13)!=checksumDigit) {
		alert('EAN-nummeret er ikke korrekt.');
		field.focus();
		return false;
	}
	return true;
}

function submitUserForm(form)
{
	var nodeList = document.getElementsByTagName("INPUT");
	for (var i = 0; i < nodeList.length; i++) {
	if (nodeList[i].className == "UserRequiredField") {
            if (form.copy2box.checked == true) {
                if (nodeList[i].name == "boxfirma" || nodeList[i].name == "boxadr" || nodeList[i].name == "boxpostnr")
                   continue;
            }
			if (nodeList[i].name == "boxadr" || nodeList[i].name == "boxpostnr") {
				if (form.invcompany.value != "" || form.invaddress1.value != "" || form.invpostalcode != "") {
					if (form.invcompany.value != "" && form.invaddress1.value != "" && form.invpostalcode.value != "")
						continue;
					else {
						alert("Venligst angiv komplett fakturaadresse");
						return false;
					}
				}
			}
			nodeList[i].focus();
			alert("Feltet skal fylles ut!");
			return false;
	}
	if (nodeList[i].name == "ean")
		if (!EAN13check(nodeList[i])) return false;
	}
	form.boxfirma.value= form.firma.value;
	validateEmail(form.email, '', true);
	form.submit();
	return true;
}


function panelIsLoading()
{
	try {
	var nodeList;
	if ((navigator.appName=='Netscape') && (navigator.appVersion.charAt(0)<'5'))
		nodeList = parent.prosa.document.tags["META"];
	else
		nodeList = parent.prosa.document.getElementsByTagName("META");
	for (var i = 0; i < nodeList.length; i++) {
		if (nodeList[i].name == "ArticleIdent") {
			if (nodeList[i].content == "oaseShowBasketFrozen" ||
				nodeList[i].content == "oaseShowBasket") {
				parent.prosa.location.href="/servlet/oase.article.showArticle?ident=oaseShowBasket&wfw="+(new Date()).getTime();
				return true;
			} else {
				ahref = parent.prosa.location.href;
				parent.prosa.location.href = ahref;
				return true;
			}
		}
	}
	} catch (e) {
	}
	return false;
}

function resetFavoritList()
{
	var nodeList = parent.prosa.document.getElementsByTagName("INPUT");
	for (var i = 0; i < nodeList.length; i++)
		if (nodeList[i].className == "number")
			nodeList[i].value = "0";
}

function refreshPanel()
{
//	ahref = parent.menuframe.window.location.href;
//	parent.menuframe.window.location.href = ahref+"&wfw="+(new Date()).getTime();
//	parent.frames['info'].window.location.href = "/servlet/oase.article.showArticle?ident=oaseLeftIn&nident=oaseLeft&wfw="+(new Date()).getTime();
}

function pilover(pilid)
{
	pilid.src="/images/arrow_off.gif";
}

function pilout(pilid)
{
	pilid.src="/images/arrow_on.gif";
	//eval(Pic+".src="+Pic+"off.src") ;
}

function printProsa()
{
	var windowtoprint;
	if (top.frames['prosa'] != null)
		windowtoprint = top.frames['prosa'];
	else
		windowtoprint = window;
	if (windowtoprint.print) {
		windowtoprint.focus();
		windowtoprint.print()
	}
}

function deleteBasket(olid)
{
	var f = document.getElementById(olid);
	var snabpos = f.name.indexOf("@");
	var vnr = f.name;
	if (snabpos > -1)
		vnr = f.name.substring(0,snabpos);
	window.location.replace(schillingbase + "/servlet/oase.article.showArticle?ident=oaseShowBasket&kurv_event=KURV_DEL&kurv_vnr="+vnr+"&wfw="+(new Date()).getTime());
}

function deleteCourseBasket(olid, courseno, coursegrp)
{
	var f = document.getElementById(olid);
   	window.location.replace(schillingbase + "/servlet/oase.article.showArticle?ident=oaseShowBasket&kurv_event=KURV_DEL&kurv_vnr="+f.name+"&kurv_courseno="+courseno+"&kurv_coursegrp="+coursegrp+"&arttype=COURSE&wfw="+(new Date()).getTime());

}

function emptyBasket()
{
    changeProsaHref(showarticle+"?ident="+schillingbasketident+"&kurv_event=KURV_EMPTY&wfw="+(new Date()).getTime());
}

function handleUserLogin()
{
//	dummy = alert("Handle user login");
//  refreshProsaCond();
//  changeProsaHref("/servlet/oase.article.showArticle?ident=LoginInfo&wfw="+(new Date()).getTime());
//  refreshPanel(); /* Rest POST STATUS */
}

function handleUserLogout()
{
//  dummy = alert("Handle user logout");
//  refreshProsaCond()
//  refreshPanel(); /* Rest POST STATUS */
//  refreshTotalFrame();
}

function mkcss(style_name)
{
	// Create dynamic stylesheet link
	if (document.createStyleSheet) {
		// The IE way...
		document.createStyleSheet(style_name, 0);
		var last=0;
		if (document.styleSheets.length>1) {
			for (var i=1; i<document.styleSheets.length; i++)
				if (document.styleSheets[i].href) {
					document.styleSheets[last].href = document.styleSheets[i].href;
					last = i;
				}
			document.styleSheets[last].href = style_name;
		}
	} else {
		// The Mozilla way
		_TEMP_OUTP = document.createElement("LINK");
		_TEMP_OUTP.setAttribute("REL","stylesheet");
		_TEMP_OUTP.setAttribute("TYPE","text/css");
		_TEMP_OUTP.setAttribute("HREF",style_name);
		document.getElementsByTagName("HEAD").item(0).appendChild(_TEMP_OUTP);
	}
}

function toggleEnlarge()
{
	var aCookie = document.cookie.split("; ");
	var curEnlarge = 0;
	chunkarr=new Array();
	for (i=0; i < aCookie.length && !curEnlarge; i++)
	{
		// a name/value pair (a crumb) is separated by an equal sign
		var aCrumb = aCookie[i].split("=");
		if (aCrumb[0] == "ShopEnlarge") {
			curEnlarge = aCrumb[1].substr(0,3)=="yes";
			break;
		}
	}	
	if (document.styleSheets.length>0) {
		var sheet;
		for (i=document.styleSheets.length-1; i>=0; i--) {
			sheet=document.styleSheets[i];
			if (sheet.href) {
				// Got the last stylesheet.
				hasLarge = (sheet.href.length>10 &&
							sheet.href.substr(sheet.href.length-10)=="-large.css");
				break;
			}
		}
		if (i<0) return;	// No CSS-files at all - not supported.
		if (hasLarge) {
			if (curEnlarge)
				document.styleSheets[i].disabled=true;
			else
				document.styleSheets[i].disabled=false;
		} else
			if (!curEnlarge)
				mkcss(sheet.href.substr(0,sheet.href.length-4)+"-large.css");
		if (curEnlarge)
			document.cookie="ShopEnlarge=no; expires=Sat, 31 Dec 2050 23:59:59 GMT";
		else
			document.cookie="ShopEnlarge=yes; expires=Sat, 31 Dec 2050 23:59:59 GMT";
	}
}

function OCSISBN(isbn)
{
	if(isbn == "")
		return;
	document.searchIsbnForm.isbn.value = isbn;
	document.searchIsbnForm.submit();
}

function OCSISBNK(isbn)
{
	if(event.keyCode==13)
	{
		OCSISBN(isbn);
		event.returnValue=false;
	}
}

function SV(artnr)
{
    changeProsaHref("/vare/"+artnr);
}

function OCSISBN(isbn)
{
	document.searchIsbnForm.isbn.value = isbn;
	if(document.searchIsbnForm.isbn.value != "")
		document.searchIsbnForm.submit();
}

function OCSISBNK(isbn)
{
	if(event.keyCode==13)
	{
		event.returnValue=false;
		OCSISBN(isbn);
	}
}

function showLogin(event)
{
	if(event=="")
		changeProsaHref("/servlet/oase.article.showArticle?ident=loginCombo&wfw="+(new Date()).getTime());
	else
		changeProsaHref("/servlet/oase.article.showArticle?ident=loginCombo&kurv_event="+event+"&wfw="+(new Date()).getTime());
}

function doLogout()
{
	changeProsaHref(logouturl);
//	dummy = alert("after logout - going to front.");
//	changeProsaHref("/");
}

function doLogin()
{
	changeProsaHref(loginurl+"&wfw="+(new Date()).getTime());
}

function doChangeUser()
{
	changeProsaHref(changeuserurl+"&wfw="+(new Date()).getTime());
}


function frontPage()
{
	/* Er ikke nogen endelig funkton - er blot her for at arkivere URL'en */
	changeProsaHref("/servlet/oase.article.showArticle?ident=Forside&art_event=GET_CATEGORY&art_categoryId="+forsidecat+"&wfw="+(new Date()).getTime());
}

function showMailPwdPage()
{
	changeProsaHref("/servlet/oase.article.showArticle?ident=GlemtKode&wfw="+(new Date()).getTime());
}

function showErrorMessage(message)
{
	dummy = alert(message);
	return false;
}

function basketEanNotValidError()
{
	dummy = alert("Angivet EAN er ikke validt.");
}

// -----------------------------------------
//               validateEmail
// Validate if e-mail address
// Returns true if so (and also if could not be executed because of old browser)
// -----------------------------------------

function validateEmail  (vfld,   // element to be validated
                         ifld,   // id of element to receive info/error msg
                         reqd)   // true if required
{
	return true;
//dummy = alert("validateEmail");
  //var stat = commonCheck (vfld, ifld, reqd);
  //if (stat != proceed) return stat;

  var tfld = trim(vfld.value);  // value of field with whitespace trimmed off
  var email = /^[^@]+@[^@.]+\.[^@]*\w\w$/
  if (!email.test(tfld)) {
    showErrorMessage ("ERROR: not a valid e-mail address");
    vfld.focus();
    return false;
  }
  var email2 = /^[A-Za-z][\w.-]+@\w[\w.-]+\.[\w.-]*[A-Za-z][A-Za-z]$/
  if (!email2.test(tfld)) 
    showErrorMessage ("Unusual e-mail address - check if correct");
  return true;
};

function flipflopblock(nodehit, idshowornot)
{
	elemtoshowornot = document.getElementById(idshowornot);
	iconwhenhidden = document.getElementById(idshowornot+"_icoshow");
	iconwhenshown = document.getElementById(idshowornot+"_icohide");
	if (elemtoshowornot != null) {
		if (elemtoshowornot.style.display == "none") {
			elemtoshowornot.style.display = "block";
			if (iconwhenshown != null)
				iconwhenshown.style.display = "block";
			if (iconwhenhidden != null)
				iconwhenhidden.style.display = "none";
		} else {
			elemtoshowornot.style.display = "none";
			if (iconwhenshown != null)
				iconwhenshown.style.display = "none";
			if (iconwhenhidden != null)
				iconwhenhidden.style.display = "block";
		}
	}
}

function BC_Cancel(questiontxt, distno, ident)
{
	doContinue = confirm(questiontxt);
	if (doContinue != true)
		return;
	replaceProsaHref(schillingbase + "/servlet/oase.div.redir2?wfw="+(new Date()).getTime()+"&art_event=BCCNCL&art_bcdst="+distno+"&url="+escape(location.href));
}

function BC_Enrole(questiontxt, distno, ident)
{
	doContinue = confirm(questiontxt);
	if (doContinue != true)
		return;
	replaceProsaHref(schillingbase + "/servlet/oase.div.redir2?wfw="+(new Date()).getTime()+"&art_event=BCNRL&art_bcdst="+distno+"&url="+escape(location.href));
}

function SCHOC(vnr, courseno, coursegrp, loggedin)
{
	if (loggedin == "true") {
		var antal = 1;
		location.replace(schillingbase + "/servlet/oase.div.redir2?wfw="+(new Date()).getTime()+"&kurv_event=KURV_ADD&kurv_vnr="+vnr+"&kurv_courseno="+courseno+"&kurv_coursegrp="+coursegrp+"&kurv_antal="+antal+"&arttype=COURSE"+"&url="+escape(location.href));
	} else {
		alert("Vg log ind");
	}
}

function SCHCC(vnr, courseno, coursegrp)
{
	var doContinue;
	doContinue = confirm("Vil du afmelde dig fra dette kursus?");
	if (doContinue != true)
		return;
	location.replace(schillingbase + "/servlet/oase.div.redir2?wfw="+(new Date()).getTime()+"ident=oaseUserCourses&user_event=USER_DELCOURSE&user_vnr="+vnr+"&user_courseno="+courseno+"&user_coursegrp="+coursegrp+"&url="+escape(location.href));
}

function SchClickToDownloadEbook(url, name)
{
	open(url, null, 'toolbar=0,location=0,directories=0,menubar=0,width=640,height=200');
}

function getDescriptionHref(ElemType)
{
	thiselement = document.getElementById(ElemType);
	var anchor = 0;
	anchor = location.href.indexOf("#");
	if (anchor > 0) {
		actlink = location.href.substring(0, anchor+1);
		thiselement.href = actlink+"show"+ElemType;
	} else {
		thiselement.href = location.href+"#show"+ElemType;
	}
}

function showBCOrderStat()
{
	changeProsaHref(showarticle+"?ident="+schillingbcstatident+"&wfw="+(new Date()).getTime());
}

function showBCDists()
{
	changeProsaHref(showarticle+"?ident="+schillingbcdistident+"&art_event=GET_BCDST&art_distsort=canceldate&wfw="+(new Date()).getTime());
}

function updateDeliveryMethod()
{
	var i=document.olform.deliverymethod.selectedIndex;
	document.olform.kurv_levmaade.value = document.olform.deliverymethod.options[i].text;
	document.olform.kurv_levmaadekode.value = document.olform.deliverymethod.options[i].value;
	document.olform.kurv_event.value = "KURV_UPDATE";
//  document.olform.ident.value="oaseShowBasket";
}

function SchBasketBack(backtourl)
{
    changeProsaHref(backtourl+"&wfw="+(new Date()).getTime());
}

function SchShopInfo()
{
    changeProsaHref(schillingshopinfourl);
}

function SchShowTipFriend(vnr)
{
	window.open(showarticle+"?ident="+schillingtiparticle+"&noshowtype=true&notemplate=true&wfw="+(new Date()).getTime()+"&ident="+schillingtiparticle+"&art_event=GET_ART&art_vnr="+vnr, null, 'toolbar=0,location=0,directories=0,menubar=0,width=460,height=300');
	
}

function SchClearSelect(node)
{
	node.value = "";
	node.select();
}

function UserLoginOLD(ident) {
    var user = document.getElementsByName("user_id");
    var password = document.getElementsByName("user_passwd");
    location.replace(schillingbase + "/servlet/oase.div.redir2?wfw="+(new Date()).getTime()+"&user_event=USER_LOGIN&user_oldevent=USER_LOGIN&ident="+ident+"&user_id="+user[0].value+"&user_passwd="+password[0].value+"&url="+escape(location.href));
}

function UserLogin(ident) {
    var user = document.getElementsByName("user_id");
    var password = document.getElementsByName("user_passwd");
	var url = schillingbase + "/servlet/oase.article.showArticle?wfw="+(new Date()).getTime()+"&ident="+ident;
//	var url = "http://www.hmsbutikken.no/servlet/oase.article.showArticle?wfw="+(new Date()).getTime()+"&ident="+ident;

	if (ident == "oaseShowBasketPayment")
		url += "&kurv_event=KURV_SUBMIT_NUPD";

    location.replace(schillingbase + "/servlet/oase.div.redir2?wfw="+(new Date()).getTime()+"&user_event=USER_LOGIN&user_oldevent=USER_LOGIN&ident="+ident+"&user_id="+user[0].value+"&user_passwd="+escape(password[0].value)+"&url="+escape(url));
	return false;
}

function UserLogout(ident) {
    location.replace(schillingbase + "/servlet/oase.div.redir2?wfw="+(new Date()).getTime()+"&user_event=USER_LOGOUT&ident="+ident);
    frontPage();
}

function goToNextPage()
{
    var nextid;
    var s=location.href.split('art_pageId=');
    if (s[1] == undefined) {
    nextid = 2;
    location.replace(s[0]+'&art_pageId='+nextid);
    } else {
        var endchar = s[1].indexOf('&');
        if (endchar == -1)
            endchar = s[1].length;
        var id = s[1].substring(0, endchar);
    nextid = parseInt(id)+1;
    location.replace(s[0]+'art_pageId='+nextid+s[1].substring(endchar));
    }

}

function goToPrevPage()
{
    var nextid;
    var s=location.href.split('art_pageId=');
    if (s[1] == undefined) {
    nextid = 2;
    location.replace(s[0]+'&art_pageId='+nextid);
    } else {
    var endchar = s[1].indexOf('&');
        if (endchar == -1)
            endchar = s[1].length;
        var id = s[1].substring(0, endchar);
        var nextid = parseInt(id)-1;
        location.replace(s[0]+'art_pageId='+nextid+s[1].substring(endchar));
    }
}

function showPageInList(showId)
{
    var s = location.href.split('art_pageId=');
    if (s[1] == undefined) {
    location.replace(s[0]+'&art_pageId='+showId);
    } else {
        var endchar = s[1].indexOf('&');
        if (endchar == -1)
            endchar = s[1].length;
        if (s[1].length > 1) {
            location.replace(s[0]+'art_pageId='+showId+s[1].substring(endchar));
        } else
            location.replace(s[0]+'art_pageId='+showId);
    }
}

function initAjaxPutInBasket()
{
    if (window.XMLHttpRequest) { // Mozilla, Safari,...
        ajax_putinbasket_obj = new XMLHttpRequest();
        if (false && ajax_putinbasket_obj.overrideMimeType) {
            ajax_putinbasket_obj.overrideMimeType('text/xml');
            // See note below about this line
        }
    } else if (window.ActiveXObject) { // IE
        try {
            ajax_putinbasket_obj = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                ajax_putinbasket_obj = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }
	/*
    if (ajax_putinbasket_obj)
    	ajax_putinbasket_obj.onreadystatechange = function() { SchAjaxNotify(ajax_putinbasket_obj, 'SchMiniBasket'); };
	else
        alert('Giving up :( Cannot create an XMLHTTP instance');
	*/
	if (!ajax_putinbasket_obj) {
        //alert('Giving up :( Cannot create an XMLHTTP instance');
		ajax_putinbasket_enabled = false;
	}
}

function SchAjaxPutInBasket(url)
{
	if (!ajax_putinbasket_obj)
		initAjaxPutInBasket();
	if (ajax_putinbasket_obj.readyState != 4 && ajax_putinbasket_obj.readyState != 0)
		return;
    try {
    	ajax_putinbasket_obj.open('GET', url, true);
    	ajax_putinbasket_obj.onreadystatechange = function() { SchAjaxNotify(ajax_putinbasket_obj, ajax_putinbasket_update_id); };
	} catch (open_e) {
		dummy = alert("Cannot open "+url+"\nexception="+open_e);
	}
	try {
    	ajax_putinbasket_obj.send(null);
		ajax_active=1;
	} catch (ex) {
		ajax_active=0;
	}
	// Show something while waiting for update?
    if (ajax_active && ajax_putinbasket_update_id!=null) {
	   if (ajax_putinbasket_wait_html) {
	   		element = ajax_putinbasket_update_document.getElementById(ajax_putinbasket_update_id);
			element.innerHTML = ajax_putinbasket_wait_html;
		}
	}
}

function SchAjaxNotify(notified_http_request, id_of_element_to_update)
{
    if (notified_http_request.readyState == 4) {
        if (notified_http_request.status == 200 || notified_http_request.status == 302) {
			if (id_of_element_to_update) {
            	if (ajax_putinbasket_update_id!=null) {
	   				//element = ajax_putinbasket_update_document.getElementById(ajax_putinbasket_update_id);
	   				element = ajax_putinbasket_update_document.getElementById(id_of_element_to_update);
            		if (element && element.innerHTML)
            			element.innerHTML = notified_http_request.responseText;
					//dummy = alert(alerted_http_request.responseText);
            	} else {
            		dummy = alert('SchAjaxNotify(): DOM blocklevel element not found - id='+id_of_element_to_update+" element="+ajax_putinbasket_update_element);
            	}
			} // No element then
        } else {
            alert('SchAjaxNotify() - Der var opstod problemer ved server kald - status='+notified_http_request.status);
        }
    }
}

function SchShowInvAddrEditable()
{
	replaceProsaHref(schillingbase+"/servlet/oase.div.redir2?wfw="+(new Date()).getTime()+"&url="+escape(showarticle+"?ident="+schillingbasketfakadrident+"&wfw="+(new Date()).getTime()));
}

function SchShowDelAddrEditable()
{
	replaceProsaHref(schillingbase+"/servlet/oase.div.redir2?wfw="+(new Date()).getTime()+"&url="+escape(showarticle+"?ident="+schillingbasketlevadrident+"&wfw="+(new Date()).getTime()));
}

function SchGetAndInsert(url, id)
{
    var sch_http_request = false;
	//dummy = alert("SchGetAndInsert(url='"+url+"', id='"+id+"')");
/*
	try {
	    netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
   } catch (e) {
       alert("Permission UniversalBrowserRead denied.");
	}
*/
    if (window.XMLHttpRequest) { // Mozilla, Safari,...
        sch_http_request = new XMLHttpRequest();
        if (false && sch_http_request.overrideMimeType) {
            sch_http_request.overrideMimeType('text/xml');
            // See note below about this line
        }
    } else if (window.ActiveXObject) { // IE
        try {
            sch_http_request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                sch_http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }
    if (!sch_http_request) {
        alert('Giving up :( Cannot create an XMLHTTP instance');
        return false;
    }
    try {
    	sch_http_request.open('GET', url, true);
    	sch_http_request.onreadystatechange = function() { SchAlertContents(sch_http_request,id); };
	} catch (open_e) {
		dummy = alert("Cannot open "+url+"\nexception="+open_e);
	}
    sch_http_request.send(null);
}

function SchAlertContents(alerted_http_request, id) {

	//dummy = alert("SchAlertContents(): readyState="+alerted_http_request.readyState);
    if (alerted_http_request.readyState == 4) {
        if (alerted_http_request.status == 200 || alerted_http_request.status == 302 || alerted_http_request.status == 0 ) {
            //var element = document.getElementById(id);
			// FIXME - don't use fixed location
            //var element = parent.frames['info'].document.getElementById(id);
            var element = document.getElementById(id);
            if(element!=null&&element.innerHTML){
            	element.innerHTML=alerted_http_request.responseText;
				//dummy = alert(alerted_http_request.responseText);
            } else {
            	dummy = alert('SchAlertContents(): DOM blocklevel element not found - id='+id+" element="+element);
            }
        } else {
            dummy = alert('SchAlertContents(): Der opstod problemer ved server kald - status='+alerted_http_request.status);
        }
    }

}

