/* ----- Show Tutorials and Last Played ----------------------------------------------------------------- */
function loadTutorials(type) {

	var attr = '?type=' + type;
	var xmlhttp = false; 	// Clear our fetching variable
	
	// Show loading dial
	if (document.getElementById('loading_dial')) {
		document.getElementById('loading_dial').style.visibility='visible';
	}
	
	// Clear video title area
	//document.getElementById('video_title').innerHTML = 'Tutorials';
	
	// Check for Active X
	try { 
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
   	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
        } catch (E) {
			xmlhttp = false;
       	}
	}
    
    // If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); }
        
	var file = '../../tutorial_area/ajax/tutorials.php';
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
        
		if (xmlhttp.readyState==4) { 			// Check if it is ready to recieve data
			var content = xmlhttp.responseText; // The content data which has been retrieved
			
			if (content) { 						//Make sure there is something in the content variable
				
				document.getElementById('player_area').innerHTML = content;
				document.getElementById('player_area').style.overflow='auto';
				
				// Show loading dial
				if (document.getElementById('loading_dial')) {
					document.getElementById('loading_dial').style.visibility='hidden';
				}
				
			}
		}
	}
	
	xmlhttp.send(null) //Nullify the XMLHttpRequest
	return;
}

/* ----- Show Tutorials by Type ----------------------------------------------------------------- */
function loadTutorialsByType(type, value) {
	
	// Show loading icon
	if (document.getElementById('loading')) { document.getElementById('loading').style.display='inline'; }
	
	var attr = '?type=' + type + '&value=' + value;
	var xmlhttp = false; 	// Clear our fetching variable
	
	// Show loading dial
	if (document.getElementById('loading_dial')) {
		document.getElementById('loading_dial').style.visibility='visible';
	}
	
	// Clear video title area
	//document.getElementById('video_title').innerHTML = 'Tutorials for ' + app_name;
	
	// Check for Active X
	try { 
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
   	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
        } catch (E) {
			xmlhttp = false;
       	}
	}
    
    // If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); }
        
	var file = '../../tutorial_area/ajax/loadTutorials.php';
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
        
		if (xmlhttp.readyState==4) { 			// Check if it is ready to recieve data
			var content = xmlhttp.responseText; // The content data which has been retrieved
			
			if (content) { 						//Make sure there is something in the content variable
				
				document.getElementById('appArea').innerHTML = '';
				document.getElementById('appArea').innerHTML = content;
				document.getElementById('appArea').style.overflow='auto';
				
				// Show loading dial
				if (document.getElementById('loading_dial')) {
					document.getElementById('loading_dial').style.visibility='hidden';
				}
				
				// Show loading icon
				if (document.getElementById('loading')) { document.getElementById('loading').style.display='none'; }
				
			}
		}
	}
	
	xmlhttp.send(null) //Nullify the XMLHttpRequest
	return;
}


/* ----- Show Tutorials by App Type ----------------------------------------------------------------- */
function loadTutorialsByApp(nedweb_sec, app, app_name) {
	
	var attr = '?app=' + app;
	var xmlhttp = false; 	// Clear our fetching variable
	
	// Show loading dial
	if (document.getElementById('loading_dial')) {
		document.getElementById('loading_dial').style.visibility='visible';
	}
	
	// Clear video title area
	//document.getElementById('video_title').innerHTML = 'Tutorials for ' + app_name;
	
	// Check for Active X
	try { 
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
   	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
        } catch (E) {
			xmlhttp = false;
       	}
	}
    
    // If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); }
        
	var file = '../../tutorial_area/ajax/tutorials_by_app.php';
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
        
		if (xmlhttp.readyState==4) { 			// Check if it is ready to recieve data
			var content = xmlhttp.responseText; // The content data which has been retrieved
			
			if (content) { 						//Make sure there is something in the content variable
				
				document.getElementById('appArea').innerHTML = content;
				document.getElementById('appArea').style.overflow='auto';
				
				// Show loading dial
				if (document.getElementById('loading_dial')) {
					document.getElementById('loading_dial').style.visibility='hidden';
				}
				
			}
		}
	}
	
	xmlhttp.send(null) //Nullify the XMLHttpRequest
	return;
}

