function hidehelp(id) {
	var el = document.getElementById(id);
	if(el) el.innerHTML = "";
}

function trim(value) {
	while(value.charAt((value.length -1))==" "){value = value.substring(0,value.length-1);}
	while(value.charAt(0)==" "){value = value.replace(value.charAt(0),"");}
	while(value.charAt((value.length -1))=="	"){value = value.substring(0,value.length-1);}
	while(value.charAt(0)=="	"){value = value.replace(value.charAt(0),"");}
	return value;
}

function isnumeric(sText) {
	var ValidChars = "0123456789";
	var IsNumber = true;
	var Char;

	if (sText == "") {
		return false;
	}

	for (i = 0; i < sText.length && IsNumber == true; i++) { 
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) {
			IsNumber = false;
		}
	}
	return IsNumber;
}

function emailCheck(emailStr) {
	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars="\[^\\s" + specialChars + "\]"
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom=validChars + '+'
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")

	var matchArray=emailStr.match(emailPat)
	if (matchArray==null) {
		return false
	}
	var user=matchArray[1]
	var domain=matchArray[2]

	// See if "user" is valid 
	if (user.match(userPat)==null) {
		// user is not valid
		return false
	}

	/* if the e-mail address is at an IP address (as opposed to a symbolic
	host name) make sure the IP address is valid. */
	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) {
		// this is an IP address
		for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
				return false;
			}
		}
		return true
	}

	// Domain is symbolic name
	var domainArray=domain.match(domainPat)
	if (domainArray==null) {
		return false
	}

	/* Now we need to break up the domain to get a count of how many atoms
	it consists of. */
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	if (domArr[domArr.length-1].length<2 || 
		domArr[domArr.length-1].length>4) {
	// the address must end in a two letter or three letter word.
		return false
	}

	// Make sure there's a host name preceding the domain.
	if (len<2) {
		var errStr="This address is missing a hostname!"
		return false
	}

	// If we've gotten this far, everything's valid!
	return true
}

function show_agreement() {
	var w = 480, h = 340;
	var popW = 500, popH = 400;

	if (document.all || document.layers) {
		w = screen.availWidth;
		h = screen.availHeight;
	}
	var leftPos = (w-popW)/2;
	var topPos = (h-popH)/2;
	window.open('/eula_popup.asp?standalone=1','generalterms','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width='+popW+',height='+popH+',top=' + topPos + ',left=' + leftPos);
}

function formatnumber(num,decimalNum,bolLeadingZero,bolParens,bolCommas) { 
	if (isNaN(parseInt(num))) return "NaN";

	var tmpNum = num;
	var iSign = num < 0 ? -1 : 1;		// Get sign of number
	
	// Adjust number so only the specified number of numbers after
	// the decimal point are shown.
	tmpNum *= Math.pow(10,decimalNum);
	tmpNum = Math.round(Math.abs(tmpNum))
	tmpNum /= Math.pow(10,decimalNum);
	tmpNum *= iSign;					// Readjust for sign
	
	var mystring = tmpNum + "";
	var arr = mystring.split(".");
	if (arr.length < 2) {
		if (decimalNum > 0) tmpNum = tmpNum + "."
		for (i = 0; i < decimalNum; i++) {
			tmpNum = tmpNum + "0"
		}
	} else {
		for (i = arr[1].length; i < decimalNum; i++) {
			tmpNum = tmpNum + "0"
		}
	}
		
	// Create a string object to do our formatting on
	var tmpNumStr = new String(tmpNum);

	// See if we need to strip out the leading zero or not.
	if (!bolLeadingZero && num < 1 && num > -1 && num != 0)
		if (num > 0)
			tmpNumStr = tmpNumStr.substring(1,tmpNumStr.length);
		else
			tmpNumStr = "-" + tmpNumStr.substring(2,tmpNumStr.length);
		
	// See if we need to put in the commas
	if (bolCommas && (num >= 1000 || num <= -1000)) {
		var iStart = tmpNumStr.indexOf(".");
		if (iStart < 0)
			iStart = tmpNumStr.length;

		iStart -= 3;
		while (iStart >= 1) {
			tmpNumStr = tmpNumStr.substring(0,iStart) + "," + tmpNumStr.substring(iStart,tmpNumStr.length)
			iStart -= 3;
		}		
	}

	// See if we need to use parenthesis
	if (bolParens && num < 0)
		tmpNumStr = "(" + tmpNumStr.substring(1,tmpNumStr.length) + ")";

	return tmpNumStr;		// Return our formatted string!
}

