function addRep(user)
{
	var myHTMLRequest = new Request.HTML({url:'http://www.livingelectro.com/forum/addRep.php?user='+user, onSuccess: function(a, b, html) {
																						  if( html != "bad" && html != "you"){ alert('Thank you for giving me rep.'); $('rep'+user).innerHTML = html}else if(html == "you"){alert('You cannot give yourself rep.')}else{ alert('You already gave the max rep for today.');}; return true;}});
	myHTMLRequest.send();	
}
function sendShout(el)
{
	if(el.getPrevious('input').getProperty('value').length > 0)
	{
		new Request.HTML({
			evalScripts: true,
			evalResponse: false,
			url: 'shoutpage.php',
			data: 'msg='+el.getPrevious('input').getProperty('value'),
			onRequest: function()
			{
				$('shouthideonload').setStyle('display','none');
				$('shoutboxloeader').setStyle('display','block');
			},
			onSuccess: function(html)
			{
				$('shoutboxcontload').set('html', this.response.text); 
				$('shouthideonload').setStyle('display','block');
				$('shoutboxloeader').setStyle('display','none');
				el.getPrevious('input').setProperty('value', '');
			}
		}).post();
	}
}
function getShouts()
{
	new Request.HTML({
		evalScripts: true,
		evalResponse: false,
		url: '/shoutpage.php',
		onSuccess: function(html)
		{
			$('shoutboxcontload').set('html', this.response.text); 
			new Fx.Scroll($('shoutboxcontload'),{duration:0}).toBottom();
		}
	}).get();
}





function sendShout2(el)
{
	if(el.getPrevious('input').getProperty('value').length > 0)
	{
		new Request.HTML({
			evalScripts: true,
			evalResponse: false,
			url: 'shoutpagevip.php',
			data: 'msg='+el.getPrevious('input').getProperty('value'),
			onRequest: function()
			{
				$('shoutboxcontload2').setStyle('display','none');
				$('shoutboxloeader').setStyle('display','block');
			},
			onSuccess: function(html)
			{
				$('shoutboxcontload2').set('html', this.response.text); 
				$('shoutboxcontload2').setStyle('display','block');
				$('shoutboxloeader').setStyle('display','none');
				el.getPrevious('input').setProperty('value', '');
			}
		}).post();
	}
}
function getShouts2()
{
	new Request.HTML({
		evalScripts: true,
		evalResponse: false,
		url: '/shoutpagevip.php',
		onSuccess: function(html)
		{
			$('shoutboxcontload2').set('html', this.response.text); 
			new Fx.Scroll($('shoutboxcontload2'),{duration:0}).toBottom();
		}
	}).get();
}

function sendShout3(el)
{
	if(el.getPrevious('input').getProperty('value').length > 0)
	{
		new Request.HTML({
			evalScripts: true,
			evalResponse: false,
			url: 'shoutpagetv.php',
			data: 'msg='+el.getPrevious('input').getProperty('value'),
			onRequest: function()
			{
				$('shouthideonload3').setStyle('display','none');
				$('shoutboxloeader3').setStyle('display','block');
			},
			onSuccess: function(html)
			{
				$('shoutboxcontload3').set('html', this.response.text); 
				$('shouthideonload3').setStyle('display','block');
				$('shoutboxloeader3').setStyle('display','none');
				el.getPrevious('input').setProperty('value', '');
			}
		}).post();
	}
}
function getShouts3()
{
	new Request.HTML({
		evalScripts: true,
		evalResponse: false,
		url: '/shoutpagetv.php',
		onSuccess: function(html)
		{
			$('shoutboxcontload3').set('html', this.response.text); 
			new Fx.Scroll($('shoutboxcontload3'),{duration:0}).toBottom();
		}
	}).get();
}




function addToPlaylist(id, el)
{
	new Request.HTML({
		evalScripts: false,
		evalResponse: false,
		url: '/shoutpage.php',
		data: 'songid='+id,
		onSuccess: function(html)
		{
			el.destroy();
		}
	}).post();
}
function loadTops(loaderid, category, what)
{
	new Request.HTML({
		evalScripts: true,
		evalResponse: false,
		url: 'top15.php',
		data: 'category='+category+'&whatfor='+what,
		onSuccess: function(html)
		{
			$(loaderid).set('html', this.response.text);
		}
	}).post();
}
window.addEvent('domready', function(){
	if($('shoutboxcontload')){var shout_periodical = getShouts.periodical(20000);new Fx.Scroll($('shoutboxcontload'),{duration:0}).toBottom();

	}
	
	if($('shoutboxcontload2')){var shout_periodical = getShouts2.periodical(20000);new Fx.Scroll($('shoutboxcontload2'),{duration:0}).toBottom();
	
	}

	if($('shoutboxcontload3')){var shout_periodical = getShouts3.periodical(20000);new Fx.Scroll($('shoutboxcontload3'),{duration:0}).toBottom();
	
	}
	if($('smsg'))
	{
		$('smsg').addEvent('keypress', function(e)
		{
			var el = this;
			if(e.key === 'enter')
			{
				if(!$('shoutboxcontload2')){sendShout(el.getNext('img'));}else{sendShout2(el.getNext('img'));}
			}
		});
	}
	if($('loginformform')){$('loginformform').addEvent('submit', function(e){
		e.stop();
		var el = $('loginformform');
		new Request.HTML({
			evalScripts: true,
			noCache: true,
			evalResponse: false,
			url: 'http://www.livingelectro.com/php/login.php',
			data: el.toQueryString(),
			onSuccess: function(html)
			{
				if(this.response.text === '1')
				{
					location.reload(true);
				}
				else
				{
					alert('Login info incorrect, please try again.');
				}
			}
		}).post();
	});}
	
	if($('innernav')){
		$('innernav').getElements('a').each(function(el){
			el.addEvent('mouseenter', function(){
				var getimg = this.getElement('img');
				var srcis = getimg.getProperty('src');
				var strlen = srcis.length;
				if(srcis.substr(strlen-7) === 'off.png')
				{
					getimg.setProperty('src', srcis.substr(0,strlen-7)+'on.png');
				}
			});
			
			el.addEvent('mouseleave', function(){
				var getimg = this.getElement('img');
				var srcis = getimg.getProperty('src');
				var strlen = srcis.length;
				if(srcis.substr(strlen-6) === 'on.png')
				{
					getimg.setProperty('src', srcis.substr(0,strlen-6)+'off.png');
				}
			});
		});
	}
});
window.addEvent('load', function(){
		if($('shoutboxcontload')){new Fx.Scroll($('shoutboxcontload'),{duration:0}).toBottom();}
		
});