/* ----- Show Recently Played ----------------------------------------------------------------- */
function loadRecentlyPlayed(nedweb_sec) {
	
	//qtInit();
	
	var attr = '?nedweb_sec=' + nedweb_sec;
	var xmlhttp = false; 	// Clear our fetching variable
	
	// Show loading dial
	if (document.getElementById('loading_dial')) {
		document.getElementById('loading_dial').style.visibility='visible';
	}
	
	// Clear video title area
	//document.getElementById('video_title').innerHTML = 'Recently Played Tutorial-Videos';
	
	// Check for Active X
	try { 
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
   	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
        } catch (E) {
			xmlhttp = false;
       	}
	}
    
    // If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); }
        
	var file = '../../' + nedweb_sec + '/ajax/recently_played.php';
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
        
		if (xmlhttp.readyState==4) { 			// Check if it is ready to recieve data
			var content = xmlhttp.responseText; // The content data which has been retrieved
			
			if (content) { 						//Make sure there is something in the content variable
				
				document.getElementById('appArea').innerHTML = content;
				document.getElementById('appArea').style.overflow='auto';
				
				// Show loading dial
				if (document.getElementById('loading_dial')) {
					document.getElementById('loading_dial').style.visibility='hidden';
				}
				
			}
		}
	}
	
	xmlhttp.send(null) //Nullify the XMLHttpRequest
	return;
}

/* ------------------------------------------------------------------------------------------ */
/* Function to load orders via AJAX */
function toggleSubLevel(level, id) {

	// Hide select box, and show loading
	document.getElementById('tut_sub_select_' + id).style.display='none';
	document.getElementById('loading_sub_' + id).style.display='block';

	// Get selected value
	var selObj = document.getElementById('tut_sub_select_' + id);
	var selIndex = selObj.selectedIndex;
	var level = selObj.options[selIndex].value;

	// Create attr var
	var attr = 'level=' + level + '&id=' + id;
	
	// Clear our fetching variable
	var xmlhttp = false;

	// Check for Active X
	try {
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
		} catch (E) {
			xmlhttp = false;
		}
	}
	
	// If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); }
	
	// File that loads the data   
	var file = '/ph03n1xfr0mth34sh3s/modules/common/ajax/toggle_sub_level.php?'; 
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
	
		// Check if it is ready to recieve data
		if (xmlhttp.readyState==4) {
		
			var content = xmlhttp.responseText; // The content data which has been retrieved
			
			if (content) { 	//Make sure there is something in the content variable
			
				document.getElementById('tut_sub_select_' + id).style.display='block';
				document.getElementById('loading_sub_' + id).style.display='none';
				
			}
		}
	}
	
	xmlhttp.send(null) // Nullify the XMLHttpRequest
	return;
	
}

/* ------------------------------------------------------------------------------------------ */
/* Function to update App Genre via AJAX */
function updateAppGenre(id, genre_num, value) {

	var attr = 'id=' + id + '&genre_num=' + genre_num + '&value=' + value;
	var xmlhttp = false; 	// Clear our fetching variable
	
	// Show loading icon
	document.getElementById(id + '_loading_' + genre_num).style.display='inline';
	
	// Check for Active X
	try { 
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
   	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
        } catch (E) {
			xmlhttp = false;
       	}
	}
    
    // If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); }
        
	var file = '/ph03n1xfr0mth34sh3s/modules/common/ajax/update_app_genre.php?'; 
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
        
		if (xmlhttp.readyState==4) { 			// Check if it is ready to recieve data
			var content = xmlhttp.responseText; // The content data which has been retrieved
			
			if (content) { 					//Make sure there is something in the content variable
			
				//alert(content);
				
				// Show loading icon
				document.getElementById(id + '_loading_' + genre_num).style.display='none';
				
			}
		}
	}
	
	xmlhttp.send(null) //Nullify the XMLHttpRequest
	return;
}

/* ------------------------------------------------------------------------------------------ */
/* Function to list orders via AJAX */
function loadOrders() {

	var attr = '';

	// Clear our fetching variable
	var xmlhttp = false; 
	 
	// Make loading icon visible
	//document.getElementById('internal_comment_loading_icon').style.display='block';
	//document.getElementById('update_internal_comment').value = 'Updating...';
	//document.getElementById('update_internal_comment').disabled = true;
	
	// Check for Active X
	try {
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
   	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
        } catch (E) {
			xmlhttp = false;
       	}
	}
    
    // If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { 
		xmlhttp = new XMLHttpRequest();
	}
	
	// File that loads the Pool data   
	var file = '/ph03n1xfr0mth34sh3s/modules/cart/ajax_scripts/load_orders.php?'; 
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
	
		// Check if it is ready to recieve data
		if (xmlhttp.readyState==4) {
			var content = xmlhttp.responseText; 	// The content data which has been retrieved
			
			if (content) { 						//Make sure there is something in the content variable
				document.getElementById('orders_area').innerHTML = content;
				//document.getElementById('update_internal_comment').disabled = false;
				//document.getElementById('update_internal_comment').value = 'Edit';
				//document.getElementById('internal_comment_loading_icon').style.display='none';
			}
		}
	}
	
	xmlhttp.send(null) // Nullify the XMLHttpRequest
	return;
}