function replaceChars(entry, from, to) {
	var temp = "" + entry;
	var pos;

	while (temp.indexOf(from)>-1) {
		pos = temp.indexOf(from);
		temp = "" + (temp.substring(0, pos) + to + temp.substring((pos + from.length), temp.length));
	}
	return temp;
}

function getCookieValue(o){
	var dc = document.cookie;
	var e = dc.indexOf(';',o);
	if(e==-1)
		e=dc.length;
	return dc.substring(o,e);
}

function getCookie(n) {
	var dc = document.cookie //replacestring(document.cookie,"%5F","_");
	var a = replacestring(n,"_","%5F") + '=';
	//var a = n + '=';
	var b = a.length;
	var l = dc.length;
	var i = 0;
	while(i< l){
		var j=i+b;
		if(dc.substring(i,j)==a){
			return getCookieValue(j)
		}
		i = dc.indexOf(' ',i) + 1;
		if(i==0)
			break;
	}
	return null;
}

// this function gets the cookie, if it exists
function getCookieByName(name) {
	var start = document.cookie.indexOf(name + "=");
	var len = start + name.length + 1;
	if ((!start) && (name != document.cookie.substring(0, name.length))) {
		return null;
	}
	if (start == -1) return null;
	var end = document.cookie.indexOf(";", len);
	if (end == -1) end = document.cookie.length;
	return unescape(document.cookie.substring(len, end));
}
	
// this deletes the cookie when called
function deleteCookie(name, path, domain) {
	if (getCookieByName(name))
		document.cookie = name + "=" + ((path) ? ";path=" + path : "") + ((domain) ? ";domain=" + domain : "") + ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = replacestring(name,"_","%5F") + '=' + escape(value);
	curCookie = curCookie + ((expires) ? '; expires=' + expires.toGMTString() : '');
	curCookie = curCookie + ((path) ? '; path=' + path : '');
	curCookie = curCookie + ((domain) ? '; domain=' + domain : '')
	curCookie = curCookie + ((secure) ? '; secure' : '');
	
	document.cookie = curCookie;
}

function handlePageKey(evt) {
	if (document.getElementById&&!document.all) {
		if (document.layers) {
			this.altKey = ((evt.modifiers & Event.ALT_MASK) > 0);
			this.ctrlKey = ((evt.modifiers & Event.CONTROL_MASK) > 0);
			this.shiftKey = ((evt.modifiers & Event.SHIFT_MASK) > 0);
		} else {
			this.altKey = evt.altKey;
			this.ctrlKey = evt.ctrlKey;
		}
		// Internet Explorer
	} else {
		this.altKey = evt.altKey;
		this.ctrlKey = evt.ctrlKey;
	}
	
	this.keyCode = evt.keyCode //|| evt.which;
	//	alert(this.keyCode);

	/* Afhandelen van multimedia toetsen */
	if (top.document.prefs_player_usemultimediabuttons == '1') {
		if ((this.altKey) && (this.ctrlKey)) {
			if (this.keyCode == 36)
				top.pressPlay();
			if (this.keyCode == 45)
				top.pressPlay();
			if (this.keyCode == 33)
				top.playerPrev();
			if (this.keyCode == 34)
				top.playerNext(1);
		}
		if (this.keyCode == 179) // Play button
			top.pressPlay();
		if (this.keyCode == 178) // Stop button
			top.pressPlay();
		if (this.keyCode == 177) // Prev Button
			top.playerPrev();
		if (this.keyCode == 176) // Next Button
			top.playerNext(1);
	}
	
	if (this.keyCode == 116 && this.Keycode != 84) {
	//	Only refresh the frame, not the complete page!
	//	self.location=self.location.href;
		if(top.content)
			top.content.location.reload();

		if (evt.preventDefault) {
			//Mozilla
			evt.preventDefault();
			evt.stopPropagation();
			evt.preventBubble();
		} else {
			//IE
			evt.keyCode = 0;
			evt.returnValue = false;
		}
		return false;
	}
}

