﻿//alert('js included');
//alert(location.href);  //temp


// This strips the WWW
/*
if (location.href.indexOf('http://www.') == 0) {
  //alert('changing www - REMOVE THIS AFTER TESTING');  

  var sNo3wURL = location.href.replace(/http:\/\/www./, 'http://');
  //alert(sNo3wURL);
  location.href = sNo3wURL;
}
*/

//This add WWW
if (location.href.indexOf('http://ilive.at') == 0) {
  //alert('changing mapthelist - REMOVE THIS AFTER TESTING');  

  var sNoMapTheListURL = location.href.replace(/http:\/\/ilive.at/, 'http://www.ilive.at');
  //alert(sNoMapTheListURL);
  location.href = sNoMapTheListURL;
}


//Convert URL of any domain we point to iLive.at to iLive.at
/*
if(location.href.indexOf('http://mapthislist.com')==0){
//alert('changing mapthelist - REMOVE THIS AFTER TESTING');  
      
var sNoMapTheListURL = location.href.replace(/http:\/\/mapthislist.com/, 'http://ilive.at');
//alert(sNoMapTheListURL);
location.href=sNoMapTheListURL;
}
*/

function HideElement(sName) {
  //alert("HideElement: " + sName);
  if (document.getElementById(sName) != null) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
      //ie
      document.getElementById(sName).style.visibility = "hidden";
    } else {
      //firefox
      document.getElementById(sName).setAttribute('class', 'invisible');
    }
  }
}

function SetElementWidthToZero(sName) {
  //alert("SetElementWidthToZero: " + sName);
  if (document.getElementById(sName) != null) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
      //ie
      document.getElementById(sName).style.width = 0;
    } else {
      //firefox
      document.getElementById(sName).setAttribute('style', 'width:0px;');
    }
  }
}

function UnHideElement(sName) {
  //alert("UnHideElement: " + sName);
  if (document.getElementById(sName) != null) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
      //ie
      document.getElementById(sName).style.visibility = "visible";
    } else {
      //firefox
      document.getElementById(sName).setAttribute('class', 'visible');
    }
  }
}

function SetElementBgColor(sBaseName, sColor) {
  //alert("SetElementBgColor: " + sName + "|" + sColor + "|" + 1);

  var sElementName_Content = "ctl00_ContentPlaceHolder1_" + sBaseName + "1_tr" + sBaseName + "Content";
  var sElementName_HdnFldSelected = "ctl00_ContentPlaceHolder1_" + sBaseName + "1_hdnFld" + sBaseName + "Selected";

  //alert("SetElementBgColor: " + sName + "|" + sColor + "|" + sElementName_Content + "|" + sElementName_HdnFldSelected);

  if (document.getElementById(sElementName_HdnFldSelected) != null) {
    //alert(document.getElementById(sElementName_HdnFldSelected).value);
    if ((document.getElementById(sElementName_HdnFldSelected).value == '0') || (document.getElementById(sElementName_HdnFldSelected).value == '')) {
      if (document.getElementById(sElementName_Content) != null) {
        if (navigator.appName.indexOf("Microsoft") != -1) {
          //ie
          document.getElementById(sElementName_Content).style.backgroundColor = sColor;
        } else {
          //firefox
          document.getElementById(sElementName_Content).setAttribute('style', 'background-color:' + sColor + ';');
        }
      }
    }
  }
}