/* ------------------------------------------------------------------------------------------ */
/* Function to load data via AJAX */

function getUserTracking(user, type, kind) {

	if (kind == "" && document.getElementById('kind')) { 
		var kind = document.getElementById('kind').value; 
	}
	
	if (document.getElementById('filter_txt').value != '') {
		var filter = document.getElementById('filter_txt').value; 
	}
	
	var attr = 'tid=' + user + '&type=' + type + '&kind=' + kind + '&filter=' + filter;
	document.getElementById('refresh_button').disabled = true;
	document.getElementById('loading_icon').style.visibility='visible';
	
	
	var xmlhttp = false; 	// Clear our fetching variable
	
	// Check for Active X
	try { 
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
   	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
        } catch (E) {
			xmlhttp = false;
       	}
	}
    
    // If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); }
        
	if (type == "Site") {
		var file = '../../ph03n1xfr0mth34sh3s/modules/site/usertracking/breadcrumbs.php?'; // File that creates breadcrumbs
	} else {
		var file = '../../ph03n1xfr0mth34sh3s/modules/site/usertracking/admin_breadcrumbs.php?'; // File that creates breadcrumbs
	}
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
        
		if (xmlhttp.readyState==4) { 			// Check if it is ready to recieve data
			var content = xmlhttp.responseText; // The content data which has been retrieved
			
			if (content) { 					//Make sure there is something in the content variable
				document.getElementById('user_tracking').innerHTML = content;
				document.getElementById('refresh_button').disabled = false;
				document.getElementById('loading_icon').style.visibility='hidden';
				
				// Update count numbers
				document.getElementById('total_user_count').innerHTML = document.getElementById('total_user_count_value').value;
				document.getElementById('total_user_count_sidebar').innerHTML = document.getElementById('total_user_count_value').value;
				document.getElementById('total_cart_count_sidebar').innerHTML = document.getElementById('cart_count_value').value;
				
				document.getElementById('kind').value = kind;
				document.getElementById('member_count').innerHTML = document.getElementById('member_count_value').value;
				document.getElementById('guest_count').innerHTML = document.getElementById('guest_count_value').value;
				document.getElementById('bot_count').innerHTML = document.getElementById('bot_count_value').value;
				document.getElementById('cart_count').innerHTML = document.getElementById('cart_count_value').value;
				document.getElementById('error_count').innerHTML = document.getElementById('error_count_value').value;
				
				document.getElementById('mpv_count').innerHTML = document.getElementById('mpv_count_value').value;
				document.getElementById('dpv_count').innerHTML = document.getElementById('dpv_count_value').value;
				document.getElementById('nle_count').innerHTML = document.getElementById('nle_count_value').value;
				
				document.getElementById('searchType').value = kind;
				
				// Update Header
				switch (kind) {
					case "all":
						document.getElementById('tracking_hdr').innerHTML = 'Tracked Users';
						break;
						
					case "members":
						document.getElementById('tracking_hdr').innerHTML = 'Tracked Members';
						break;
						
					case "guests":
						document.getElementById('tracking_hdr').innerHTML = 'Tracked Guests';
						break;
						
					case "bots":
						document.getElementById('tracking_hdr').innerHTML = 'Tracked Bots';
						break;
						
				}
			}
		}
	}
	
	xmlhttp.send(null) //Nullify the XMLHttpRequest
	return;
}

/* Function to vote for your favourite track via AJAX */
function refreshSubmissions(id) {

	var attr = '';
	var xmlhttp = false; 	// Clear our fetching variable
	
	// Check for Active X
	try { 
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
   	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
        } catch (E) {
			xmlhttp = false;
       	}
	}
    
    // If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); }
        
	var file = '../../remixcontest/ajax/submissions.php?'; // last logins
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
        
		if (xmlhttp.readyState==4) { 			// Check if it is ready to recieve data
			var content = xmlhttp.responseText; // The content data which has been retrieved
			
			if (content) { 					//Make sure there is something in the content variable
				document.getElementById('submissions').innerHTML = content;
				document.getElementById('list_item_' + id).style.backgroundColor='#F7AD79';
				
			}
		}
	}
	
	xmlhttp.send(null) //Nullify the XMLHttpRequest
	return;
}

