var host = "global.conferenceplus.com";
var host1 = "www.conferenceplus.com";
var ft1 = "https://" + host + "/confcenter/accountRegistration/newhostsetup.aspx?cid=70540001720919&t=1";
var ft2 = "https://" + host + "/confcenter/accountRegistration/newhostsetup.aspx?cid=DIrWglPXHIkYIN&t=1";
var ft3 = "https://" + host + "/confcenter/accountRegistration/newhostsetup.aspx?cid=DmKMZNOJsZHeaV&t=1";
var ft4 = "https://" + host + "/confcenter/accountRegistration/newhostsetup.aspx?cid=DdeUAtYnVHEYtF&t=1";
var rg1 = "https://" + host + "/confcenter/accountRegistration/newhostsetup.aspx?cid=DrspSnhgWMjcOK&t=3"

var loc = document.location.toString();
var index = loc.indexOf(":");
  
var url = loc.substring(index, loc.length);
  
if (index == "4") { 
  secureUrl = "https" + url;
  location.replace(secureUrl); // get rid of current page in history
  location.href = secureUrl;
}

function InitPage() {
  MM_preloadImages('/images/button_signUpNowOn.gif','/images/button_learnMoreOn.gif');
  CheckForErrors();
  document.getElementById("txtLoginName").focus(); 
}

function CheckForErrors() {
  var qs = QueryString();

  if (qs.error != null) {
    if (qs.error == 1) {
      alert("The login information you have provided is incorrect, please try again.\nIf you still need assistance, please call +353 (0)1 240 0081 or +44 (0)207 153 0970.");
    }
    if (qs.error == 9) {
      alert("You have exceeded the maximum login attempts.\nThis account has been locked.");
    }
  }
}
  
function QueryString() {
   var qs = new Object();
   var query = location.search.substring(1);
   var pairs = query.split("&");

   qs.count = 0;

   for (var i = 0; i < pairs.length; i++) {
      var pos = pairs[i].indexOf('=');

      if (pos == -1) continue;

      var name = pairs[i].substring(0, pos).toLowerCase();
      var value = pairs[i].substring(pos + 1);

      qs[name] = unescape(value);

      qs.count++;
   }

   return qs;
}
  
function GetCookie(cookieName) {
  var cookieNameStart,valueStart,valueEnd,cookieValue,returnValue;
  cookieNameStart = document.cookie.indexOf(cookieName+'=');
  if (cookieNameStart < 0) {
    returnValue = null;
  } else {
    valueStart = document.cookie.indexOf(cookieName+'=') + cookieName.length + 1;
    valueEnd = document.cookie.indexOf(";",valueStart);
    if (valueEnd == -1) {
      valueEnd = document.cookie.length;
    }
    cookieValue = document.cookie.substring(valueStart,valueEnd );
    returnValue = (cookieValue == '') ? null : unescape(cookieValue);
  }
  return returnValue;
}

