var _HTTP_HOST;
var _HTTP_MEDIA;
var _DIR_PICS;
function loadDefinesPhp(httpRoot,mediaPath,picsPath){
	_HTTP_HOST = httpRoot;
	_HTTP_MEDIA = mediaPath;
	_DIR_PICS = picsPath;
}

function setLanguage(newLang){
	var url=_HTTP_HOST + 'ajax.php';
	var myAjax = new Ajax.Request(
			url, 
			{
				method: 'post', 
				parameters: 'actionType=changeLang&newActivLang=' + newLang, 
				onComplete: function(originalRequest){document.location.reload()}
			});
}

var lastSwitchBox;
var lastSwitchPic;
function switchBox(el,pic,header){
	
	if(lastSwitchBox != null) {
		$(lastSwitchBox).setStyle({display:"none"});
		$(lastSwitchPic).src=_HTTP_MEDIA + _DIR_PICS +'arrow_right.gif';
	}
	
	$(el).fade({ 
			   duration: .7, 
			   from: 0, 
			   to: 1, 
			   beforeStart:function(){
				   $(el).setStyle({display:"block"});
				   }, 
			   afterFinish:function(){
				   lastSwitchBox = $(el);
				   lastSwitchPic = $(pic);
				   $(pic).src=_HTTP_MEDIA + _DIR_PICS +"arrow_bottom.gif";
				   
				   } 
			   });
	new Effect.Highlight(header, { startcolor: '#faeac8',endcolor: '#ffffff' });
}

function quickArtist(id){
	var artistVal = $(id).value;
	document.location.href = _HTTP_HOST +"artist/"+ artistVal + ".htm";
	return;
}

function highlightLine(el)
{	
	var oldBgCol = $(el).getStyle('backgroundColor');
	$(el).setStyle({backgroundColor:"#faeac8"});
	$(el).onmouseout = function(){
		$(el).setStyle({backgroundColor:oldBgCol});
	}
}


function sortTable(el){
	rel = $(el).rel;
	//document.location.href=_HTTP_HOST + "tourdates/sort/"+rel+".htm";
	var url=_HTTP_HOST + 'ajax.php';
	var myAjax = new Ajax.Request(
			url, 
			{
				method: 'post', 
				parameters: 'actionType=sort&orderby=' + rel, 
				onComplete: function(originalRequest){
					$('left').innerHTML = originalRequest.responseText;
				}
					
			});
}

function showArtistVid(type,src)
{
	var data0 = $(src).innerHTML;
	var data1 = data0.replace(/<!--/, "");
	var datastr = data1.replace(/-->/, "");
	
	$('vidShowBox').innerHTML = datastr;
	$('vidShowBox').removeClassName('autoVidStyle');
	$('vidShowBox').addClassName('autoVidStyle');
}

function download(file)
{
		window.open(_HTTP_HOST + 'ajax.php?actionType=download&file=' + file,"download","width=10,height=10");
}

function updaterRandomArtist()
{
	var url='ajax.php';
	new Ajax.PeriodicalUpdater('autoresult', url, {
	  method: 'post', frequency: 6, decay: 1,  parameters: { actionType: 'random' },
	   onLoading:function(){
		   $("loader").setStyle({display:"block"});
		   }, 
	   onSuccess:function(){
		   $("loader").setStyle({display:"none"})
		   //new Effect.Highlight('autoresult',{ startcolor: '#ffcd02',endcolor: '#ffffff' });
		   $('autoresult').fade({ duration: .7, from: 0, to: 1 });
		   }

	});

}
