/* Show Video Preview Player */
function loadBundleBuilder(sec, app, id) {

	var attr = '?sec=' + sec + '&app=' + app + '&id=' + id;
	var xmlhttp = false; 	// Clear our fetching variable
	
	// Show loading details
	documet
	
	// 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 = '../cart2/ajax/bundle_builder.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('bb_area').innerHTML = content;
			}
		}
	}
	
	xmlhttp.send(null) //Nullify the XMLHttpRequest
	return;
}

/* Show Video Preview Player */
function loadTutorials(app) {

	var attr = '?app=' + app;
	var xmlhttp = false; 	// Clear our fetching variable
	
	// Make loading graphic visible
	document.getElementById('loading_tutorials').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(); }
        
	var file = '../tutorial_list/ajax/load_tutorials.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('loading_tutorials').style.visibility='hidden';
				
				document.getElementById('tutorial_list').innerHTML = content;
			}
		}
	}
	
	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
	if (myWidth > 1100) {
		var playerWinWidth = 1100;
		var playerWinHeight = 850;
		var playerAreaWidth = 1024;
		var playerAreaHeight = 784;
	} else {
		var playerWinWidth = 790;
		var playerWinHeight = 606;
		var playerAreaWidth = 720;
		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'; // 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('video_player').innerHTML = content;
			}
		}
	}
	
	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;
	
	if( typeof( window.innerWidth ) == 'number' ) {
	
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	
	} else if ( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	
	} else if ( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	
	// Find out what width to use
	if (myWidth > 1100) {
		var playerWinWidth = 1100;
		var playerWinHeight = 850;
		var playerAreaWidth = 1024;
		var playerAreaHeight = 784;
	} else {
		var playerWinWidth = 790;
		var playerWinHeight = 606;
		var playerAreaWidth = 720;
		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));
	windTop = ((myHeight/2) - (playerWinHeight/2));
	
	// 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'; // 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('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';
}