function GetHTTPObject() {
  if (window.XMLHttpRequest) { // Mozilla, Safari,...
    http = new XMLHttpRequest();
  } else if (window.ActiveXObject) { // IE
    try {
      http = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (i) {
      try {
        http = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (i) {}
    }
  }
  
  return http;
}

function GetPressReleases() {
  var http = GetHTTPObject();
  var url = document.location.protocol + "//" + host + "/services/pressreleases.aspx";
  http.open("POST", url, false);
  http.setRequestHeader("Content-Type", "application/json"); 
  http.send("");

  return JSON.parse(http.responseText);
}

function GetEmploymentOpenings() {
  var http = GetHTTPObject();
  var url = document.location.protocol + "//" + host + "/services/employment.aspx";
  http.open("POST", url, false);
  http.setRequestHeader("Content-Type", "application/json"); 
  http.send("");

  return JSON.parse(http.responseText);
}


function GetNewsLetters() {
  var http = GetHTTPObject();
  var url = document.location.protocol + "//" + host + "/services/newsletters.aspx";
  http.open("POST", url, false);
  http.setRequestHeader("Content-Type", "application/json"); 
  http.send("");

  return JSON.parse(http.responseText);
}

function GetDropDownLists() {
  var http = GetHTTPObject();
  var url = document.location.protocol + "//" + host + "/services/contact.aspx";
  http.open("POST", url, false);
  http.setRequestHeader("Content-Type", "application/json"); 
  http.send("");

  return JSON.parse(http.responseText);
}

function openWindow(URL, features) {
  var winA = window.open(URL, "_blank", features);
}
          
function ValidateRegion() {
  var r = document.getElementById("regionMenu");
  
  if (r.value != 0) {
    if (r.value <= 2) {
      parent.location = "http://" + host1;
    }
    return;
  }
  
  alert("Please select a valid region.");
}

function DisplayPromo() {
  var d = document;
  var u1 = "javascript:openWindow('http://g-meetings.com/','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=1024,height=768,left=0,top=165');";
  d.write('<a href="', u1, '"><img width="160" height="142" src="/images/green_web1.jpg" alt="Cleaner. Greener. Common Sense" /></a>');
}

function DisplayLoginForm() {
  var d = document;
  var u1 = "https://" + host + "/confcenterapp/processlogin.aspx?beid=100001";
  var u2 = "https://" + host + "/confcenter/accountRegistration/newhostsetup.aspx?cid=DrspSnhgWMjcOK&t=3";
  var u3 = "https://" + host + "/confcenterapp/pwforgot.aspx?beid=100001";
  var np;
  var nm = "";
  var ch = "";
  
  var ld = GetCookie('login');
  
  if (ld != null) {
    np = ld.split('=');
  
    if (np[0] == 'ln') {
      nm = np[1];
      ch = 'checked="True"';
    }
  }
  
  d.write('<form id="frmLogin" action="', u1, '" method="post" style="margin-top: 0px; margin-bottom: 0px;">');
  d.write('<div id="dashholdertop"></div>');
  d.write('<div id="meetingdashrmiddle">');
  d.write('<div class="pullheading">Account Dashboard</div>');
  d.write('<div class="pullsection">LOG IN&nbsp;<input id="txtLoginName" name="txtLoginName" type="text" tabindex="10" size="10" maxlength="50" style="font-size: 9px;" value="', nm, '" /><br />');
  d.write('<a href="', u2, '" title="Request a New Account"><span style="font-style: italic;">request a new account</span></a></div>');
  d.write('<div class="pullsection2">PASSWORD&nbsp;<input id="txtPassword" name="txtPassword" type="password" tabindex="20" size="10" maxlength="50" style="font-size: 9px;" value="" /><br />');
  d.write('<a href="', u3, '" title="Retrieve Your Password"><span style="font-style: italic;">retrieve password</span></a></div>');
  d.write('<div class="pullsection2" style="vertical-align: middle;">remember me &nbsp;<input id="cbRemember" name="cbRemember" type="checkbox" tabindex="30" ', ch, ' /></div>');
  d.write('<div style="padding-top: 10px; text-align: center;"><input type="image" src="/images/button_enter.gif" value="Submit" alt="ENTER" tabindex="40" /></div>');
  d.write('</div>');
  d.write('<div id="dashholderbottom"></div>');
  d.write('</form>');
}

function GoHome() {
	window.location = "/";
}

function DisplayRegionForm() {
  var d = document;
  d.write('<div id="divHome" style="width: 312px; height: 100px; position: absolute; top: 0; left: 0; cursor: pointer;" onclick="GoHome();"></div>');

  d.write('<div style="width: 180px;">');
  d.write('<div style="padding-bottom: 5px;">');
  d.write('<select name="regionMenu" id="regionMenu" style="font-size: 9px;">');
  d.write('<option value="0" selected="selected">Choose Region</option>');
  d.write('<option value="0">............................</option>');
  d.write('<option value="1">North America</option>');
  d.write('<option value="2">South America</option>');
  d.write('<option value="3">Europe</option>');
  d.write('<option value="4">Asia-PAC</option>');
  d.write('<option value="5">Middle East</option>');
  d.write('<option value="6">Africa</option>');
  d.write('<option value="0">............................</option>');
  d.write('</select>');
  d.write('</div>');
  d.write('<div><input type="button" value="submit" style="font-size: 9px;" onclick="ValidateRegion();" /></div>');
  d.write('</div>');
}

function DisplayMeetingCenter() {
  var d = document;
  var u1 = "https://" + host + "/ConfCenter/meeting_center/meeting_center.aspx?100001&jnhst=Y";
  var u2 = "https://" + host + "/ConfCenter/meeting_center/meeting_center.aspx?100001&jnhst=N";
  d.write('<div id="meetingholdertop"></div>');
  d.write('<div id="meetingholdermiddle">');
  d.write('<div class="pullheading">Meeting Center</div>');
  d.write('<div class="pullsection">');
  d.write('<a href="', u1, '" style="text-decoration: none;" title="Log in as the Meeting Host or Moderator">HOST/MODERATOR');
  d.write('<img width="19" height="19" align="absmiddle" src="/images/arrow.gif" style="padding-right: 4px; padding-left: 6px;" alt="" /></a></div>');
  d.write('<div class="pullsection2">');
  d.write('<a href="', u2, '" style="text-decoration: none;" title="Log in as a Meeting Participant">PARTICIPANT');
  d.write('<img width="19" height="19" align="absmiddle" src="/images/arrow.gif" style="padding-right: 4px; padding-left: 6px;" alt="" /></a></div>');
  d.write('</div>');
  d.write('<div id="meetingholderbottom"></div>');
}

function DisplayCreateAccount() {
  var d = document;
  d.write('<div id="createholdertop"></div>');
  d.write('<div id="createholdermiddle">');
  d.write('<div class="pullheading">Create An Account</div>');
  d.write('<div class="pullsection">');
  d.write('<a href="', rg1, '" style="text-decoration: none;" title="Create an Account Now">GET STARTED');
  d.write('<img width="19" height="19" align="absmiddle" src="/images/arrow.gif" style="padding-right: 4px; padding-left: 6px;" alt="" /></a></div>');
  d.write('</div>');
  d.write('<div id="createholderbottom"></div>');
}