/* ------------------------------------------------------------------------------------------ */
/* Function to vote for your favourite track via AJAX */
function voteTrack(answer, id, place) {

	var attr = 'answer=' + answer + '&id=' + id;
	var xmlhttp = false; 	// Clear our fetching variable
	
	// Check for Active X
	try { 
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
   	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
        } catch (E) {
			xmlhttp = false;
       	}
	}
    
    // If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); }
        
	var file = '../../remixcontest/ajax/vote_track.php?'; // last logins
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
        
		if (xmlhttp.readyState==4) { 			// Check if it is ready to recieve data
			var content = xmlhttp.responseText; // The content data which has been retrieved
			
			if (content) { 					//Make sure there is something in the content variable
				
				switch (answer) {
					case "up":
						document.getElementById('up_' + place).src='/img/buttons/vote/vote_up_b.gif';
						document.getElementById('down_' + place).src='/img/buttons/vote/vote_down_c.gif';
						break;
						
					case "down":
						document.getElementById('up_' + place).src='/img/buttons/vote/vote_up_c.gif';
						document.getElementById('down_' + place).src='/img/buttons/vote/vote_down_b.gif';
						break;
				}
				
				// Refresh the list
				refreshSubmissions(id);
				
				//alert(content);
			}
		}
	}
	
	xmlhttp.send(null) //Nullify the XMLHttpRequest
	return;
}

/* ------------------------------------------------------------------------------------------ */
/* Function to load audio via AJAX */

function playAudio(id) {

	var attr = 'id=' + id;
	var xmlhttp = false; 	// Clear our fetching variable
	
	// Check for Active X
	try { 
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
   	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
        } catch (E) {
			xmlhttp = false;
       	}
	}
    
    // If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); }
        
	var file = '../../remixcontest/ajax/audio_player.php?'; // last logins
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
        
		if (xmlhttp.readyState==4) { 			// Check if it is ready to recieve data
			var content = xmlhttp.responseText; // The content data which has been retrieved
			
			if (content) { 					//Make sure there is something in the content variable
				document.getElementById('audio_player_area').innerHTML = content;
			}
		}
	}
	
	xmlhttp.send(null) //Nullify the XMLHttpRequest
	return;
}

/* ------------------------------------------------------------------------------------------ */
/* Function to load data via AJAX */

function getLastLogins(user, type, kind) {

	var attr = '';
	document.getElementById('refresh_button').disabled = true;
	document.getElementById('loading_icon').style.visibility='visible';
	
	
	var xmlhttp = false; 	// Clear our fetching variable
	
	// Check for Active X
	try { 
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
   	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
        } catch (E) {
			xmlhttp = false;
       	}
	}
    
    // If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); }
        
	var file = '../../ph03n1xfr0mth34sh3s/modules/ned/ajax/last_logins.php?'; // last logins
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
        
		if (xmlhttp.readyState==4) { 			// Check if it is ready to recieve data
			var content = xmlhttp.responseText; // The content data which has been retrieved
			
			if (content) { 					//Make sure there is something in the content variable
				document.getElementById('last_logins').innerHTML = content;
				document.getElementById('refresh_button').disabled = false;
				document.getElementById('loading_icon').style.visibility='hidden';
				
			}
		}
	}
	
	xmlhttp.send(null) //Nullify the XMLHttpRequest
	return;
}

/* ------------------------------------------------------------------------------------------ */
/* Function to update Internal Comment via AJAX */
function updateInternalComment(oid) {

	var msg = document.getElementById('o_internal_comment').value;
	var attr = 'oid=' + oid + '&message=' + msg;

	// Clear our fetching variable
	var xmlhttp = false; 
	 
	// Make loading icon visible
	document.getElementById('internal_comment_loading_icon').style.display='block';
	document.getElementById('update_internal_comment').value = 'Updating...';
	document.getElementById('update_internal_comment').disabled = true;
	
	// Check for Active X
	try {
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
   	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
        } catch (E) {
			xmlhttp = false;
       	}
	}
    
    // If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { 
		xmlhttp = new XMLHttpRequest();
	}
	
	// File that loads the Pool data   
	var file = '/ph03n1xfr0mth34sh3s/modules/cart/ajax_scripts/update_internal_comment.php?'; 
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
	
		// Check if it is ready to recieve data
		if (xmlhttp.readyState==4) {
		
			document.getElementById('update_internal_comment').disabled = false;
			document.getElementById('update_internal_comment').value = 'Edit';
			document.getElementById('internal_comment_loading_icon').style.display='none';
			
		}
	}
	
	xmlhttp.send(null) // Nullify the XMLHttpRequest
	return;
}

