﻿// Trim text in textbox
function TrimTextbox(txt) {
    txt.value = Trim(txt.value)
}

// Trim string (both beginning and ending)
function Trim(str) {
    while (str.substring(0,1) == ' ') {
        str = str.substring(1, str.length)
    }
    
    while (str.substring(str.length-1, str.length) == ' ') {
        str = str.substring(0,str.length-1)
    }
    
    return str
}

// Öppna prislista i eget fönster
var winPriceList

function openPriceList() {
    var intLeft
    
    // left window position
    intLeft = window.screen.width - 500

    if (winPriceList == null || winPriceList.closed) {
        winPriceList = window.open('priser.htm','Prislista','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,fullscreen=no,width=480,height=500,top=20,left=' + intLeft)
    } else {
        winPriceList.focus()
    }
}

function confirmClose(evt) {
  var message = 'DE INMATADE BOKNINGSUPPGIFTERNA KOMMER INTE SPARAS!'
  if (typeof evt == 'undefined') {
    evt = window.event
  }
  if (evt) {
    evt.returnValue = message
  }
  return message
}