function pageKeyHandler() {
	var evType = (document.addEventListener) ? 'keypress' : 'keydown';

	if (document.addEventListener) {
		document.addEventListener(evType, handlePageKey, false);
	} else if (document.attachEvent) {
		var r = document.attachEvent("on" + evType, handlePageKey);
	}
}


var calculatingHeight = false;
function calcHeight() {
	if (calculatingHeight) return;
	calculatingHeight = true;

	var content = top.document.getElementById('content');
	if(!content) return;
	// force scrollbars temporarily
	content.height = 100;
	// find the height of the internal page
	var the_height = content.contentWindow.document.body.scrollHeight;
	// change the height of the iframe
	content.height = the_height;

	calculatingHeight = false;
}

function resizeContent() {
	var content = top.document.getElementById('content');
	if(!content) return;
	// find the height of the internal page
	var the_height = content.contentWindow.document.body.scrollHeight;
	// change the height of the iframe
	content.height = the_height;
}

function left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}

function setMenuItem(id, val) {
	var menu_cookie = getCookie('menu');
	if(menu_cookie==null)
		menu_cookie = '11111111';
	else
		menu_cookie = right('11111111' + menu_cookie, 8);

	if(id=='ul_catalogus') 
		menu_cookie = menu_cookie.substring(0, menu_cookie.length - 1) + val;
	else if(id=='ul_mymusic')
		menu_cookie = menu_cookie.substring(0, menu_cookie.length - 2) + val + menu_cookie.substring(menu_cookie.length - 1);
	else if(id=='ul_update')
		menu_cookie = menu_cookie.substring(0, menu_cookie.length - 3) + val + menu_cookie.substring(menu_cookie.length - 2);
	else if(id=='ul_myaccount')
		menu_cookie = menu_cookie.substring(0, menu_cookie.length - 4) + val + menu_cookie.substring(menu_cookie.length - 3);
	else if(id=='ul_aanmelden')
		menu_cookie = menu_cookie.substring(0, menu_cookie.length - 5) + val + menu_cookie.substring(menu_cookie.length - 4);

	var d = new Date();
	d = YearAdd(d, 1);
	setCookie('menu', menu_cookie, d);
//	alert(menu_cookie + '[' + menu_cookie.length + ']');
//	var tmpcookie = getCookie('menu');
//	alert(tmpcookie + '[' + tmpcookie.length + ']');
}

function menu_toggleItem(item, ul_id) {
	ul = document.getElementById(ul_id);
	if (item.className=='open') {
		item.className='closed';
		if (ul) ul.className='hidden';
		setMenuItem(ul_id,0);
	} else {
		item.className='open';
		if (ul) ul.className='';
		setMenuItem(ul_id,1);
	}
	try {
		//of dit... (knippert niet, maar doet wel groter, niet kleiner)
		resizeContent();
	} catch(e) {
	}
	// Zorgt ervoor dat de focus rectangle weer verdwijnt na het klikken
	item.blur();
}


if(getCookie('di')=='0') {
	el1 = top.document.getElementById('debug_info');
	el2 = top.document.getElementById('debug_tracktitle');
	try {
		if(el1) el1.style.display = 'none';
		if(el2) el2.style.display = 'none';
	} catch (e) {
	}
}
function toggleDebugInfo(item) {
	var d = new Date(); d = YearAdd(d, 1);
	el1 = top.document.getElementById('debug_info');
	el2 = top.document.getElementById('debug_tracktitle');
	try {
		if (el1.style.display != 'none') { el1.style.display='none'; setCookie('di',0,d); } else { el1.style.display='block'; setCookie('di',1,d); }
		if (el2.style.display != 'none') el2.style.display='none'; else el2.style.display='block';
	} catch (e) {
	}
	if(item) item.blur();
}

