// JavaScript Document
var xmlHttp = false;
if (!xmlHttp)
{
  //xmlHttp = new XMLHttpRequest();
  if(window.XMLHttpRequest)
	 {// Firefox, Safari, Opera... 
		  xmlHttp = new XMLHttpRequest(); 
	 }else if(window.ActiveXObject) 
	 {// Internet Explorer 5+ 
		  xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	 }else { 
		  alert('Problem creating the XMLHttpRequest object'); 
	 } 
	 
}


function checkLogin()
{	
	var uname;
	var pword;
	uname = document.getElementById("txtUsername").value;
	pword = document.getElementById("txtPassword").value;
	if(document.getElementById("gotoPage")){
		gpage = document.getElementById("gotoPage").value;
	}else{
		gpage = "";	
	}
	
	xmlHttp.open ("GET", "ajax/checkLogin.asp?uName=" + uname + "&pWord=" + pword, true);
	
	xmlHttp.onreadystatechange = function ()
		{
			if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
			{
				// Update this text.
				response = response = xmlHttp.responseText.split("|");
				if(response[0]=="1"){
					if(gpage.length>0){
						window.location = "SessionTransfer.asp?dir=2aspx&url=" + gpage + "&uId=" + response[2].toString() + "&e=" + response[3].toString() + "&g=" + response[4].toString(); 
					}else{
						window.location = "SessionTransfer.asp?dir=2aspx&url=" + response[1] + "&uId=" + response[2].toString() + "&e=" + response[3].toString() + "&g=" + response[4].toString();
					}
				}else{
					alert(response[1]);
				}
			}
		}
		xmlHttp.send (null);
}


function checkCarluLogin()
{	
	var uname;
	var pword;
	uname = document.getElementById("txtUsername").value;
	pword = document.getElementById("txtPassword").value;
	if(document.getElementById("gotoPage")){
		gpage = document.getElementById("gotoPage").value;
	}else{
		gpage = "";	
	}
	
	xmlHttp.open ("GET", "ajax/checkCarluLogin.asp?uName=" + uname + "&pWord=" + pword, true);
	
	xmlHttp.onreadystatechange = function ()
		{
			if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
			{
				// Update this text.
				response = response = xmlHttp.responseText.split("|");
				if(response[0]=="1"){
					if(gpage.length>0){
						window.location = gpage; 					
					}
				}else{
					alert(response[1]);
				}
			}
		}
		xmlHttp.send (null);
}


function checkVegasLogin()
{	
	var uname;
	var pword;
	uname = document.getElementById("txtUsername").value;
	pword = document.getElementById("txtPassword").value;
	if(document.getElementById("gotoPage")){
		gpage = document.getElementById("gotoPage").value;
	}else{
		gpage = "";	
	}
	
	xmlHttp.open ("GET", "ajax/checkVegasLogin.asp?uName=" + uname + "&pWord=" + pword, true);
	
	xmlHttp.onreadystatechange = function ()
		{
			if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
			{
				// Update this text.
				response = response = xmlHttp.responseText.split("|");
				if(response[0]=="1"){
					if(gpage.length>0){
						window.location = gpage; 					
					}
				}else{
					alert(response[1]);
				}
			}
		}
		xmlHttp.send (null);
}



function addEmailReminder()
{	
	var fname;
	var email;
	fname = document.getElementById("txtName").value;
	email = document.getElementById("txtEmail").value;

	if(fname=="Name"){
		alert("Please enter your name!");
		return false;
	}
	
	if(email=="Email"){
		alert("Please enter your email address!");
		return false;
	}
	
	
	xmlHttp.open ("GET", "ajax/addNotifyUser.asp?txtName=" + fname + "&txtEmail=" + email, true);
	
	xmlHttp.onreadystatechange = function ()
		{
			if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
			{
				// Update this text.
				response = response = xmlHttp.responseText.split("|");
				if(response[0]=="1"){
						//window.location = gpage; 
						document.getElementById("divCebSummit").style.display = "none";
						document.getElementById("divThankYou").style.display = "block";
					
				}else{
					alert(response[1]);
				}
			}
		}
		xmlHttp.send (null);
}

function addEmailReminderV2()
{	
	var fname;
	var lname;
	var title;
	var company;
	var phone;
	var email;
	var price;
	fname = document.getElementById("txtFirstName").value;
	lname = document.getElementById("txtLastName").value;
	title = document.getElementById("txtTitle").value;
	company = document.getElementById("txtCompany").value;
	phone = document.getElementById("txtPhone").value;
	email = document.getElementById("txtEmail").value;
	
	if(document.getElementById("radPrice1").checked)
		price = document.getElementById("radPrice1").value;
	else if(document.getElementById("radPrice2").checked)
		price = document.getElementById("radPrice2").value;
	else
		price = '';

	if(fname=="First Name"){
		alert("Please enter your first name!");
		return false;
	}
	
	if(lname=="Last Name"){
		alert("Please enter your last name!");
		return false;
	}
	
	if(title=="Title"){
		alert("Please enter your title!");
		return false;
	}
	
	if(company=="Company"){
		alert("Please enter your company!");
		return false;
	}
	
	if(phone=="Phone Number"){
		alert("Please enter your phone number!");
		return false;
	}
	
	if(email=="E-mail"){
		alert("Please enter your email address!");
		return false;
	}
	
	//alert("ajax/addNotifyUserV2.asp?txtName=" + fname + " " + lname + "&txtTitle=" + title + "&txtCompany=" + company + "&txtPhone=" + phone + "&txtEmail=" + email + "&radPrice=" + price);
	xmlHttp.open ("GET", "ajax/addNotifyUserV2.asp?txtName=" + fname + " " + lname + "&txtTitle=" + title + "&txtCompany=" + company + "&txtPhone=" + phone + "&txtEmail=" + email + "&radPrice=" + price, true);
	
	xmlHttp.onreadystatechange = function ()
	{
		if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
		{
			// Update this text.
			response = response = xmlHttp.responseText.split("|");
			if(response[0]=="1"){
					//window.location = gpage; 
					document.getElementById("divCebSummit").style.display = "none";
					document.getElementById("divThankYou").style.display = "block";
				
			}else{
				alert(response[1]);
			}
		}
	}
	xmlHttp.send (null);
	
}




		
		function closeDiv(divId){
				document.getElementById('blackBackground').style.display = "none";
				document.getElementById(divId).style.display = "none";
		}
		
		
		
		
		function openDiv(divId){
				document.getElementById('blackBackground').style.display = "block";
				document.getElementById(divId).style.display = "block";
		}