/* ------------------------------------------------------------------------------------------ */
/* Function to update Internal Comment via AJAX */
function updateSeats(d_id) {

	var seats = document.getElementById('seat_value_' + d_id).value;
	var attr = 'd_id=' + d_id + '&seats=' + seats;

	// Clear our fetching variable
	var xmlhttp = false; 
	 
	// Make loading icon visible
	/*document.getElementById('internal_comment_loading_icon').style.display='block';*/
	document.getElementById('update_seats_' + d_id).value = '...';
	document.getElementById('update_seats_' + d_id).disabled = true;
	
	// Check for Active X
	try {
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
   	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
        } catch (E) {
			xmlhttp = false;
       	}
	}
    
    // If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { 
		xmlhttp = new XMLHttpRequest();
	}
	
	// File that loads the Pool data   
	var file = '/ph03n1xfr0mth34sh3s/modules/cart/ajax_scripts/update_seat_count.php?'; 
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
	
		// Check if it is ready to recieve data
		if (xmlhttp.readyState==4) {
		
			document.getElementById('update_seats_' + d_id).disabled = false;
			document.getElementById('update_seats_' + d_id).value = 'Set';
			document.getElementById('seat_value_' + d_id).style.background='#FFF6BF';
			/*document.getElementById('internal_comment_loading_icon').style.display='none';*/
			
		}
	}
	
	xmlhttp.send(null) // Nullify the XMLHttpRequest
	return;
}

/* ------------------------------------------------------------------------------------------ */
/* Function to toggle GAIN status */
function toggleGAIN(id) {

	var attr = 'id=' + id;
	
	// Change active icon to loading
	document.getElementById('img_' + id).src='/img/icons/loading.gif';

	// Clear our fetching variable
	var xmlhttp = false; 
	 
	// Check for Active X
	try {
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
   	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
        } catch (E) {
			xmlhttp = false;
       	}
	}
    
    // If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { 
		xmlhttp = new XMLHttpRequest();
	}
	
	// File that loads the Pool data   
	var file = '/ph03n1xfr0mth34sh3s/modules/cart/ajax_scripts/toggle_gain.php?'; 
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
	
		// Check if it is ready to recieve data
		if (xmlhttp.readyState==4) {
		
			var content = xmlhttp.responseText;
		
			if (content == 1) {
				document.getElementById('img_' + id).src='/img/icons/accept.gif';
			} else {
				document.getElementById('img_' + id).src='/img/icons/accept_faded.gif';
			}
		}
	}
	
	xmlhttp.send(null) // Nullify the XMLHttpRequest
	return;
}

/* ------------------------------------------------------------------------------------------ */
/* Function to load orders via AJAX */

var t=0;

function initSFOrderResults(query, access, show) {

	if (query == "") {
	
		closeSFResults();
		
	} else {
		
		// Show searching text
		if (document.getElementById('smartfind_results').innerHTML == "") {
			document.getElementById('smartfind_results').innerHTML = '<a href="javascript:closeSFResults();" onClick="closeSFResults(); return false;"><img src="/img/buttons/close_circle.gif" style="float: right; margin: 5px; width: 14px; height: 14px;" id="close_icon"></a><img src=\"/img/icons/loading.gif\" style=\"float: right; margin: 5px 0 5px 0; width: 15px; height: 15px;\" id=\"loading_icon\" /><div style=\"margin: 5px;\">Searching...</div>';
		} else {
			document.getElementById('loading_icon').style.display = 'block';
		}
		
		document.getElementById('smartfind_results').style.display = 'block';
		
		clearTimeout(t); // Clear the following timeout if searching another character
		t=setTimeout("loadSFOrderResults('" + query + "','" + access + "','" + show + "')",1000); //int in milliseconds
		
	}
}


function loadSFOrderResults(query, access, show) {

	var attr = 'query=' + query + "&access=" + access + "&show=" + show;
	
	setTimeout("loadSFOrderResultsData('" + query + "','" + access + "','" + show + "','" + attr + "')", 500);
	
}