function DateAdd(startDate, numDays, numMonths, numYears) {
	var returnDate = new Date(startDate.getTime());
	var yearsToAdd = numYears; 
	var month = returnDate.getMonth() + numMonths;

	if (month > 11) {
		yearsToAdd = Math.floor((month+1)/12);
		month -= 12*yearsToAdd;
		yearsToAdd += numYears;
	}
	returnDate.setMonth(month);
	returnDate.setFullYear(returnDate.getFullYear() + yearsToAdd); 
	returnDate.setTime(returnDate.getTime()+60000*60*24*numDays); 

	return returnDate;
}
function YearAdd(startDate, numYears) {
	return DateAdd(startDate,0,0,numYears);
}
function MonthAdd(startDate, numMonths) {
	return DateAdd(startDate,0,numMonths,0);
}
function DayAdd(startDate, numDays) {
	return DateAdd(startDate,numDays,0,0);
}

function replacestring(string,text,by){
	var strLength = string.length, txtLength = text.length;
	if ((strLength == 0) || (txtLength == 0)) {return string;};
	var i = string.indexOf(text);
	if ((!i) && (text != string.substring(0,txtLength))) {return string;};
	if (i == -1) {return string;};
	var newstr = string.substring(0,i) + by;
	if (i+txtLength < strLength) {newstr += replacestring(string.substring(i+txtLength,strLength),text,by);};return newstr;
}

// Function to fix actioncode
function fixActionCode(actionCode) {
	var code = actionCode.toUpperCase();
//	Strip unwanted characters
	code = code.replace(/ /g, '');
	code = code.replace(/_/g, '');
	code = code.replace(/-/g, '');
//	Return fixed code
	return code;
}

// Checks 'bank/giro' number
function checkAccountNr(val, debugmode) {
//	Extra check for bogus account numbers...
	if (debugmode != '1') {
		var invalid_vals = new Array("000000000", "111111111", "222222222", "333333333", "444444444", "555555555", "666666666", "777777777", "888888888", "999999999");
		for (i = 0; i < invalid_vals.length; i++)
			if (invalid_vals[i] == val)
				return false;
	}
			
//	"Normal check..." (11 proef)
	val = val.replace(/[^\d\.]/g,'');
	c = val.replace(/\D/g,'').split('');
	a = c.length;
	e = 0;
	if (a == 9)
		for (var i = 0; i < 9; i++)
			e += (9 - i) * c[i];
	if(a < 6 || a == 8 || e % 11 != 0 || a > 9)
		return false;
	
	return true;
}

function helpmovie(name, width, height) {
	window.open('helpmovie.asp?name='+escape(name),'helpmovie','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width='+width+',height='+height+',left='+eval((screen.availWidth/2)-(width/2))+',top=50');
}

var user_agent	= navigator.userAgent.toLowerCase();
var is_ie		= ((user_agent.indexOf("msie") != -1) && (user_agent.indexOf("opera") == -1));
var is_ie7up	= (is_ie && (user_agent.indexOf("msie 7") != -1));

var genres_id;
var genres_visible = 0;
var genres_height = 0;
function selectGenres() {
	if (el = document.getElementById('genre_container')) {
		if (genres_visible == 0) {
			/*
			el.style.display = 'block';
			genres_visible = 1;
			*/
			genres_id = setTimeout('displayGenres()', 10);
		} else {
			genres_height = 0;
			changeOpac(0, "genre_list");
			if (l = document.getElementById("genre_list")) {
				l.style.display = 'none';
			}
			el.style.height = genres_height + 'px';
			genres_visible = 0;
		}
	}
}

function displayGenres() {
	if (el = document.getElementById('genre_container')) {
		if (genres_height < 125) {
			genres_height = genres_height + 25;
			el.style.height = genres_height + 'px';
			genres_id = setTimeout('displayGenres()', 10);
		} else {
			el.style.height = '126px';
			if (is_ie) {
				changeOpac(100, "genre_list");
			} else {
				opacity("genre_list", 0, 100, 50, "");
			}
			if (l = document.getElementById("genre_list")) {
				l.style.display = 'block';
			}
			clearTimeout(genres_id);
			genres_visible = 1;
		}
	} else {
		clearTimeout(genres_id);
	}
}

