
var request = false;

	//XMLHTTPRequest for various browsers
	try 
	{
		//e.g. Firefox
		request = new XMLHttpRequest();
	} 
	catch(error1) 
	{
		try 
		{
			// some versions IE
			request = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch(error2) 
		{
			try 
			{
				// some versions IE 
				request = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(error3) 
			{
				request = false;
			} 
		} 
	}
	/////////////////////////////

if (!request)
 alert("Error initializing XMLHttpRequest!");
  
	function show_content_final(response)
	{  
		//get element from doc
		var content = document.getElementById("archive_content");
		var loading = document.getElementById("archive_loader")
		
		if (response == "null")
		{
			loading.style.display = "block"
			content.style.display = "none"
		}
		else
		{
			content.innerHTML = response
			loading.style.display = "none"
			content.style.display = "block"
		}
	}
 
	function get_content()
	{
	   if (request.readyState == 4)
	   {
		   if (request.status == 200)
		   {
				//get the responseText
				var response = request.responseText;
				
				//call function to display data
				show_content_final(response)
		   }
		   else
		   {
				//debugging
				alert("status is " + request.status);
		   }
		}
	}

	function show_content(which)
	{	   
		var url = "includes/archive_includes/display_" + which + ".php";
		
		document.getElementById('shows_link').style.fontWeight='normal';
		document.getElementById('pictures_link').style.fontWeight='normal';
		document.getElementById('wallpapers_link').style.fontWeight='normal';
		document.getElementById('emails_link').style.fontWeight='normal';
		document.getElementById('rodblast_link').style.fontWeight='normal';
		
		document.getElementById(which + '_link').blur()
		document.getElementById(which + '_link').style.fontWeight='bold';
		
			//send default value
			show_content_final("null");
	
			//open the request
			request.open("GET", url, true);
	
			//set onreadystatechange
			request.onreadystatechange = get_content;
	
			//send
			request.send(null);
	
	}


	function mouseover_video(file)
	{
		document.getElementById('vid_' + file).style.backgroundColor='#CCCCCC'
	}
	function mouseout_video(file)
	{
		document.getElementById('vid_' + file).style.backgroundColor=''
	}
	
	//this function creates the flv player, and displays the video
	function create_video(file, loc, width, height)
	{
		var vid_window = document.getElementById("video_window");
		var vid_close = document.getElementById("video_close");
		
		vid_window.style.width = width+'px';
		vid_window.style.height = height+'px';
		vid_window.style.marginLeft = '-'+(width/2)+'px';
		vid_window.style.marginTop = '-'+(height/2)+'px';
		
		vid_close.style.marginTop = (height/2+11)+'px';
		vid_close.style.marginLeft = (width/2-100)+'px';
		
		var str = ""
		
		//if the file is a youtube link
		if (loc == "youtube")
		{
			var filename = "http://www.youtube.com/v/"+file+"&hl=en_US&fs=1&rel=0&color1=0x234900&color2=0x4e9e00"
			
			str = '<object width="' + width + '" height="' + height + '"><param name="movie" value="'
			str += filename
			str += '"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="'
			str += filename
			str += '" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="' + width + '" height="' + height + '"></embed></object>'
		}
		else if (loc == "vimeo")
		{
			str = '<object width="'+ width +'" height="'+height+'"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id='+file+'&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=00ADEF&fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id='+file+'&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=00ADEF&fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="'+width+'" height="'+height+'"></embed></object>'
		}
		else
		{
			var str = AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0','width',width,'height',height,'id','FLVPlayer','src','http://www.thecrazymonkeys.com/includes/scripts/FLVPlayer_Progressive','flashvars','&MM_ComponentVersion=1&skinName=http://www.thecrazymonkeys.com/includes/scripts/Clear_Skin_3&streamName=http://www.thecrazymonkeys.com/archives/video/' + file + '&autoPlay=true&autoRewind=true','quality','high','scale','noscale','name','FLVPlayer','salign','lt','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','http://www.thecrazymonkeys.com/includes/scripts/FLVPlayer_Progressive' ); //end AC code
		}
		
		vid_window.innerHTML = str;
		
		vid_window.style.display = 'block'
		vid_close.style.display = 'block'
		
	}
	
	function close_video()
	{
		var vid_window = document.getElementById("video_window");
		var vid_close = document.getElementById("video_close");
		
		vid_window.style.display = 'none';
		vid_close.style.display = 'none';
		
		document.getElementById('email_box').style.display="none";
	}


	function show_email(which)
	{
		//get element from doc
		var content = document.getElementById("email_box");
		var loading = document.getElementById("email_loader")
		
		content.style.display = "none"
		loading.style.display = "block"
		
		var vid_close = document.getElementById('video_close')
		vid_close.style.display="block"
		vid_close.style.marginTop="262px"
		vid_close.style.marginLeft="210px"
		
		var url = "includes/scripts/call_email.php?file=" + which;
		
			//open the request
			request.open("GET", url, true);
			
			//set onreadystatechange
			request.onreadystatechange = get_email_content;
	
			//send
			request.send(null);
	
	}
 
	function get_email_content()
	{
	   if (request.readyState == 4)
	   {
		   if (request.status == 200)
		   {
				//get the responseText
				var response = request.responseText;
				
				//call function to display data
				show_email_final(response)
		   }
		   else
		   {
				//debugging
				alert("status is " + request.status);
		   }
		}
	}

	function show_email_final(response)
	{  
		//get element from doc
		var content = document.getElementById("email_box");
		var loading = document.getElementById("email_loader")
		
		if (response == "null")
		{
			loading.style.display = "block"
			content.style.display = "none"
		}
		else
		{
			content.innerHTML = response
			loading.style.display = "none"
			content.style.display = "block"
			document.location='#message_top';
		}
	}