/* ------------------------------------------------------------------------------------------ */
/* Function to load orders via AJAX */
function loadSFOrderResultsData(query, access, show, attr) {

	// Clear our fetching variable
	var xmlhttp = false;

	// Check for Active X
	try {
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
		} catch (E) {
			xmlhttp = false;
		}
	}
	
	// If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); }
	
	// File that loads the data   
	var file = '/ph03n1xfr0mth34sh3s/modules/cart/ajax_scripts/smartfind_order_results.php?'; 
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
	
		// Check if it is ready to recieve data
		if (xmlhttp.readyState==4) {
		
			var content = xmlhttp.responseText; // The content data which has been retrieved
			
			if (content) { 	//Make sure there is something in the content variable
				document.getElementById('loading_icon').style.display = 'block';
				document.getElementById('smartfind_results').innerHTML = content;
				document.getElementById('loading_icon').style.display = 'none';
			}
		}
	}
	
	xmlhttp.send(null) // Nullify the XMLHttpRequest
	return;
	
}

/* ------------------------------------------------------------------------------------------ */
/* Function to load orders via AJAX */
function LoadContactList() {

	var attr = '';

	// Clear our fetching variable
	var xmlhttp = false; 
	 
	document.getElementById('loading_icon').style.visibility = 'visible';
	
	// Check for Active X
	try {
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
		} catch (E) {
			xmlhttp = false;
		}
	}
	
	// If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { 
		xmlhttp = new XMLHttpRequest();
	}
	
	// File that loads the data   
	var file = '/modules/ajax/contact_list.php?'; 
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
	
		// Check if it is ready to recieve data
		if (xmlhttp.readyState==4) {
		
			var content = xmlhttp.responseText; // The content data which has been retrieved
			
			if (content) { 	//Make sure there is something in the content variable
				document.getElementById('contact_list').innerHTML = content;
				document.getElementById('loading_icon').style.visibility = 'hidden';
			}
		}
	}
	
	xmlhttp.send(null) // Nullify the XMLHttpRequest
	return;
}


/* ------------------------------------------------------------------------------------------ */
/* Function to load orders via AJAX */
function removeFromContacts(email) {

	var attr = 'email=' + email;

	// Clear our fetching variable
	var xmlhttp = false; 
	 
	document.getElementById('loading_icon').style.visibility = 'visible';
	
	// Check for Active X
	try {
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
		} catch (E) {
			xmlhttp = false;
		}
	}
	
	// If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { 
		xmlhttp = new XMLHttpRequest();
	}
	
	// File that loads the data   
	var file = '/modules/ajax/remove_contact.php?'; 
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
	
		// Check if it is ready to recieve data
		if (xmlhttp.readyState==4) {
		
			var content = xmlhttp.responseText; // The content data which has been retrieved
			
			if (content) { 	//Make sure there is something in the content variable
			
				LoadContactList();
				document.getElementById('email_count').innerHTML = content;
				document.getElementById('loading_icon').style.visibility = 'hidden';
			
			}
		}
	}
	
	xmlhttp.send(null) // Nullify the XMLHttpRequest
	return;
}

/* ------------------------------------------------------------------------------------------- */
/* Function to add the Product ID to the tuts_in_bundle PHP session */
function addToBundle(details, sess_key) {

	var elements = details.split('|');
	var id = elements[0];
	
	attr = 'sess_key=' + sess_key + '&add=' + id;
	
	// Clear our fetching variable
	var xmlhttp = false; 
	 
	try {
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
   	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
        } catch (E) {
			xmlhttp = false;
       	}
	}
    
    // If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); }
	
	// File that loads the data   
	var file = '/modules/ajax/add_to_byob.php?'; 
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
		
		// Check if it is ready to recieve data
		if (xmlhttp.readyState==4) { loadBYOBGraphics(); }
		
	}
	
	xmlhttp.send(null) // Nullify the XMLHttpRequest
	return;
	
}

/* ------------------------------------------------------------------------------------------- */
/* Function to add the Product ID to the tuts_in_bundle PHP session */
function addFromBundle(details, index) {

	var elements = details.split('/');
	
	attr = 'tuts=' + elements[0] + '&cid=' + elements[1];
	
	// Disable bundle selection pulldown while it loads
	document.getElementById('presets').disabled='true';
	document.getElementById('loading_icon').style.display='inline';
	
	// Clear our fetching variable
	var xmlhttp = false; 
	 
	try {
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
   	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
        } catch (E) {
			xmlhttp = false;
       	}
	}
    
    // If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); }
	
	// File that loads the data   
	var file = '/modules/ajax/add_to_byob_from_bundle.php?'; 
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
		
		// Check if it is ready to recieve data
		if (xmlhttp.readyState==4) { 
		
			var content = xmlhttp.responseText; // The content data which has been retrieved
			
			if (content) { 	//Make sure there is something in the content variable
			
				window.location.reload();
				/*document.location.href='/bundlebuilder/index2.php?bdl=' + index;*/
				
			}
		}
	}
	
	xmlhttp.send(null) // Nullify the XMLHttpRequest
	return;
}

