﻿var ignoreRadioID, triggerRadioLastID, triggerRadioLastID2, accessoryNumericInputLoadingPanelID, accessoryNumericInputUpdatedControlID;
function carCompare_SwitchLock(a, b) {
  var d = document.getElementById(a), e = document.getElementById(b), d = d.checked ? e : d;
  d.checked = true;
  eval(d.attributes.onclick.value)
}
function SetRowOver(a) {
  if(a.className != "selected") {
    a.className = "hover"
  }
}
function SetRowNormal(a) {
  if(a.className != "selected") {
    a.className = ""
  }
}
function SetRowSelected(a, b) {
  ignoreRadioID = a.id;
  ClearRowsClass(document.getElementById(b));
  if(a.checked == true) {
    for(var d = a.parentNode.parentNode;d.nodeName != "TR" && d != null;) {
      d = d.parentNode
    }
    if(d.nodeName == "TR") {
      d.className = "selected"
    }
  }
}
function SetRowSelectedCheckBox(a) {
  for(var b = a.parentNode.parentNode;b.nodeName != "TR" && b != null;) {
    b = b.parentNode
  }
  if(b.nodeName == "TR") {
    b.className = a.checked == true ? "selected" : ""
  }
}
function ClearRowsClass(a) {
  for(var a = a.childNodes, b = 0;b < a.length;b++) {
    var d = a[b];
    d.nodeName == "TR" ? (d.className = "", ClearRowsClass(d)) : d.nodeName == "INPUT" && d.type == "radio" && d.id != ignoreRadioID ? d.checked = false : ClearRowsClass(d)
  }
}
function SelectRadio(a, b) {
  UnselectAllRadios(b);
  var d = document.getElementById(a);
  d.checked = true;
  SetRowSelected(d, b)
}
function UnselectAllRadios(a) {
  for(var a = document.getElementById(a).getElementsByTagName("input"), b = 0;b < a.length;b++) {
    a[b].checked = false
  }
}
function SetCheckboxState(a, b) {
  var d = document.getElementById(a), e = document.getElementById(b);
  d.checked = !d.checked;
  e.className = d.checked == true ? "selected" : ""
}
function SetCheckboxParentClass(a, b) {
  var d = document.getElementById(a);
  document.getElementById(b).className = d.checked == true ? "selected" : ""
}
function ToggleAreaVisibility(a, b, d, e) {
  a = document.getElementById(a);
  b = document.getElementById(b);
  a.style.display = a.style.display == "block" ? "none" : "block";
  b.innerText = a.style.display == "block" ? d : e;
  b.className = a.style.display == "block" ? "bmclgHeaderInnerRightClose" : "bmclgHeaderInnerRightOpen"
}
function SaveAreaVisibilityToHidden(a, b) {
  document.getElementById(b).value = document.getElementById(a).style.display == "block" ? "true" : "false"
}
function InitiateAjaxRequestAsynch(a, b) {
  InitiateAjaxRequest(a, b)
}
function InitiateAjaxRequest(a, b) {
  ShowModalPopup("conflictLoading");
  $find("ctl00_ctl00_CTop_CBody_radAjaxManager").ajaxRequest(b)
}
function ShowConflictModalPopup(a) {
  a = window.radopen(a, null);
  if(a != null && (a.moveTo(GetModalWindowPositionX(), GetModalWindowPositionY()), a != null)) {
    a._iframe.allowTransparency = true, navigator.userAgent.toUpperCase().indexOf("MSIE 6.") != -1 && SetShowWrapperChangesForIE6(a), a.add_close(OnConflictClientClose)
  }
}
function ShowModalPopupWithClientClose(a) {
  a = window.radopen(a, null);
  if(a != null && (a.moveTo(GetModalWindowPositionX(), GetModalWindowPositionY()), a.add_close(CloseFromItself), a != null)) {
    a._iframe.allowTransparency = true, navigator.userAgent.toUpperCase().indexOf("MSIE 6.") != -1 && SetShowWrapperChangesForIE6(a)
  }
}
function ShowModalPopupLease(a) {
  a = window.radopen(a, null);
  a != null && (a.moveTo(GetModalWindowPositionX(), GetModalWindowPositionY()), a.add_close(OnLeaseClientClose))
}
function OnLeaseClientClose() {
  $find("ctl00_ctl00_CTop_CBody_radAjaxManager").ajaxRequest("ctl00_ctl00_CTop_rightInfo");
  oWnd = GetRadWindowManager();
  oWnd.remove_close(OnLeaseClientClose)
}
function GetModalWindowPositionX() {
  return document.getElementById("bodyContainer") != null ? $telerik.getLocation(document.getElementById("bodyContainer")).x : 0
}
function GetModalWindowPositionY() {
  return document.getElementById("bodyContainer") != null ? $telerik.getLocation(document.getElementById("bodyContainer")).y : 0
}
function ShowModalPopupNew(a) {
  var b = window.radopen(a, null);
  if(b != null && (b.moveTo(GetModalWindowPositionX(), GetModalWindowPositionY()), navigator.userAgent.toUpperCase().indexOf("MSIE 6.") != -1 && b == null && window.setTimeout(function() {
    ShowModalPopupNew(a)
  }, 1E3), b != null)) {
    b._iframe.allowTransparency = true, navigator.userAgent.toUpperCase().indexOf("MSIE 6.") != -1 && SetShowWrapperChangesForIE6(b)
  }
}
function ShowModalPopup(a) {
  var b = GetRadWindowManager();
  b != null && (b = window.radopen(null, a), b != null && b.moveTo(GetModalWindowPositionX(), GetModalWindowPositionY()))
}
function GetRadWindowDelayed(a) {
  return window.radopen(null, a)
}
function ShowModalPopupWithUrl(a, b) {
  window.radopen(b, a);
  var d = GetWindow(a);
  if(d != null && d != null) {
    d._iframe.allowTransparency = true, navigator.userAgent.toUpperCase().indexOf("MSIE 6.") != -1 && SetShowWrapperChangesForIE6(d)
  }
}
function HideModalPopup(a) {
  a = GetWindow(a);
  a != null && a != null && (navigator.userAgent.toUpperCase().indexOf("MSIE 6.") != -1 && SetHideWrapperChangesForIE6(a), a.Close())
}
function SetShowWrapperChangesForIE6(a) {
  if(a != null) {
    if(a._iframe != null) {
      a._iframe.width = "100%", a._iframe.height = "100%", a._iframe.style.top = "0px", a._iframe.style.left = "0px"
    }
    if(a.WrapperElement != null) {
      a.WrapperElement.style.width = "100%", a.WrapperElement.style.height = "100%", a.WrapperElement.style.top = "0px", a.WrapperElement.style.left = "0px", a.WrapperElement.style.position = "absolute", a.WrapperElement.style.display = "block"
    }
  }
}
function SetHideWrapperChangesForIE6(a) {
  if(a != null) {
    if(a._iframe != null) {
      a._iframe.width = "0px", a._iframe.height = "0px", a._iframe.style.top = "0px", a._iframe.style.left = "0px", a._iframe.display = "none"
    }
    if(a.WrapperElement != null) {
      a.WrapperElement.style.width = "0px", a.WrapperElement.style.height = "0px", a.WrapperElement.style.top = "0px", a.WrapperElement.style.left = "0px", a.WrapperElement.style.position = "static", a.WrapperElement.style.display = "none"
    }
  }
}
function ShowPopupCarCompare(a, b) {
  var d = document.getElementById(a);
  d.src = b + "&" + GetCurrentDate();
  d.style.display = "block"
}
function HidePopupCarCompare(a) {
  window.top.document.getElementById(a).style.display = "none"
}
function GetWindow(a) {
  return GetRadWindowManager().GetWindowByName(a)
}
function GetWindowFromItself() {
  var a = null;
  if(window.radWindow) {
    a = window.radWindow
  }else {
    if(window.frameElement.radWindow) {
      a = window.frameElement.radWindow
    }
  }
  a != null && SetHideWrapperChangesForIE6(a);
  return a
}
function CloseFromItself() {
  GetWindowFromItself().Close()
}
function OnClose(a, b) {
  InitiateAjaxRequest(a, b)
}
function InitiateLeaseAjaxRequest(a, b) {
  $find("ctl00_ctl00_CTop_CBody_radAjaxManager").ajaxRequest(b)
}
function OnConflictClientClose(a, b) {
  oWnd = GetRadWindowManager();
  oWnd.remove_close(OnConflictClientClose);
  InitiateAjaxRequest(b, "ctl00_ctl00_CTop_CBody_equipmentExtraList")
}
function IsAtLeastOneItemCheck(a) {
  for(var b = 0;b < a.length;b++) {
    if(document.getElementById(a[b]).checked) {
      return true
    }
  }
  return false
}
function DisableItems(a, b) {
  for(var d = document.getElementById(a).checked, e = 0;e < b.length;e++) {
    var f = document.getElementById(b[e]);
    if(f != null) {
      f.disabled = d
    }
  }
}
function SetStateAllOpositeItems(a, b, d, e, f, g) {
  a = document.getElementById(a);
  b = document.getElementById(b);
  f = document.getElementById(f);
  g = document.getElementById(g);
  d = IsAtLeastOneItemCheck(d);
  e = IsAtLeastOneItemCheck(e);
  a.disabled = !d && e;
  b.disabled = !e && d;
  f.disabled = !d;
  g.disabled = !e
}
function ShowLoadingPanel(a, b) {
  var d = $find(a);
  d != null && d.show(b)
}
function HideLoadingPanel(a, b) {
  var d = $find(a);
  d != null && d.hide(b)
}
function ShowLoadingPanelCenterWhenChecked(a, b, d) {
  a = document.getElementById(a);
  a != null && a.checked && (b = $find(b), b != null && b.show(d))
}
function AccessoryNumericUpDownBlur(a) {
  var b = a.GetValue();
  (b == null || b == "") && a.SetValue("0")
}
function AccessoryNumericValueChanged(a, b) {
  (b.NewValue == 1 && b.OldValue == 0 || b.NewValue == 0 && b.OldValue == 1) && ShowLoadingPanel(accessoryNumericInputLoadingPanelID, accessoryNumericInputUpdatedControlID)
}
function InitAccessoryNumericLoadingPanel(a, b) {
  accessoryNumericInputLoadingPanelID = a;
  accessoryNumericInputUpdatedControlID = b
}
function SetVisibilityStyleForClientElement(a, b) {
  var d = document.getElementById(a);
  if(d != null) {
    d.style.display = b
  }
}
function ShowElement(a) {
  a = document.getElementById(a);
  if(a != null) {
    a.style.display = "block"
  }
}
function HideElement(a) {
  a = document.getElementById(a);
  if(a != null) {
    a.style.display = "none"
  }
}
function GetCurrentDate() {
  var a = new Date;
  return a.getDay().toString() + a.getMonth().toString() + a.getFullYear().toString() + a.getHours().toString() + a.getMinutes().toString() + a.getSeconds().toString() + a.getMilliseconds().toString()
}
function ConfirmGarageCarRemove(a) {
  return confirm(a) ? true : false
}
function ReloadConflictsWithClearSelection(a) {
  window.top.location.href = a
}
function FocusItem(a) {
  a = document.getElementById(a);
  a != null && a.focus()
}
function SetValueToInput(a, b) {
  var d = document.getElementById(a);
  if(d != null) {
    d.value = b
  }
}
function createCookie(a, b, d) {
  if(d) {
    var e = new Date;
    e.setTime(e.getTime() + d * 864E5);
    d = "; expires=" + e.toGMTString()
  }else {
    d = ""
  }
  document.cookie = a + "=" + b + d + "; path=/"
}
function readCookie(a) {
  a += "=";
  for(var b = document.cookie.split(";"), d = 0;d < b.length;d++) {
    for(var e = b[d];e.charAt(0) == " ";) {
      e = e.substring(1, e.length)
    }
    if(e.indexOf(a) == 0) {
      return e.substring(a.length, e.length)
    }
  }
  return null
}
function eraseCookie(a) {
  createCookie(a, "", -1)
}
function FlipStandardEquipmentVisibility(a, b, d, e) {
  a = document.getElementById(a);
  b = document.getElementById(b);
  a.style.display = a.style.display == "block" ? "none" : "block";
  b.src = a.style.display == "block" ? e : d
}
function FlipPricesVisibility(a, b, d, e) {
  a = document.getElementById(a);
  b = document.getElementById(b);
  navigator.userAgent.toUpperCase().indexOf("MSIE 6.") != -1 || navigator.userAgent.toUpperCase().indexOf("MSIE 7.") != -1 ? (a.style.display = a.style.display == "block" ? "none" : "block", b.src = a.style.display == "block" ? e : d) : (a.style.display = a.style.display == "table-row" ? "none" : "table-row", b.src = a.style.display == "table-row" ? e : d)
}
function IsTriggerRadioButton(a) {
  return a != triggerRadioLastID ? (triggerRadioLastID = a, true) : false
}
function IsTriggerRadioButton2(a) {
  return a != triggerRadioLastID2 ? (triggerRadioLastID2 = a, true) : false
}
function ShowInteriorCollissionDIV(a, b) {
  ProcessInteriorCollissionDIVs("none", b);
  ProcessInteriorCollissionDIVs("inline", a)
}
function ProcessInteriorCollissionDIVs(a, b) {
  var d = document.getElementById(b);
  if(d != null) {
    for(var d = d.getElementsByTagName("span"), e = 0;e < d.length;e++) {
      if(d[e].attributes.isCollissionDiv != null) {
        d[e].style.display = a
      }
    }
  }
}
function ShowPricesRow(a, b) {
  ProcessPricesRows("none", b);
  var d = document.getElementById(a);
  if(d != null) {
    d.style.display = navigator.userAgent.toUpperCase().indexOf("MSIE 6.") != -1 || navigator.userAgent.toUpperCase().indexOf("MSIE 7.") != -1 ? "block" : "table-row"
  }
}
function ProcessPricesRows(a, b) {
  var d = document.getElementById(b);
  if(d != null) {
    for(var d = d.getElementsByTagName("tr"), e = 0;e < d.length;e++) {
      if(d[e].attributes.isPricesRow != null) {
        d[e].style.display = a
      }
    }
  }
}
function ShowPricesRowExtra(a, b) {
  var d = document.getElementById(a);
  if(d != null) {
    d.style.display = b == "checked" ? navigator.userAgent.toUpperCase().indexOf("MSIE 6.") != -1 || navigator.userAgent.toUpperCase().indexOf("MSIE 7.") != -1 ? "block" : "table-row" : "none"
  }
}
var cacheDictionary, specificSeparatorStart = "<??{0}??>", specificSeparatorEnd = "</??{0}??>", selectedTabID;
function AssureDictionary() {
  cacheDictionary == null && (cacheDictionary = new CacheDictionary);
  return cacheDictionary
}
function AddMiddlePartToDictionary(a, b) {
  AssureDictionary();
  var d = document.getElementById(b);
  d != null && cacheDictionary.Lookup(a) == null && cacheDictionary.Add(a, d.innerHTML)
}
function AddRightPartToDictionary(a, b, d) {
  if(d != "lease" && (AssureDictionary(), b = document.getElementById(b), b != null)) {
    var e = specificSeparatorStart.replace("{0}", d), d = specificSeparatorEnd.replace("{0}", d);
    cacheDictionary.Lookup(a) == null ? cacheDictionary.Add(a, e + b.innerHTML + d) : IsSubstringContained(cacheDictionary[a], e) || (cacheDictionary[a] += e + b.innerHTML + d)
  }
}
function IsSubstringContained(a, b) {
  return a.indexOf(b, 0) >= 0
}
function DetermineMiddlePartFromCache(a, b) {
  AssureDictionary();
  var d = cacheDictionary.Lookup(a) != null;
  if(d) {
    document.getElementById(b).innerHTML = cacheDictionary[a]
  }
  return d
}
function DetermineRightPartFromCache(a, b) {
  AssureDictionary();
  var d = cacheDictionary.Lookup(a) != null;
  if(d) {
    var e = specificSeparatorStart.replace("{0}", selectedTabID), f = specificSeparatorEnd.replace("{0}", selectedTabID);
    if(!IsSubstringContained(cacheDictionary[a], e)) {
      return false
    }
    document.getElementById(b).innerHTML = GetFragmentHtmlFromRightPart(cacheDictionary[a], e, f)
  }
  return d
}
function DetermineRightPartFromCacheForExterior(a, b, d) {
  d = GetSelectedRadioButton(d);
  d != null && (a = a.replace("{0}", d.attributes.interiorID != null ? d.attributes.interiorID.nodeValue : d.parentNode.attributes.interiorID.nodeValue));
  return DetermineRightPartFromCache(a, b)
}
function DetermineRightPartFromCacheForInterior(a, b, d) {
  d = GetSelectedRadioButton(d);
  d != null && (a = a.replace("{0}", d.attributes.exteriorID != null ? d.attributes.exteriorID.nodeValue : d.parentNode.attributes.exteriorID.nodeValue));
  return DetermineRightPartFromCache(a, b)
}
function GetFragmentHtmlFromRightPart(a, b, d) {
  var e = a.indexOf(b), f = a.lastIndexOf(d) + d.length;
  return e == -1 ? null : a.toString().substring(e, f).replace(b, "").replace(d, "")
}
function SetRightPartSelectedTab(a) {
  selectedTabID = a
}
function GetSelectedRadioButton(a) {
  a = document.getElementById(a);
  if(a == null) {
    return null
  }
  for(var a = a.getElementsByTagName("input"), b = 0;b < a.length;b++) {
    if(a[b].checked == true) {
      return a[b]
    }
  }
  return null
}
function Lookup(a) {
  return this[a]
}
function Delete() {
  for(c = 0;c < Delete.arguments.length;c++) {
    this[Delete.arguments[c]] = null
  }
  for(var a = [], b = 0;b < this.Keys.length;b++) {
    this[this.Keys[b]] != null && (a[a.length] = this.Keys[b])
  }
  this.Keys = a
}
function Add() {
  for(c = 0;c < Add.arguments.length;c += 2) {
    this[Add.arguments[c]] = Add.arguments[c + 1], this.Keys[this.Keys.length] = Add.arguments[c]
  }
}
function CacheDictionary() {
  this.Add = Add;
  this.Lookup = Lookup;
  this.Delete = Delete;
  this.Keys = []
}
;
