	function myPopUp( url, name, width, height )
	{
		window.open( url, name, 'width='+width+', height='+height+', scrollbars=yes, resizable=yes, status=yes' );
	}

	
	
	function changeColor( elm ) 
	{
		elmThingy = document.getElementById( elm );
		elmThingy.style.backgroundColor = '#FF8E90';
	}
	        
	function resetColor( elm ) 
	{
		elmThingy = document.getElementById( elm );
		elmThingy.style.backgroundColor = 'white';
	}

		var keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';

		function base64_encode( input )
		{
			return encode64( input );
		}

		function encode64(input) 
		{
			var output = '';
			var chr1, chr2, chr3;
			var enc1, enc2, enc3, enc4;
			var i = 0;
		
			do {
				chr1 = input.charCodeAt(i++);
				chr2 = input.charCodeAt(i++);
				chr3 = input.charCodeAt(i++);
		
				enc1 = chr1 >> 2;
				enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
				enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
				enc4 = chr3 & 63;
		
				if (isNaN(chr2)) {
					enc3 = enc4 = 64;
				} else if (isNaN(chr3)) {
					enc4 = 64;
				}
		
				output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + 
				keyStr.charAt(enc3) + keyStr.charAt(enc4);
			} while (i < input.length);
		   
			return output;
		}

		function base64_decode(input) {
		   var output = '';
		   var chr1, chr2, chr3;
		   var enc1, enc2, enc3, enc4;
		   var i = 0;
		
		   // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
		   input = input.replace(/[^A-Za-z0-9\+\/\=]/g, '');
		
		   do {
		      enc1 = keyStr.indexOf(input.charAt(i++));
		      enc2 = keyStr.indexOf(input.charAt(i++));
		      enc3 = keyStr.indexOf(input.charAt(i++));
		      enc4 = keyStr.indexOf(input.charAt(i++));
		
		      chr1 = (enc1 << 2) | (enc2 >> 4);
		      chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
		      chr3 = ((enc3 & 3) << 6) | enc4;
		
		      output = output + String.fromCharCode(chr1);
		
		      if (enc3 != 64) {
		         output = output + String.fromCharCode(chr2);
		      }
		      if (enc4 != 64) {
		         output = output + String.fromCharCode(chr3);
		      }
		   } while (i < input.length);
		
		   return output;
		}

		var handleSuccess = function(o)
		{
			
			if(o.responseText !== undefined)
			{   
				document.getElementById( o.argument.element ).innerHTML = o.responseText;
			}   
		}
		
		var handleFailure = function( o )
		{
			alert( o.responseXML );
			alert( 'Something Failed' );
			alert( 'Response Text: ' + o );
			alert( 'Element: ' + o.argument.element );
		}

		//start AJAX stuff		
		var http = createRequestObject(); 
		var myUrl = null;
		var myReturnTo = null;
		var ajaxReturned = false;
		var ajaxDisableId = null;
		function getMyHtml( url, returnTo, disableId  )
		{
			myUrl = url;
			myReturnTo = returnTo;
			ajaxDisableId = disableId;
			http.open('get', myUrl, false );
			http.onreadystatechange = handleProducts; 
			http.send(null);
				
		}
	
		/* Function called to handle the list that was returned from the internal_request.php file.. */
		function handleProducts()
		{
			
			/* Make sure that the transaction has finished. The XMLHttpRequest object 
				has a property called readyState with several states:
				0: Uninitialized
				1: Loading
				2: Loaded
				3: Interactive
				4: Finished */
		
				
			if(http.readyState == 4)
			{ 
				//Finished loading the response
				//document.getElementById('error').innerHTML = '';
				/* We have got the response from the server-side script,
					let's see just what it was. using the responseText property of 
					the XMLHttpRequest object. */
				var response = http.responseText;
				/* And now we want to change the product_categories <div> content.
					we do this using an ability to get/change the content of a page element 
					that we can find: innerHTML. */
				//alert( response );
				document.getElementById(myReturnTo).innerHTML = response;
				if( trim( response ) != '')
				{
					if( ajaxDisableId != null && ajaxDisableId != '' )
					{
						document.getElementById( myReturnTo ).style.display = '';
						document.getElementById( ajaxDisableId ).disabled = true;
					}
				} else {
					if( ajaxDisableId != null && ajaxDisableId != '' )
					{
						document.getElementById( myReturnTo ).style.display = 'none';
						document.getElementById( ajaxDisableId ).disabled = false;
					}
				}
			}
		}
				
		function createRequestObject()
		{
			var request_o; //declare the variable to hold the object.
			var browser = navigator.appName; //find the browser name
			if(window.ActiveXObject)
			{
				/* Create the object using MSIE's method */
				request_o = new ActiveXObject('Microsoft.XMLHTTP');
			} else
			{
				/* Create the object using other browser's method */
				request_o = new XMLHttpRequest();
			}
			return request_o; //return the object
		}

		function trim(s) 
		{
  			while (s.substring(0,1) == ' ') 
			{
				s = s.substring(1,s.length);
			}
			while (s.substring(s.length-1,s.length) == ' ') 
			{
				s = s.substring(0,s.length-1);
			}
			return s;
		}