// following global vars are set in ./includes/head_var.htm !
	// var portalguid;
	// var servername;
	// var servletname;
	// var siteroot;


////**** cart functions ****////
// add
function cartAdd(lmid, wmencpid, uotid) {
	var slid = 0;
	var org_wmencpid = 0;
	var org_uotid = 0;
	var url = servername+servletname+'Call?htmltemplate=./cart/applycart.htm&UpdateCart='
			+lmid+':'+slid+':'+org_wmencpid+':'+wmencpid+':'+org_uotid+':'+uotid+':1';
	servercomm.location.href = url ;
}

// remove
function cartDel(lmid, wmencpid, slid, uotid) {
	var org_wmencpid = 0;
	var org_uotid = 0;
	var url = servername+servletname+'Call?htmltemplate=./cart/applycart.htm&action=del&UpdateCart='
			+lmid+':'+slid+':'+org_wmencpid+':'+wmencpid+':'+org_uotid+':'+uotid+':0';
	servercomm.location.href = url;
}

// empty
function cartEmpty() {
	var url = servername+servletname+'Call?htmltemplate=./cart/applycart.htm&action=empty';
	servercomm.location.href = url;
}

// shopcartcount
function cartSet(content) {
	document.getElementById('dvShoppingCart').innerHTML = content;
}


////**** selection functions ****////
// add
function selectionAdd(lmid, wmencpid, origin) {
	if(origin == 'cart') var action = 'addfromcart';
	else var action = 'add';
	var url = servername+servletname+'Call?htmltemplate=./selection/applyselection.htm&lmid='+lmid+'&wmencpid='+wmencpid+'&action='+action;
	servercomm.location.href = url;
}

// remove
function selectionDel(lmid, wmencpid, origin) {
	if(origin == 'right') var action = 'del';
	else var action = 'delete';
	var url = servername+servletname+'Call?htmltemplate=./selection/applyselection.htm&lmid='+lmid+'&wmencpid='+wmencpid+'&action='+action;
	servercomm.location.href = url;
}

// move to cart
function selectionMov(lmid, wmencpid, origin) {
	if(origin == 'right') var action = 'mov';
	else var action = 'move';
	var url = servername+servletname+'Call?htmltemplate=./selection/applyselection.htm&lmid='+lmid+'&wmencpid='+wmencpid+'&action='+action;
	servercomm.location.href = url;
}

// selectionlist + count
function selectionSet(content,count) {
	document.getElementById('dvPlaylistR').innerHTML = content;
	document.getElementById('PlaylistBoxCount').innerHTML = count;
	document.getElementById('PlaylistBoxCountR').innerHTML = count;
}



////**** detail functions ****////
// prelistening
function listen(lmid) {
	try {
		var newPL = window.open(servername+servletname+'call?htmltemplate=./misc/prelisten.htm&lmid='+lmid,'PL', 'width=600,height=500,scrollbars=yes');
		newPL.focus();
	} catch (ex) {
		alert("Dieser Link öffnet ein neues Fenster. Bitte lassen Sie Popups zu!");
	}
	//alert('Vorhörfunktion...\nlmid='+lmid);
	//window.open(servername+servletname+'call?htmltemplate=./misc/prelisten.htm&lmid='+lmid,'LibroAtPrelisten','width=400,height=191,top=300,left=300,scrollbars=no');
}

// send to friend
function send2friend(lmid,lmtype) {
	try {
		var newS2F = window.open(servername+servletname+"Call?htmltemplate=./misc/send2friend.htm&lmid="+lmid+"&lmtype="+lmtype, "S2F", "width=445,height=400");
		newS2F.focus();
	} catch (ex) {
		alert("Dieser Link öffnet ein neues Fenster. Bitte lassen Sie Popups zu!");
	}
	//alert('Diese Funktion steht noch nicht zur Verfügung.');
}

// security information
function openDS() {
	try {
		var newDS = window.open(servername+servletname+"Call?htmltemplate=./help/datenschutz.htm", "DS", "width=445,height=495");
		newDS.focus();
	} catch (ex) {
		alert("Dieser Link öffnet ein neues Fenster. Bitte lassen Sie Popups zu!");
	}
}

// certificate information
function openCertInf(certid,certcode) {
	try {
		var newGC = window.open(servername+servletname+"Call?htmltemplate=./giftcert/showvalidlm.htm&certid="+certid+"&certcode="+certcode, "GC", "width=445,height=495");
		newGC.focus();
	} catch (ex) {
		alert("Dieser Link öffnet ein neues Fenster. Bitte lassen Sie Popups zu!");
	}
}


////**** misc ****////
// hover images
function imgHover(object,value) {
	if(value == true) object.src = object.src.replace(/\.(\w{3})$/, "R.$1");
	if(value == false) object.src = object.src.replace(/R\.(\w{3})$/, ".$1");
}

function imgHoverAZ(object,value) {
	if(value == true) object.src = object.src.replace(/\.(\w{3})$/, "_R.$1");
	if(value == false) object.src = object.src.replace(/_R\.(\w{3})$/, ".$1");
}

// flip boxes
function boxDisplay(id,value) {
	// for selection list only:
	if(value == true) {
		document.getElementById(id).style.display = 'none';
		document.getElementById(id+'R').style.display = '';
		document.cookie = "pg"+portalguid+"."+id+"=true;path=/";
	}
	else if(value == false) {
		document.getElementById(id).style.display = '';
		document.getElementById(id+'R').style.display = 'none';
		document.cookie = "pg"+portalguid+"."+id+"=false;path=/";
	}
}

function boxDisplay2(id,value) {
	// for selection list only:
	if(value == true) {
		document.getElementById(id).style.display = 'none';
		document.getElementById(id+'R').style.display = '';
		document.getElementById(id+'L').className = 'txOrange';
		document.getElementById(id+'LR').className = 'urlCurr';
	}
	else if(value == false) {
		document.getElementById(id).style.display = '';
		document.getElementById(id+'R').style.display = 'none';
		document.getElementById(id+'L').className = 'urlCurr';
		document.getElementById(id+'LR').className = 'txOrange';
	}
}




