function doOnload() {
	getCart();
	if (window.doOnload_extended)
		doOnload_extended();
}
function bt(id) {//browse type
	window.location.href='index.cfm?x=browseType&ID='+id;
}
function lov(tr) {
	tr.style.backgroundColor='#EEE';
}
function lot(tr) {
	tr.style.backgroundColor='';
}
function doSubscribe(doIt) {
	theForm=document.formSubscribe;
	if (theForm.completeEmail.value != '') {
		if (isValid('email',theForm.completeEmail.value)) {
			if (doIt) {
				theForm.subscribe.value='true';
				theForm.submit();
			} else {
				theForm.unsubscribe.value='true';
				theForm.submit();
			}
		} else {
			alert(txtEmailAddressInvalid);
		}
	}
}
function emptyCart() {
	if (confirm(txtReallyEmptyCart)) {
		var url='ajax/cart.cfm?act=emptyCart';
		loadXML('cart',url,'text');
	}
}
function removeItem(crtId) {
	var url='ajax/cart.cfm?act=remove&crtId='+crtId;
	loadXML('cart',url,'text');
}
function submitLogin(theButton) {
	theForm=document.formLogin;
	switch (theButton) {
		case 'login':
			if (theForm.CST_str_Email.value.length > 7 && theForm.CST_str_Password.value.length > 5) {
				theForm.loginRequest.value='true';
				theForm.submit();
			}
		break;
		case 'register':
			theForm.submit();
		break;
	}
}
function doForgot() {
	theForm=document.formLogin;
	if (theForm.CST_str_Email.value.length > 7) {
		theForm.forgot.value='true';
		theForm.submit();
	} else {
		alert(txtPleaseEnterYourEmail);
	}
}
function handleEnter(event) {
	var keyCode=event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if (keyCode == 13)
		submitLogin('login');
}      
function doMenu(o) {
	var label=o.id.split('_')[1];
	switch (label) {
		case 'account':
		case 'newsletter':
		case 'cart':
		case 'items':
		case 'categories':
			var isOn=(o.className.split('_').length == 2);
			setMenuItem(label,!isOn);
		break;
		case 'page':
			window.location.href='index.cfm?x=page&ID='+o.id.split('_')[2];
		break;
	}
	//possible inactivation of other menu items
	switch (label) {
		case 'items':
			setMenuItem('categories',false);
		break;
		case 'categories':
			setMenuItem('items',false);
		break;
	}
}
function setMenuItem(label,toOn) {
	var newMiClass=(toOn)?'mi_on':'mi';
	var newItemBgName=(toOn)?label+'_on':label;
	o=get_object('mi_'+label);
	o.style.backgroundImage='url(mg'+lg+'/'+newItemBgName+'.png)';
	o.className=newMiClass;
	get_object('mc_'+label).style.display=(toOn)?'block':'none';
}
function doBrowse(label,id) {
	window.location.href='index.cfm?x=browse'+label+'&ID='+id;
}
function onMenuLink(o,act) {
	switch (act) {
		case 'over':
			o.className='ml_over';
		break;
		case 'out':
			o.className='ml';
		break;
	}
}
function getCart() {
	var url='ajax/cart.cfm';
	loadXML('cart',url,'text');
}
function buy(itmId,sbtId) {
	var url='ajax/cart.cfm?act=add&itmId='+itmId;
	if (sbtId)
		url+='&sbtId='+sbtId;
//	trace(url);
	loadXML('cart',url,'text');
}
function popXML_cart(response) {
	var content=trim(response);
	var itemCount=parseInt(content.split('*')[0]);
	var message=content.split('*')[1];
	if (message != 'none')
		alert(message);
	var cartContent=content.split('*')[2];
	get_object('cartContent').innerHTML=cartContent;
	get_object('cartButtons').style.display=(itemCount == 0)?'none':'block';
}
function atw(itmId) {//add to wishlist
	var url='ajax/wishlist.cfm?act=add&itmId='+itmId;
	loadXML('wishlist',url,'text');
}
function popXML_wishlist(response) {
	alert(trim(response));
}
function doSearch() {
	var theForm=document.searchForm;
	if (checkSearch())
		theForm.submit();
}
function checkSearch() {
	var theForm=document.searchForm;
	if (theForm.searchPhrase.value.length < 2) {
		return false;
	} else {
		theForm.x.value=(theForm.searchIndex.options[theForm.searchIndex.selectedIndex].value == '2')?'searchArtist':'browseSearch';
		return true;
	}
}
function doChangeLanguage(lid) {
	/*
	var mainFrameHref=parent.mainFrame.location.href;
	var newlidURLVar="newlid=";
	var newlidPos=mainFrameHref.indexOf(newlidURLVar);
	if (newlidPos > -1)
		parent.mainFrame.location.href=mainFrameHref.slice(0,newlidPos)+'newlid='+lid;
	else if (mainFrameHref.indexOf('?') == -1)
		parent.mainFrame.location.href=mainFrameHref+'?newlid='+lid;
	else
		parent.mainFrame.location.href=mainFrameHref+'&newlid='+lid;
	*/
	window.location.href='index.cfm?newlid='+lid;
}


