/***********************************************
* Ajax Includes script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
* To include a page, invoke ajaxinclude("afile.htm") in the BODY of page. The included file MUST be from the same domain as the page displaying it.
* Modified by Colin for use on Draganfly.com inside a div with ID of "ajax_show_page"
***********************************************/

var urlVid = "";
function DFShowVid(prod_id, vid_id, ypos) {
	urlVid = "/video/gallery/show-single-video.php?video_number=" + vid_id + "&product_id=" + prod_id + "&r=" + Math.floor(Math.random()*1001);
	var page_request = false;
	if (!ypos)
		ypos = 100;
	else
		ypos = ypos - 0;
	vid_iframe_code = '<iframe src="' + urlVid + '" id="the_video_in_page" name="the_video_in_page" frameborder="0" marginheight="0" marginwidth="0" allowtransparency="yes" scrolling="no" style="border:0px; border-style:none; width:640px; height:470px; margin:0; padding:0;"></iframe>';
	document.getElementById('ajax_show_page_holder').style.visibility = "visible";
	document.getElementById('ajax_show_page_holder').style.display = "block";
	document.getElementById('ajax_show_page_holder').style.top = ypos + "px";
	document.getElementById('ajax_show_page').style.overflow = "hidden";
	document.getElementById('ajax_show_page').innerHTML = vid_iframe_code;
}


function DFClose() {
	document.getElementById('ajax_show_page_holder').style.visibility = "hidden";
	document.getElementById('ajax_show_page_holder').style.display = "none";
	urlBlank = "/includes/common_content/" + "BLANK.php" + "?r=" + Math.floor(Math.random()*1001);
	var page_request = false;
	if (window.XMLHttpRequest) // if Mozilla, Safari etc
		page_request = new XMLHttpRequest();
	else if (window.ActiveXObject) { // if IE
		try {
			page_request = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) {
			try {
				page_request = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) {
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	else
		return false;
	page_request.open('GET', urlBlank, false); //get page synchronously 
	page_request.send(null);
	if (window.location.href.indexOf("http")==-1 || page_request.status==200) {
		document.getElementById('ajax_show_page').innerHTML = page_request.responseText;
	}
}

var url = "";
function DFShow(ajax_url, ypos) {
	url = "/includes/common_content/" + ajax_url + "?r=" + Math.floor(Math.random()*1001);
	var page_request = false;
	if (!ypos)
		ypos = 100;
	else
		ypos = ypos - 155;
	if (window.XMLHttpRequest) // if Mozilla, Safari etc
		page_request = new XMLHttpRequest();
	else if (window.ActiveXObject) { // if IE
		try {
			page_request = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) {
			try {
				page_request = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) {
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	else
		return false;
	page_request.open('GET', url, false); //get page synchronously 
	page_request.send(null);
	if (window.location.href.indexOf("http")==-1 || page_request.status==200) {
		document.getElementById('ajax_show_page_holder').style.visibility = "visible";
		document.getElementById('ajax_show_page_holder').style.display = "block";
		document.getElementById('ajax_show_page_holder').style.top = ypos + "px";
		document.getElementById('ajax_show_page').style.overflow = "auto";
		document.getElementById('ajax_show_page').innerHTML = page_request.responseText;
	}
}