/* ------------------------------------------------------------------------------------------- */
/* Function to add the Product ID to the tuts_in_bundle PHP session */
function addFromBundleExt(details, index) {

	var elements = details.split('/');
	
	attr = 'tuts=' + elements[0] + '&cid=' + elements[1];
	
	// Disable bundle selection pulldown while it loads
	//document.getElementById('presets').disabled='true';
	//document.getElementById('loading_icon').style.display='inline';
	
	// Clear our fetching variable
	var xmlhttp = false; 
	 
	try {
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
   	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
        } catch (E) {
			xmlhttp = false;
       	}
	}
    
    // If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); }
	
	// File that loads the data   
	var file = '/modules/ajax/add_to_byob_from_bundle.php?'; 
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
		
		// Check if it is ready to recieve data
		if (xmlhttp.readyState==4) { 
		
			var content = xmlhttp.responseText; // The content data which has been retrieved
			
			if (content) { 	//Make sure there is something in the content variable
			
				//window.location.reload();
				document.location.href='/bundlebuilder/';
				
			}
		}
	}
	
	xmlhttp.send(null) // Nullify the XMLHttpRequest
	return;
}

/* ------------------------------------------------------------------------------------------ */
/* Function to load orders via AJAX */
function loadBYOBGraphics() {

	var attr = '';

	// Clear our fetching variable
	var xmlhttp = false; 
	 
	// Check for Active X
	try {
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
		} catch (E) {
			xmlhttp = false;
		}
	}
	
	// If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { 
		xmlhttp = new XMLHttpRequest();
	}
	
	// File that loads the data   
	var file = '/modules/ajax/byob_graphics.php?'; 
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
	
		// Check if it is ready to recieve data
		if (xmlhttp.readyState==4) {
		
			var content = xmlhttp.responseText; // The content data which has been retrieved
			
			if (content) { 	//Make sure there is something in the content variable
			
				document.getElementById('bundle_builder').innerHTML = content;
			
			}
		}
	}
	
	xmlhttp.send(null) // Nullify the XMLHttpRequest
	return;
}

/* ------------------------------------------------------------------------------------------ */
/* Function to search knowledgebase */
function searchKbase(query) {

	var attr = 'query=' + query;
	
	// Clear our fetching variable
	var xmlhttp = false; 
	 
	// Check for Active X
	try {
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
		} catch (E) {
			xmlhttp = false;
		}
	}
	
	// If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { 
		xmlhttp = new XMLHttpRequest();
	}
	
	// File that loads the data   
	var file = '../../../support2/ajax/search_knowledge_base.php?'; 
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
	
		// Check if it is ready to recieve data
		if (xmlhttp.readyState==4) {
		
			var content = xmlhttp.responseText; // The content data which has been retrieved
			
			if (content) { 	// Make sure there is something in the content variable
			
				document.getElementById('kbase_query_results').style.display='block';
				document.getElementById('kbase_query_results').innerHTML = content;
				
			}
		}
	}
	
	xmlhttp.send(null) // Nullify the XMLHttpRequest
	return;
}

/* ------------------------------------------------------------------------------------------ */
/* Function to show the knowledgebase answer */
function showKbaseAnswer(id) {

	var attr = 'id=' + id;
	
	// Show loading icon
	document.getElementById('loading_' + id).style.display='inline';
	
	// Clear our fetching variable
	var xmlhttp = false; 
	 
	// Check for Active X
	try {
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
		} catch (E) {
			xmlhttp = false;
		}
	}
	
	// If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { 
		xmlhttp = new XMLHttpRequest();
	}
	
	// File that loads the data   
	var file = '../../../support2/ajax/show_answer.php?'; 
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
	
		// Check if it is ready to recieve data
		if (xmlhttp.readyState==4) {
		
			var content = xmlhttp.responseText; // The content data which has been retrieved
			
			if (content) { 	// Make sure there is something in the content variable
			
				document.getElementById('answer_' + id).innerHTML = content;
				
				// Show loading icon
				document.getElementById('loading_' + id).style.display='none';
				
			}
		}
	}
	
	xmlhttp.send(null) // Nullify the XMLHttpRequest
	return;
}


