/**
 * @created 8.06.2006
 * @author Oliver Lillie
 * @email publicmail@buggedcom.co.uk
 */
function loadVideoPlayer(holder_id, load_into_id, flv, colour)
	{
		Effect.Fade(holder_id, {
			afterFinish:function()
			{
				$(load_into_id).innerHTML = 'Sorry. Your Flash Player needs to be updated to Flash Player 8. Update by clicking <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">here</a>.';
				var so = new SWFObject('http://www.lilchris.co.uk/flash/flvplayer_mobblog.swf', 'nav', '370', '295', '8', 'FFFFFF');
				so.addVariable('baseURL', 'http://www.lilchris.co.uk/');
				so.addVariable('flv', flv);
				so.write(load_into_id);
			}
		});
	};
	function loadAudioPlayer(load_into_id, file)
	{
		$(load_into_id).innerHTML = 'Sorry. Your Flash Player needs to be updated to Flash Player 8. Update by clicking <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">here</a>.';
		var so = new SWFObject('http://www.lilchris.co.uk/flash/singlemp3player.swf', 'nav', '100%', '18', '8');
		so.addVariable('repeatPlay', 'false');
		so.addVariable('autoStart', 'false');
		so.addVariable('file', file);
		so.write(load_into_id);
	};
	function retartgetAnchors()
	{
		var anchors = document.getElementsByTagName('a');
		// loop through all anchor tags
		for (var i=0; i<anchors.length; i++)
		{
			var anchor = anchors[i];
			var relAttribute = String(anchor.getAttribute('rel'));
			if (anchor.getAttribute('href'))
			{
				var href = anchor.getAttribute('href');
				if(href.indexOf('http') != -1)
				{
					if(href.indexOf('http://www.lilchris.co.uk/') == -1)
					{
						anchor.target = '_blank';
					}
				}
			}
		}
	};
	function lightboxEventOpen()
	{
		Element.setStyle('flashmenu', {visibility:'hidden'});
	};
	function lightboxEventClose()
	{
		Element.setStyle('flashmenu', {visibility:'visible'});
	};
	function launchMediaPlayer(url)
	{
		myRef = window.open(url, 'mediaplayer', 'left=20,top=20,width=400,height=470,toolbar=0,resizable=0');
	};
	function playMedia(win)
	{
		var value = null;
		var r = document.forms.selector.media_type;
		for(var i=0; i<r.length; i++) 
		{ 
			if(r[i].checked) 
			{
				value = r[i].id;
				break;
			}
		}
		if(value == null)
		{
			alert('Please make a selection from the available media types.');
			return;
		}
		Effect.Fade('selection', {afterFinish:function()
		{
			var src = $(value+'_src').value;
			var type;
			var params;
			var ua = navigator.userAgent.toLowerCase();
			switch(value)
			{
				case 'wm_hi' :
				case 'wm_low' :
					var h = height+23;
					if(ua.indexOf('win') !== -1)
					{
						if(ua.indexOf('msie') !== -1)
						{
							h += 61;
						}
						else if(ua.indexOf('firefox') !== -1)
						{
							h += 40;
						}
					}
					else
					{
						if(ua.indexOf('firefox') !== -1)
						{
							h -= 5;
						}					
					}
					window.resizeTo(width, h);
					type = 'WindowsMediaPlayer';
					params = {
						autostart:'1',
						showstatusbar:'1',
						controller:'1'
					};
					break;
				case 'real_hi' :
				case 'real_low' :
					var h = height+50;
					if(ua.indexOf('win') !== -1)
					{
						if(ua.indexOf('msie') !== -1)
						{
							h += 61;
						}
						else if(ua.indexOf('firefox') !== -1)
						{
							h += 40;
						}
					}
					else
					{
						if(ua.indexOf('firefox') !== -1)
						{
							h -= 5;
						}					
					}
					type = 'RealPlayer';
					params = {
						controls:'ImageWindow,All',
    					console:'_master'					
					};
					window.resizeTo(width, h);
					height += 27;
					break;
				case 'quicktime_hi' :
				case 'quicktime_low' :
					window.resizeTo(width, height+23);
					type = 'Quicktime';
					params = {
						target:'myself',
						scale:'true',
						controller:'true',
						enablejavascsript:'true'
					};
					break;
			}
			var plugin = new PluginObject(type, src, "hellokitty", width, height);
			plugin.addParams(params);
			plugin.write("video");
		}});
	};
	function setRadioFromLabel (id)
	{
		var input = document.getElementById(id);
		if(input.type == 'checkbox')
		{
			input.checked = !input.checked;
		}
		else
		{
			input.checked = true;
		}
	};
	function fetchAjaxNews(id)
	{
		new Ajax.Updater('story-panel', 'http://www.lilchris.co.uk/ajax/news/story/', {
			method:'post',
			postBody:'id='+id
		});
	};
	function fetchAjaxMobblog(id)
	{
		new Ajax.Updater('story-panel', 'http://www.lilchris.co.uk/ajax/mobblog/story/', {
			evalScripts:true,
			method:'post',
			postBody:'id='+id
		});
	};
	function fetchAjaxBlog(id)
	{
		new Ajax.Updater('BLOG-entry', 'http://www.lilchris.co.uk/ajax/blog/post/', {
			method:'post',
			postBody:'id='+id
		});
	};
	function fetchAjaxNewsList(page, per)
	{
		new Ajax.Updater('story-list', 'http://www.lilchris.co.uk/ajax/news/list/', {
			method:'post',
			postBody:'page='+page+'&per='+per
		});
	};
	function fetchAjaxBlogList(page, per)
	{
		new Ajax.Updater('story-list', 'http://www.lilchris.co.uk/ajax/blog/list/', {
			method:'post',
			postBody:'page='+page+'&per='+per
		});
	};
	function fetchAjaxMobblogList(page, per)
	{
		new Ajax.Updater('story-list', 'http://www.lilchris.co.uk/ajax/mobblog/list/', {
			method:'post',
			postBody:'page='+page+'&per='+per
		});
	};
	function fetchAjaxTour(id, type)
	{
		new Ajax.Updater('story-panel', 'http://www.lilchris.co.uk/ajax/tour/story/', {
			method:'post',
			postBody:'id='+id+'&pagetype='+type
		});
	};
	function fetchAjaxTourList(page, type, target, per)
	{
		new Ajax.Updater(target, 'http://www.lilchris.co.uk/ajax/tour/list/', {
			method:'post',
			postBody:'page='+page+'&per='+per+'&pagetype='+type
		});
	};
	function fetchAjaxGallery(type)
	{
		new Ajax.Updater('GALLERY-LIST', 'http://www.lilchris.co.uk/ajax/gallery/', {
			method:'post',
			postBody:'type='+type
		});
	};