function selectGenre(genreId) {
	if (genreId >= -2) {
		document.location.href='main.asp?action=catalog_albums&subaction=more&genreid=-1';
	}
	if (el = document.getElementById('genre_container')) {
		el.style.display = 'none';
		genres_visible = 0;
	}
}

var abc_id;
var abc_visible = 0;
var abc_height = 0;

function selectAbc() {
	if (el = document.getElementById('abc_container')) {
		if (abc_visible == 0) {
			abc_id = setTimeout('displayAbc()', 10);
		} else {
			abc_height = 0;
			changeOpac(0, "abc_list");
			if (l = document.getElementById("abc_list")) {
				l.style.display = 'none';
			}
			el.style.height = abc_height + 'px';
			abc_visible = 0;
		}
	}
}

function displayAbc() {
	if (el = document.getElementById('abc_container')) {
		if (abc_height < 20) {
			abc_height = abc_height + 5;
			el.style.height = abc_height + 'px';
			genres_id = setTimeout('displayAbc()', 10);
		} else {
			el.style.height = '21px';
			if (is_ie) {
				changeOpac(100, "abc_list");
			} else {
				opacity("abc_list", 0, 100, 50, "");
			}
			if (l = document.getElementById("abc_list")) {
				l.style.display = 'block';
			}
			clearTimeout(abc_id);
			abc_visible = 1;
		}
	} else {
		clearTimeout(abc_id);
	}
}

function writeFlash(url, width, height) {
	if (url == "") return;

	var html = "";
	html = html + "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='" + width + "' height='" + height + "' align='middle'>"
	html = html + "	<param name='allowScriptAccess' value='sameDomain' />"
	html = html + "	<param name='movie' value='" + url + "' />"
	html = html + "	<param name='quality' value='best' /><param name='bgcolor' value='#ffffff' />"
	html = html + "	<param name='wmode' value='opaque' />"
	html = html + "	<embed src='" + url + "' quality='best' bgcolor='#ffffff' width='" + width + "' height='" + height + "' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' wmode='transparent' />"
	html = html + "</object>"
	document.write(html); 
}

var dlg_id = -1;
var dlg_skiplink = false;
var opacity_start = 0;
var opacity_end = 100;
function showDlg(txt, linktext, linkurl, productId, fastclose) {
	//closeDlg(0);
	clearTimeout(dlg_id);
	if (el = document.getElementById("dlg_container")) {
		/* Event handlers */
		el.onclick = function() {
			if (dlg_skiplink) {
				dlg_skiplink = false;
			} else {
				if (linkurl != "") top.content.location.href = linkurl;
			}
			closeDlg(0);
		}
		el.onmouseout = resetDlg;
		el.onmouseover = holdDlg;
		/* Styles */
		el.style.display = 'inline';
		el.style.top = document.body.scrollTop + 150;
		/* Message text */
		if (el_msg = document.getElementById("dlg_content")) el_msg.innerHTML = txt;
		/* (Optional) link */
		if (linktext != '') {
			if (el_link = document.getElementById("dlg_link")) {
				//html = '<a href="#" onclick="top.content.location.href=\'' + linkurl + '\';closeDlg(0);return false;">' + linktext + '</a>';
				html = "<a href='#' onclick='return false;'>" + linktext + "</a>";
				el_link.innerHTML = html;
			}
		}
		/* Cover image */
		if (productId != '') {
			if (el_cover = document.getElementById("dlg_cover")) {
				if (productId == -1) {
					el_cover.innerHTML = "<img src='/images/_ajax_loader_login.gif' alt='' height='35' width='35' style='background: #fff;' />";
				} else {
					el_cover.innerHTML = "<img src='http://89.184.166.90/content/music/albumcovers/35x35/" + productId + ".jpg' alt='' height='35' width='35' />";
				}
			}
		}

		// Keep it simple for IE6... almost chokes on fading in and out...		
		if (is_ie && (!is_ie7up)) {
			changeOpac(100, "dlg_container");
			dlg_id = setTimeout("changeOpac(0,'dlg_container')", 3000);
		} else {
			/* Start fade in */
			opacity("dlg_container", opacity_start, opacity_end, 250, "showHideElement('dlg_container',1)");
			/* Start fade out timer */
			if (fastclose) {
				dlg_id = setTimeout("closeDlg(1)", 1500);
			} else {
				dlg_id = setTimeout("closeDlg(1)", 3000);
			}
		}
	}
}

