// JavaScript Document
function doTour(size)
{
	var w = 180;
	var h = 120;
	if(size == 320)
	{
		w = 320;
		h = 240;
	}
	if (pluginlist.indexOf("RealPlayer") != -1)
		doLink("http://www.property.com.ua/movies/" + size + "/realtour.htm", w, h + 30);
		
	else if (pluginlist.indexOf("Flash") != -1)
		doLink("http://www.property.com.ua/movies/" + size + "/flashtour.htm", w, h);
		
	else
		doLink("http://www.property.com.ua/mmlink.htm", 320, 260);
}
function getReal(win)
{
	win.close();
	document.forms["Real"].submit();
}
function getFlash(win)
{
	win.close();
	document.forms["Flash"].submit();
}
function getArgs()
{
	var args = new Object();
	var query = location.search.substring(1);
	var pairs = query.split("&");
	for(var i = 0; i < pairs.length; i++){
		var nIndex = pairs[i].indexOf('=');
		if(nIndex == -1)
			continue;
		var name = pairs[i].substring(0,nIndex);
		var val = pairs[i].substring(nIndex + 1);
//		args[name] = unescape(val);
		args[name] = decodeURIComponent(val);
	}
	return args;
}

function openWindow(url, winName, top, left, width, height, scrll)
{
	this.width = arguments.length > 4 ? width : 800;
	this.height = arguments.length > 5 ? height : 340;
	this.scrll = arguments.length > 6 ? scrll : "yes";
	
	return window.open(url,winName,"width="+this.width+",height="+this.height+",location=no,toolbar=no,menubar=no,titlebar=yes,scrollbars="+this.scrll+",resizable=no,top="+top+",left="+left);
}

function doLink(url, w, h, bScroll)
{	
	var left = screen.availWidth > 800 ? 50 : 0;
	var top = screen.availHeight > 480 ? 50 : 0;
	
	var width = arguments.length > 1 ? w : 640;
	var height = arguments.length > 2 ? h : 480;
	
	var scrll = arguments.length > 3 ? "yes" : "no";

	
	if(childWin && !childWin.closed)
	{
		childWin.location = url;
		childWin.focus();
		return;
	}				
	
	childWin = openWindow(url, "ChildWindow", top, left, width, height, scrll);
}
function doPano(url, w, h)
{
	if(isQuickTimeInstalled() || isFlashInstalled())
		doLink(url, w, h);
		
	else
		alert("Sorry, the plugin required to view this panorama wasn't found.\nPlease follow the link supplied to download and install either the Apple QuickTime viewer or Adobe Flash player.");
}
function killChild()
{
	try
	{
		if(childWin && !childWin.closed)
			childWin.close();
	}
	catch(ex)
	{}
}
function doPrint(url)
{
	doLink(url, 700, 500, false);
	childWin.print();
}

var childWin = null;
onfocus = killChild;