/*
===============================================================================
====== Name: tour_functions.js
====== Desc: functions needed for the tour page
====== Auth: Chris Barr
====== Date: 06/04/2007
===============================================================================
====== Change History
===============================================================================
====== Date:         Author:           Description:
====== ----------    --------          ----------------------------------------
	7/2/07		CB		Added third row deletion
===============================================================================

function printTour()
function PopupCenterWindow(Url, Width, Height, Scroll)
function removeTour(listingID)
*/

function printTour()
{
	var optionDetails	= document.getElementById("f_print_details").checked;
	var optionMap		= document.getElementById("f_print_map").checked;
	
	if(optionDetails || optionMap)
		window.open('tour_print.asp?d=' + optionDetails + '&m=' + optionMap);
	else
		alert("please select what you want to print first.");
};

function PopupCenterWindow(Url, Width, Height, Scroll)
{
	/*
	RETURN VALUE:
	none
	
	USAGE:
	href=JavaScript:PopupCenterWindow('global_functions_implementation.html',400,100,'no');
	
	PARAMETERS:
	Url:	File or address to open in the new window.
	Width:	The width of the window to open
	Height:	The height of the window to open
	Scroll:	yes/no Allow the new window to contain scrollbars or not
	
	NOTE:
	Each window is given a unique name so that subsequent requests will crate new windows.
	There is no navigation, Menus, Address, or status in the window.
	*/
	
	//var
	var WindowString;
	var Now		= new Date();
	var RandName	= Now.getUTCMilliseconds();
	var X		= (screen.availWidth - Width)/2;
	var Y		= (screen.availHeight - Height)/2-10;
	//var
	
	RandName = RandName.toString();
	if(Scroll == "")
		Scroll = "no";
	if(!window.screenX) //screexX==NS
	{
		X+=parseInt(window.screenLeft / screen.availWidth)*screen.availWidth;
		Y+=parseInt(window.screenTop / screen.availHeight)*screen.availHeight;
	}else{
		X+=parseInt(window.screenX / screen.availWidth)*screen.availWidth;
		Y+=parseInt(window.screenY / screen.availHeight)*screen.availHeight;
	};
	WindowString = "width=" + Width + ",height=" + Height + ",screenX=" + X + ",screenY="  + Y + ",left=" + X + ",top="  + Y + ",toolbar=0,scrollbars=" + Scroll + ",location=0,directories=0,status=0,menubar=0,resizable=yes";
	newWindow = open(Url, RandName, WindowString);
	newWindow.moveTo(X, Y);
	//newWindow.location=Url;
};

function removeTour(listingID)
{
	var Js_post		= new postback("tour_process.asp");
	var listingTable	= document.getElementById("listingTable").childNodes[0];
	var listingRowTop	= document.getElementById("listingRow_top_" + listingID);
	var Runner

	Js_post.Parameters="action=tour_remove&uid=" + listingID;
	for(Runner=0;Runner<listingTable.childNodes.length;Runner++)
	{
		if(listingTable.childNodes[Runner]==listingRowTop)
		{
			//Remove top
			listingTable.removeChild(listingTable.childNodes[Runner]);
			//Remove middle
			listingTable.removeChild(listingTable.childNodes[Runner]);
			//Remove bottom
			listingTable.removeChild(listingTable.childNodes[Runner]);
			break;
		};
	};
	Js_post.Retrieve();
};