function closeDlg(fadeOut) {
	if (fadeOut == 1) {
		opacity("dlg_container", opacity_end, opacity_start, 500, "showHideElement('dlg_container',0)")
	} else {
		opacity("dlg_container", opacity_end, opacity_start, 100, "showHideElement('dlg_container',0)")
	}
}

function holdDlg() {
	clearTimeout(dlg_id);
	//opacity('dlg_container', opacity_between, opacity_end, 25);
}

function resetDlg() {
	//opacity('dlg_container', opacity_end, opacity_between, 1);
	dlg_id = setTimeout("closeDlg(0)", 1500);
}

function SetMyBasketClassName(className) {
	if (doc = top.document.getElementById("content").contentWindow.document) {
		if (el = doc.getElementById("mybasket_link")) {
			el.className = className;
		}
	}
}

function zoomOff() {
	clearTimeout(document.cover_timerId);
	var el = document.getElementById('cover_zoom');
	if(!el) return;
	el.style.display = 'none';
	el.innerHTML = "";
}

function gotoAlbum() {
	zoomOff();
	var aid = top.getcurrentplayervalue('albumproductid');
	//if (aid != 0) {
	if (aid) {
		url = 'main.asp?action=showalbum&aid=' + aid;
		top.document.getElementById('content').src = url;
	}
}

var expanded = 0;
var timerId;

function togglePlaylist(offset) {
	if (pl = top.document.getElementById('playlist_expanded')) {
		if (expanded == 0) {
			setBackground('playlist_expanded_tracks', 'url(/images/_ajax_loader_exp.gif)');
			plh = document.getElementById('playlist_expanded_header');
			if (plh) plh.innerHTML = 'Een ogenblik geduld...';
			pl.style.display = 'block';
			top.ajaxCall('action:player_get_expanded_playlist', 'offset:'+offset);
			expanded = 1;

			if (doc = top.document.getElementById('player').contentWindow.document)
				if (mb = doc.getElementById('Messagebar'))
					mb.style.display = 'none';
		} else {
			pl.style.display = 'none';
			plh = top.document.getElementById('playlist_expanded_placeholder');
			if (plh) plh.innerHTML = '';
			expanded = 0;

			if (doc = top.document.getElementById('player').contentWindow.document)
				if (mb = doc.getElementById('Messagebar'))
					mb.style.display = 'block';
		}
	}
}

function closePlaylist() {
	expanded = 1;
	togglePlaylist();
}

function startTimer(timeout) {
	timerId = setTimeout('closePlaylist()', timeout);
}

function resetTimer() {
	clearTimeout(timerId);
}

function doScroll(pos) {
	var tracks = document.getElementById('playlist_expanded_tracks');
	if (!tracks) return;
	if (pos > 0)
		tracks.scrollTop = pos;
}

function setBackground(id, url) {
	if (url == '') return;
	if (el = document.getElementById(id)) {
		el.style.backgroundImage = url;
	}
}

function popup_FadeIn() {
	try {
		popup_Open();
		opacity('popup_content', 0, 100, 100, '');
		opacity('popup_container', 0, 65, 100, '');
	} catch (ex) {
	}
}

function popup_FadeOut() {
	try {
		opacity('popup_content', 100, 0, 150, popup_Close);
		opacity('popup_container', 75, 0, 150, '');
	} catch (ex) {
		popup_Close();
	}
}

function popup_Open() {
	showHideElement('popup_content', true);
	showHideElement('popup_container', true);
}

function popup_Close() {
	showHideElement('popup_content', false);
	showHideElement('popup_container', false);
}