// JavaScript Document

/***********************************************
* 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.
Made some changes to load up a video/image iframe in the ajax_show_page div.
***********************************************/

var urlVid = "";
var ajax_show_page_holder = 'ajax_show_page_holder';
var ajax_show_page = 'ajax_show_page';

function A2AShowVid(vid_id, ypos,xpos, type, widthIn, height) {
	var setWidth = 690;
	var setHeight = 560;
	var scrolling = 'no';
	if(widthIn != null){
		setWidth = widthIn;
	}
	
	if( type == 'video' )
	{
		urlDisplay = "./playvideo.html?video=" + vid_id;
	}	
	else if ( type == 'photo' )
	{
		urlDisplay = "./showPicture.html?image=" + vid_id;
	}	
	else if ( type == 'enquiry' )//Popping up a form frame
	{	
		scrolling = 'auto';
		urlDisplay = "http://67.199.64.112/enquiryFormLoader.cfm?formaction=" + vid_id;
		/*urlDisplay = "http://127.0.0.1:8501/air2air/air2aircallcentreadmin/enquiryFormLoader.cfm?formaction=" + vid_id;*/
	}
	var page_request = false;
	if (!ypos){
		ypos = 100;
	}
	else{
		ypos = ypos - 0;
		vid_iframe_code = '<iframe src="' + urlDisplay + '" id="the_video_in_page" name="the_video_in_page" frameborder="0" marginheight="0" marginwidth="0" allowtransparency="yes" scrolling="' + scrolling +'" style="border:0px; border-style:none; width:'+ setWidth + 'px; height:560px; 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;
		window.frames["the_video_in_page"].location.href=urlDisplay;

	}
			

	
}


function A2AClose() {
	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;

}

var url = "";
function A2AShow(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;
	}
}


function A2AShowNews(news_id, ypos,xpos, type, widthIn, height) {
	var setWidth = 690;
	var setHeight = 560;
	var scrolling = 'no';
	if(widthIn != null){
		setWidth = widthIn;
	}
	
	
		scrolling = 'auto';
		urlDisplay = "http://www.air2air.com/news/view.asp?ID=" + news_id;
		/*urlDisplay = "http://127.0.0.1:8501/air2air/air2aircallcentreadmin/enquiryFormLoader.cfm?formaction=" + vid_id;*/

	var page_request = false;
	if (!ypos){
		ypos = 100;
	}
	else{
		ypos = ypos - 0;
		vid_iframe_code = '<iframe src="' + urlDisplay + '" id="the_video_in_page" name="the_video_in_page" frameborder="0" marginheight="0" marginwidth="0" allowtransparency="yes" scrolling="' + scrolling +'" style="border:0px; border-style:none; width:'+ setWidth + 'px; height:560px; margin:0; padding:0;"></iframe>';
		parent.document.getElementById(ajax_show_page_holder).style.visibility = "visible";
		parent.document.getElementById(ajax_show_page_holder).style.display = "block";
		parent.document.getElementById(ajax_show_page_holder).style.top = ypos + "px";
		parent.document.getElementById(ajax_show_page).style.overflow = "hidden";
		parent.document.getElementById(ajax_show_page).innerHTML = vid_iframe_code;
		//window.frames["the_video_in_page"].location.href=urlDisplay;

	}
			

	
}




