

// Resize
var ns4 = document.layers;
if (ns4) storeValues();
function storeValues() {
    origWidth = innerWidth;
    origHeight = innerHeight;
}
function reDo() {
    if (innerWidth != origWidth || innerHeight != origHeight) {
	location.reload();
    }
    storeValues();
}
if (ns4) onresize = reDo;



// Meny
var isNav, isIE, isMoz;
var collStart = "";
var collEnd = "";
var styleObj = "";

if (parseInt(navigator.appVersion) >= 4){
    if(navigator.appName == "Netscape"){
		if(parseInt(navigator.appVersion) >= 5){
	    isMoz = true;
	    collStart = "getElementById('";
	    collEnd = "')";
	    styleObj = ".style";
		}
		else{
	    isNav = true;
		}
    }
    else{
	isIE = true;
	collStart = "all.";
	styleObj = ".style";
    }
}

function getObject(obj){
    var theObj;
    if (typeof obj == "string"){
	theObj = eval("document." + collStart + obj + collEnd + styleObj);
    }
    else{
	theObj = obj;
    }
    return theObj;
}

function show(obj){
    var theObj = getObject(obj);
    if(isNav){
	theObj.visibility = "show";
    }
    else{
	theObj.visibility = "visible";
    }
}

function hide(obj){
    var theObj = getObject(obj);
    if (isNav){
	theObj.visibility = "hide";
    }
    else{
	theObj.visibility = "hidden";
    }
}


var SelectedObjName = null;

function SelectedObj(obj){
    SelectedObjName = obj;
}

function Check(){
    if(SelectedObjName == "false"){
	for(i=0 ; i<=CheckList.length-1 ; i++){		
	    
	    hide(CheckList[i]);
	}
	SelectedObjName == "true";
    }	
}

function hideAll() {
    for(i=0 ; i<=CheckList.length-1 ; i++){		
	hide(CheckList[i]);
    }
}



//document.onmousedown = Check;
document.onclick = Check;

function openPrintWindow(url) {
    var printWin = window.open(url, "_blank", "width=640,height=500,scrollbars,resizable,menubar,toolbar");
}

// Additional functions added for dynamic menu positioning
function move(obj, x, y) {
    var theObj = getObject(obj);
    theObj.left = x;
    theObj.top = y;
}

function getWidth(obj) {
    var width = 0;
    var temp;
    if (obj != null) {
	temp = obj.offsetLeft;
	if (!isNaN(temp) || isMoz) { 
	    width = temp + getWidth(obj.parentElement);
	}
    }
    return width;
}

function findPosX(obj)
{
    var curleft = 0;
    if (obj.offsetParent)
	{
	    while (obj.offsetParent)
		{
		    curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
    else if (obj.x)
	curleft += obj.x;

    return curleft;
}



var menus = new Array();

function connectAnchorToMenu(anchorName, menuName) {
    menus[menus.length] = new Array(anchorName, menuName);
}

function positionMenus() {
    for (var i = 0; i < menus.length; i++) {
	var x = 0;
	var y = 38;
	var anchorName = menus[i][0];
	var menuName = menus[i][1];
	if (isNav) {
	    x = document.anchors[anchorName].x;
	} else if (isIE) {
	    x = getWidth(eval(anchorName));
	} else if (isMoz) {
	    x = findPosX(document.getElementById(anchorName));
	}
	y = y + 14;
	if(window.navigator.platform.indexOf("Mac") != -1)
	{
	x = x -118;
	y = y -25;
	}
	move(menuName, x, y);
    }
}
onload = onresize = positionMenus;

function getObj(name)
{
  if (document.getElementById)
  {
    return document.getElementById(name);
  }
  else if (document.all)
  {
    return document.all[name];
  }
  else if (document.layers)
  {
    return document.layers[name];
  }
  else return false;
}


function hidePrice() {
	var priceObj = getObj('price');
	priceObj.style.display = 'none';
}
function showPrice() {
	var priceObj = getObj('price');
	priceObj.style.display = 'block';
}
function hideFee() {
	var feeObj = getObj('fee');
	feeObj.style.display = 'none';
}
function showFee() {
	var feeObj = getObj('fee');
	feeObj.style.display = 'block';
}


function goTo(location) {
    document.location.href=location;
}

function openPrintWindow(url) {
    var printWin = window.open(url, "_blank", "width=640,height=500,scrollbars,resizable,menubar,toolbar");
    if(printWin.print)
        printWin.print();
}

function openPolyWindow(url) {
    var polyWin = window.open(url, "polopoly", "width=800,height=600,scrollbars,resizable,status=yes,location=yes,menubar=yes,toolbar=yes");
    polyWin.focus();
}

function openMapWindow(url) {
    var mapWin = window.open(url, "map", "width=810,height=480,scrollbars=no,resizable,status=yes,location=yes,menubar=yes,toolbar=yes");
    mapWin.focus();
}