/* ----- Show Video Preview Player ------------------------------------------------------------------------------------ */
function showVideoPreview(id) {

	// Get the window's Width/Height
	var myWidth = 0, myHeight = 0;
	
	// Window Width
	function f_clientWidth() {
		return f_filterResults (
			window.innerWidth ? window.innerWidth : 0,
			document.documentElement ? document.documentElement.clientWidth : 0,
			document.body ? document.body.clientWidth : 0
		);
	}
	
	// Window Height
	function f_clientHeight() {
		return f_filterResults (
			window.innerHeight ? window.innerHeight : 0,
			document.documentElement ? document.documentElement.clientHeight : 0,
			document.body ? document.body.clientHeight : 0
		);
	}
	
	// Scroll Left
	function f_scrollLeft() {
		return f_filterResults (
			window.pageXOffset ? window.pageXOffset : 0,
			document.documentElement ? document.documentElement.scrollLeft : 0,
			document.body ? document.body.scrollLeft : 0
		);
	}
	
	// Scroll Top
	function f_scrollTop() {
		return f_filterResults (
			window.pageYOffset ? window.pageYOffset : 0,
			document.documentElement ? document.documentElement.scrollTop : 0,
			document.body ? document.body.scrollTop : 0
		);
	}
	
	// Filter Results
	function f_filterResults(n_win, n_docel, n_body) {
		var n_result = n_win ? n_win : 0;
		if (n_docel && (!n_result || (n_result > n_docel)))
			n_result = n_docel;
		return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
	}
	
	// Set the variables
	myWidth = f_clientWidth();
	myHeight = f_clientHeight();
	myScrollLeft = f_scrollLeft();
	myScrollTop = f_scrollTop();
	
	//alert('W: ' + myWidth + ' - ' + 'H: ' + myHeight + ' - ' + 'L: ' + myScrollLeft + ' - ' + 'T: ' + myScrollTop);

	// Find out what width to use
	var playerWinWidth = 1010;
	var playerWinHeight = 640;
	var playerAreaWidth = 960;
	var playerAreaHeight = 540;
	
	// Resize the Video player window
	document.getElementById('video_box').style.width=playerWinWidth + 'px';
	document.getElementById('video_box').style.height=playerWinHeight + 'px';
	document.getElementById('video_player').style.width=playerAreaWidth + 'px';
	
	// Get the center of the screen
	windLeft = ((myWidth/2) - (playerWinWidth/2) + myScrollLeft);
	windTop = ((myHeight/2) - (playerWinHeight/2) + myScrollTop);
	
	// Make sure the windTop isn't negative
	if (windTop < 0) { var windTop = 50; }
	
	// Move the DIV's position
	document.getElementById('video_box').style.left=windLeft + 'px';
	document.getElementById('video_box').style.top=windTop + 'px';
	document.getElementById('video_overlay').style.height='100%';
	
	// Set the attribute string
	var attr = '?id=' + id + '&screen_size=' + myWidth;
	
	// Show the overlay
	document.getElementById('video_overlay').style.display='block';
	document.getElementById('video_box').style.display='block';
	
	var xmlhttp = false; 	// Clear our fetching variable
	
	// Check for Active X
	try { 
		xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); // Try the first kind of active x object 
   	} catch (e) {
		try {
			xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Try the second kind of active x object
        } catch (E) {
			xmlhttp = false;
       	}
	}
    
    // If we were able to get a working active x object, start an XMLHttpRequest
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); }
        
    var file = '../../modules/ajax/video_player.php'; // Player
	
	// Get the file
	xmlhttp.open('GET', file + attr, true);
	xmlhttp.onreadystatechange=function() {
        
		if (xmlhttp.readyState==4) { 			// Check if it is ready to recieve data
			var content = xmlhttp.responseText; // The content data which has been retrieved
			
			if (content) { 						//Make sure there is something in the content variable
				document.getElementById('video_player').innerHTML = content;
			}
		}
	}
	
	xmlhttp.send(null) //Nullify the XMLHttpRequest
	return;
}

/* Hide Video Preview Player */
function hideVideoPreview() {
	document.getElementById('video_player').innerHTML = '';
	document.getElementById('video_overlay').style.display='none';
	document.getElementById('video_box').style.display='none';
}