var imgs = new Array();
var sizers = new Array();

function preload()
{
imgs[0] = new Image();
imgs[0].src = "/images/Banner-1.jpg"

imgs[1] = new Image();
imgs[1].src = "/images/Banner-2.jpg"

imgs[2] = new Image();
imgs[2].src = "/images/Banner-3.jpg"

imgs[3] = new Image();
imgs[3].src = "/images/Banner-4.jpg"

imgs[4] = new Image();
imgs[4].src = "/images/Banner-5.jpg"

imgs[5] = new Image();
imgs[5].src = "/images/Banner-6.jpg"

sizers[0] = new Image();
sizers[0].src = "/images/minus-box.gif"

sizers[1] = new Image();
sizers[1].src = "/images/plus-box.gif"
}

var ArrayPos = 0
function BannerSwap() {
	ArrayPos += 1;
	if (ArrayPos == 6)
	{
		ArrayPos = 0;
	}
	if (browser.isIE)
	{
		BannerIMG.filters.revealTrans.apply();
		BannerIMG.filters.blendTrans.apply();
	}
	document.getElementById("BannerIMG").src = imgs[ArrayPos].src;

	if (browser.isIE)
	{
		BannerIMG.filters.revealTrans.play();
		BannerIMG.filters.blendTrans.play();	
	}
}


function window_onload() {
	document.getElementById("BannerIMG").alt = document.title;
	preload();
	setInterval(BannerSwap,5000);
	document.oncontextmenu=Copyright;
}

function getNewHTTPObject()
{
	var xmlhttp = false
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	 try {
	  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
	  try {
	   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (E) {
	   xmlhttp = false;
	  }
	 }
	@end @*/
  
  	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			xmlhttp=false;
		}
	}
	if (!xmlhttp && window.createRequest) {
		try {
			xmlhttp = window.createRequest();
		} catch (e) {
			xmlhttp=false;
		}
	}

    return xmlhttp;
}

// Determine browser and version.
function Browser() {

  var ua, s, i;

  this.isIE    = false;
  this.isNS    = false;
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

var browser = new Browser();

// Global object to hold drag information.

var dragObj = new Object();
dragObj.zIndex = 0;

function dragStart(event, id)
{
	if (browser.isIE)
	{
		if(window.event.srcElement.tagName=="TEXTAREA" || window.event.srcElement.tagName=="INPUT" || window.event.srcElement.tagName=="SELECT")
		{return false}
	}
	if (browser.isNS)
	{
		if(event.target.tagName=="TEXTAREA" || event.target.tagName=="INPUT" || event.target.tagName=="SELECT")
		{return false}
	}
	
	document.getElementById(id).style.cursor='move';
	var el;
	var x, y;

	// If an element id was given, find it. Otherwise use the element being
	// clicked on.

	if (id)
	  dragObj.elNode = document.getElementById(id);
	else {
	  if (browser.isIE)
	    dragObj.elNode = window.event.srcElement;
	  if (browser.isNS)
	    dragObj.elNode = event.target;

	  // If this is a text node, use its parent element.

	  if (dragObj.elNode.nodeType == 3)
	    dragObj.elNode = dragObj.elNode.parentNode;
	}

	// Get cursor position with respect to the page.

	if (browser.isIE) {
	  x = window.event.clientX + document.documentElement.scrollLeft
	    + document.body.scrollLeft;
	  y = window.event.clientY + document.documentElement.scrollTop
	    + document.body.scrollTop;
	}
	if (browser.isNS) {
	  x = event.clientX + window.scrollX;
	  y = event.clientY + window.scrollY;
	}

	// Save starting positions of cursor and element.

	dragObj.cursorStartX = x;
	dragObj.cursorStartY = y;
	dragObj.elStartLeft  = parseInt(dragObj.elNode.style.left, 10);
	dragObj.elStartTop   = parseInt(dragObj.elNode.style.top,  10);

	if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0;
	if (isNaN(dragObj.elStartTop))  dragObj.elStartTop  = 0;

	// Update element's z-index.

	dragObj.elNode.style.zIndex = ++dragObj.zIndex;

	// Capture mousemove and mouseup events on the page.

	if (browser.isIE) {
	  document.attachEvent("onmousemove", dragGo);
	  document.attachEvent("onmouseup",   dragStop);
	  window.event.cancelBubble = true;
	  window.event.returnValue = false;
	}
	if (browser.isNS) {
	  document.addEventListener("mousemove", dragGo,   true);
	  document.addEventListener("mouseup",   dragStop, true);
	  event.preventDefault();
	}
}

function dragGo(event) {

  var x, y;

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Move drag element by the same amount the cursor has moved.

  dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px";
  dragObj.elNode.style.top  = (dragObj.elStartTop  + y - dragObj.cursorStartY) + "px";

  if (browser.isIE) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS)
    event.preventDefault();
}

function dragStop(event) {

  // Stop capturing mousemove and mouseup events.

  if (browser.isIE) {
    document.detachEvent("onmousemove", dragGo);
    document.detachEvent("onmouseup",   dragStop);
  }
  if (browser.isNS) {
    document.removeEventListener("mousemove", dragGo,   true);
    document.removeEventListener("mouseup",   dragStop, true);
  }
}


/************************************************************
Scripts to show enlarged images from thumbnails
************************************************************/

var current_width = 600
var image_source = ""
var resized = false

function ShowImage(id,manip,e)
{
	document.getElementById("fullsize").style.display = "block";
	if(browser.isIE)
	{
		document.getElementById("fullsize").style.width = 600
		document.getElementById("fullsize").style.height = 350
		document.getElementById("fullsize").innerHTML = "<span id=sizers><IMG SRC='/images/minus-box.gif' alt='click to reduce image by 25%' onclick='ReduceImage()'><IMG SRC='/images/plus-box.gif' alt='click to enlarge image by 25%' onclick='EnlargeImage()'><IMG SRC='/images/x-box.gif' alt='click to close image' onclick='Close_Image()'></span><br><div id=fullsizebox><img id='theimage' alt='Double click to close' src='/enlarge_image.asp?id="+id+"&width=600"+manip+"'><br><span clear=both>click anywhere and drag to move image</span></div>";
	}
	else
	{
		document.getElementById("fullsize").innerHTML = "<span id=sizers><IMG SRC='/images/x-box.gif' alt='click to close image' onclick='Close_Image()'></span><br><div id=fullsizebox><img id='theimage' alt='Double click to close' src='/enlarge_image.asp?id=" + id + "&width=600"+manip+"'><br><span clear=both>double click image to close</span></div>";
	}
	document.getElementById("fullsize").style.display = "block";
	xpos = (document.body.offsetWidth / 2) - 150;
	document.getElementById("fullsize").style.left = xpos
	if(browser.isIE)
	{
		document.getElementById("fullsize").style.top = window.event.clientY - 100;
	}
	else
	{
		document.getElementById("fullsize").style.top = e.pageY - 100;
	}
	current_width = theimage.offsetWidth;
	image_source = theimage.src;
	document.getElementById("fullsize").style.width = 'auto'
}

function ReduceImage()
{
	newwidth = document.getElementById("theimage").width - (document.getElementById("theimage").width * 25/100);
	current_width = newwidth;
	theimage.style.width = newwidth;
	theimage.src = image_source + "&newwidth=" + newwidth;
	fullsize.style.width = 'auto'
	fullsize.style.height = theimage.offsetHeight
	resized = true;
}

function EnlargeImage()
{
	newwidth = document.getElementById("theimage").width + (document.getElementById("theimage").width * 25/100);
	current_width = newwidth;
	theimage.style.width = newwidth;

/*	var xmlhttp = new getNewHTTPObject()
	url = image_source + "&newwidth=" + newwidth
	xmlhttp.abort()
	xmlhttp.open("GET", url, true);
	xmlhttp.setRequestHeader("Content-Type", "image/jpeg")
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4)
		{
			IStreamObj = xmlhttp.responseStream
			theimage.src = IStreamObj
		}
	}
	xmlhttp.send(null)
*/
	theimage.src = image_source + "&newwidth=" + newwidth;
	fullsize.style.width = newwidth + 2;
	resized = true;
}

function Close_Image()
{
	fullsize.style.display = "none"
}

function Close_News(num)
{
	document.getElementById('newsitem'+num).style.display = "none"
}

function Toggle_News(num)
{
	if(!browser.isIE)
	{
		alert('This feature has been disabled for users of browsers other than Internet Explorer');
		return;
	}
	if (document.getElementById('newsitem'+num).style.overflow == "")
	{
		document.getElementById('newsitem'+num).style.overflow = "hidden"
		document.getElementById('newsitem'+num).style.height = "16px"
		document.getElementById('toggle'+num).src = sizers[1].src
		document.getElementById('toggle'+num).alt = "click to maximize this news item box"
		
	}
	else
	{
		document.getElementById('newsitem'+num).style.overflow = ""
		document.getElementById('toggle'+num).src = sizers[0].src
		document.getElementById('toggle'+num).alt = "click to minimize this news item box"
	}
}
function Copyright()
{
	alert("© 2006 McNEECE.  All Rights Reserved");
	return false;
}

function ss(w){window.status=w;return true;}
function cs(){window.status='';}


function got_focus(id, msg)
{
	if(document.getElementById(id).value == msg)
	{
		document.getElementById(id).value = ""
	}
	
}
function lost_focus(id,msg)
{
	field = document.getElementById(id).value
	if(field.length == 0)
	{
		document.getElementById(id).value = msg
	}
}

function check_login_email(email)
{
var xmlhttp = false
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	// JScript gives us Conditional compilation, we can cope with old IE versions.
	// and security blocked creation of the objects.
	 try {
	  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
	  try {
	   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (E) {
	   xmlhttp = false;
	  }
	 }
	@end @*/

  
  	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			xmlhttp=false;
		}
	}
	if (!xmlhttp && window.createRequest) {
		try {
			xmlhttp = window.createRequest();
		} catch (e) {
			xmlhttp=false;
		}
	}

	xmlhttp.open("GET", "/includes/check_login_email.asp?email="+email+"&key="+Date(), true);
	xmlhttp.setRequestHeader("Content-Type", "text/html")
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4)
		{
			msg = xmlhttp.responseText
			if (msg == "false")
			{
				
				document.getElementById("login_title").innerHTML = "New User Registration:"
				document.getElementById("login_submit").value = "register »"
				document.getElementById("forgotten").style.display = "none"
				document.getElementById("login_password").style.display = "none"
				document.getElementById("save_login_checkbox").style.display = "none"
				document.getElementById("login_message").style.display = "block"
			}
			else
			{
				document.getElementById("login_title").style.color = ""
				document.getElementById("login_title").innerHTML = "Login"
				document.getElementById("login_submit").value = "login »" 
				document.getElementById("forgotten").style.display = ""
				document.getElementById("login_password").style.display = ""
				document.getElementById("save_login_checkbox").style.display = ""
				document.getElementById("login_message").style.display = ""
			}
		}
	}
	xmlhttp.send(null)
}

var reg_form = false
var y = 0
var x = 0
function process_login(event)
{
	if(browser.isIE)
	{
		x = window.event.clientX
		y = window.event.clientY
	}
	save_email = document.getElementById("login_email").value;

	if(document.getElementById("login_title").innerHTML == "New User Registration:")
	{
	if(!reg_form)
	{
		var xmlhttp = false
		/*@cc_on @*/
		/*@if (@_jscript_version >= 5)
		 try {
		  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		 } catch (e) {
		  try {
		   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		  } catch (E) {
		   xmlhttp = false;
		  }
		 }
		@end @*/
  
  		if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
			try {
				xmlhttp = new XMLHttpRequest();
			} catch (e) {
				xmlhttp=false;
			}
		}
		if (!xmlhttp && window.createRequest) {
			try {
				xmlhttp = window.createRequest();
			} catch (e) {
				xmlhttp=false;
			}
		}
		url = "/includes/registration_form.asp"
		xmlhttp.open("GET", url, true);
		xmlhttp.setRequestHeader("Content-Type", "text/html")
		xmlhttp.onreadystatechange=function()
		{
			if (xmlhttp.readyState==4)
			{
				msg = xmlhttp.responseText
				document.body.innerHTML = document.body.innerHTML + msg
				if (browser.isIE) {
					x = x + document.documentElement.scrollLeft + document.body.scrollLeft;
					y = y + document.documentElement.scrollTop + document.body.scrollTop;
				}
				if (browser.isNS) {
					x = document.getElementById('login_submit').offsetLeft + window.scrollX + 100;
					y = document.getElementById('login_submit').offsetTop - 50;
				}
				document.getElementById("registration").style.top = y - 450;
				document.getElementById("registration").style.left = x + 90;
				document.getElementById("registration").style.display = "block"
	
				document.getElementById("email").value = save_email
				document.getElementById("login_email").value = save_email
				document.getElementById("firstname").focus()
				document.getElementById("firstname").select()
			}
		}
		xmlhttp.send(null)
		return
		}
		document.getElementById("registration").style.display = "block"
		if (browser.isIE) {
			x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
			y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
		}
		if (browser.isNS) {
			x = document.getElementById('login_submit').offsetLeft + window.scrollX + 100;
			y = document.getElementById('login_submit').offsetTop - 50;
		}
		document.getElementById("registration").style.top = y - 450;
		document.getElementById("registration").style.left = x + 90;
	
		document.getElementById("email").value = document.getElementById("login_email").value
		document.getElementById("firstname").focus()
		document.getElementById("firstname").select()
	}
	else
	{
		var xmlhttp = false
		/*@cc_on @*/
		/*@if (@_jscript_version >= 5)
		 try {
		  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		 } catch (e) {
		  try {
		   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		  } catch (E) {
		   xmlhttp = false;
		  }
		 }
		@end @*/
  
  		if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
			try {
				xmlhttp = new XMLHttpRequest();
			} catch (e) {
				xmlhttp=false;
			}
		}
		if (!xmlhttp && window.createRequest) {
			try {
				xmlhttp = window.createRequest();
			} catch (e) {
				xmlhttp=false;
			}
		}
		email = document.getElementById("login_email").value
		password = document.getElementById("login_password").value
		auto_login = document.getElementById("save_login").value
		url = "/includes/login.asp?email="+email+"&password="+password+"&auto_login="+auto_login+"&key="+Date()
		xmlhttp.open("GET", url, true);
		xmlhttp.setRequestHeader("Content-Type", "text/html")
		xmlhttp.onreadystatechange=function()
		{
			if (xmlhttp.readyState==4)
			{
				msg = xmlhttp.responseText
				if(msg=="false")
				{
					document.getElementById("login_title").innerHTML = "password incorrect - try again";
					document.getElementById("login_title").style.color = "#cc0000"
					document.getElementById("login_password").select()
					return
				}
				document.getElementById("register").innerHTML = msg
			}
		}
		xmlhttp.send(null)
		return;
	}
}

function reset_password_warning()
{
	document.getElementById("password_legend").innerHTML = "password";
	document.getElementById("password_legend").style.color = "";
	document.getElementById("password_fieldset").style.borderColor=""
	document.getElementById("confirm").value = "";
}

function check_passwords()
{
	var password =	document.getElementById("password").value;
	var confirm =	document.getElementById("confirm").value;
	var ans = password.indexOf(confirm)
	if(ans == -1)
	{
		document.getElementById("password_legend").innerHTML = "passwords do not match";
		document.getElementById("password_legend").style.color = "#cc0000";
		document.getElementById("password_fieldset").style.borderColor="#cc0000"
	}
	else
	{
	document.getElementById("password_legend").innerHTML = "password";
	document.getElementById("password_legend").style.color = "";
	document.getElementById("password_fieldset").style.borderColor=""
	}
}

function process_registration()
{
	var firstname = document.getElementById("firstname").value;
	var surname =	document.getElementById("surname").value;
	var email =		document.getElementById("email").value;
	var company =	document.getElementById("company").value;
	var telephone = document.getElementById("telephone").value;
	var country =	document.getElementById("country").value;
	var website_url = document.getElementById("website_url").value;
	var subscription_status =	document.getElementById("subscription_status").value;
	var auto_login =	document.getElementById("auto_login").value;
	var password =	document.getElementById("password").value;
	var confirm =	document.getElementById("confirm").value;
	
	if(firstname=="" || surname=="" || email=="" || email.indexOf('@')==-1 || email.indexOf(".")==-1)	
	{
		document.getElementById("mandatory_legend").style.color = "#cc0000";
		document.getElementById("mandatory_fieldset").style.borderColor="#cc0000"
		if(email.indexOf('@')==-1 || email.indexOf(".")==-1)
		{
			document.getElementById("mandatory_legend").innerHTML = "mandatory details - email address incorrect";
		}
		else
		{
			document.getElementById("mandatory_legend").innerHTML = "mandatory details";
		}
		if(password=="")
		{
			document.getElementById("password_legend").style.color = "#cc0000";
			document.getElementById("password_fieldset").style.borderColor="#cc0000"
		}
		return;
	}
	else
	{
		document.getElementById("mandatory_legend").style.color = "";
		document.getElementById("mandatory_fieldset").style.borderColor=""
	}

	if(password=="")
	{
		document.getElementById("password_legend").style.color = "#cc0000";
		document.getElementById("password_fieldset").style.borderColor="#cc0000";
		document.getElementById("password_fieldset").style.borderColor="#cc0000"
		return;
	}

	if(password!=confirm)
	{
		document.getElementById("password_legend").innerHTML = "passwords do not match";
		document.getElementById("password_legend").style.color = "#cc0000";
		document.getElementById("password_fieldset").style.borderColor="#cc0000"
		return;
	}
	
	var xmlhttp = false
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	 try {
	  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
	  try {
	   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (E) {
	   xmlhttp = false;
	  }
	 }
	@end @*/
  
  	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			xmlhttp=false;
		}
	}
	if (!xmlhttp && window.createRequest) {
		try {
			xmlhttp = window.createRequest();
		} catch (e) {
			xmlhttp=false;
		}
	}
	url = "/includes/register.asp?firstname="+firstname+"&surname="+surname+"&email="+email+"&company="+company+"&telephone="+telephone+"&country="+country+"&website_url="+website_url+"&subscription_status="+subscription_status+"&auto_login="+auto_login+"&password="+password+"&key="+Date()
	xmlhttp.open("GET", url, true);
	xmlhttp.setRequestHeader("Content-Type", "text/html")
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4)
		{
			msg = xmlhttp.responseText
			if (msg == "True")
			{
				document.getElementById("registration").style.display = "none"
			}
			else
			{
			}
		}
	}
	xmlhttp.send(null)

	var login_http = false
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	 try {
	  login_http = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
	  try {
	   login_http = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (E) {
	   login_http = false;
	  }
	 }
	@end @*/
  
  	if (!login_http && typeof XMLHttpRequest!='undefined') {
		try {
			login_http = new XMLHttpRequest();
		} catch (e) {
			login_http=false;
		}
	}
	if (!login_http && window.createRequest) {
		try {
			login_http = window.createRequest();
		} catch (e) {
			login_http=false;
		}
	}
	url = "/includes/login.asp?email="+email+"&password="+password+"&auto_login="+auto_login+"&key="+Date()
//	alert (url)
	login_http.open("GET", url, true);
	login_http.setRequestHeader("Content-Type", "text/html")
	login_http.onreadystatechange=function()
	{
		if (login_http.readyState==4)
		{
			msg = login_http.responseText
			document.getElementById("register").innerHTML = msg
			//window.location.reload(true)
		}
	}
	login_http.send(null)
	return;
}

function logout()
{
	var xmlhttp = false
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	 try {
	  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
	  try {
	   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (E) {
	   xmlhttp = false;
	  }
	 }
	@end @*/
  
  	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			xmlhttp=false;
		}
	}
	if (!xmlhttp && window.createRequest) {
		try {
			xmlhttp = window.createRequest();
		} catch (e) {
			xmlhttp=false;
		}
	}
	url = "/includes/logout.asp?key="+Date()
	xmlhttp.open("GET", url, true);
	xmlhttp.setRequestHeader("Content-Type", "text/html")
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4)
		{
			msg = xmlhttp.responseText
			document.getElementById("register").innerHTML = msg
		}
	}
	xmlhttp.send(null)
}

var update_form = false
function update_user(event,email)
{
	if(browser.isIE)
	{
		x = window.event.clientX
		y = window.event.clientY
	}

	if(!update_form)
	{
		var xmlhttp = false
		/*@cc_on @*/
		/*@if (@_jscript_version >= 5)
		 try {
		  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		 } catch (e) {
		  try {
		   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		  } catch (E) {
		   xmlhttp = false;
		  }
		 }
		@end @*/
  
  		if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
			try {
				xmlhttp = new XMLHttpRequest();
			} catch (e) {
				xmlhttp=false;
			}
		}
		if (!xmlhttp && window.createRequest) {
			try {
				xmlhttp = window.createRequest();
			} catch (e) {
				xmlhttp=false;
			}
		}
		url = "/includes/update_form.asp?email="+email
		xmlhttp.open("GET", url, true);
		xmlhttp.setRequestHeader("Content-Type", "text/html")
		xmlhttp.onreadystatechange=function()
		{
			if (xmlhttp.readyState==4)
			{
				msg = xmlhttp.responseText
				if(document.getElementById("registration")==null)
				{
					document.body.innerHTML = document.body.innerHTML + msg
				}
				else
				{
					document.getElementById("registration").outerHTML = msg
				}
				if (browser.isIE) {
					x = x + document.documentElement.scrollLeft + document.body.scrollLeft;
					y = y + document.documentElement.scrollTop + document.body.scrollTop;
				}
				if (browser.isNS) {
					x = document.getElementById('edit_details').offsetLeft + window.scrollX + 100;
					y = document.getElementById('edit_details').offsetTop - 50;
				}
				document.getElementById("registration").style.top = y - 450;
				document.getElementById("registration").style.left = x + 90;
				document.getElementById("registration").style.display = "block"
	
				document.getElementById("firstname").focus()
				document.getElementById("firstname").select()
			}
		}
		xmlhttp.send(null)
		return
		}
//		document.getElementById("registration").style.display = "block"
//		if (browser.isIE) {
//			x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
//			y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
//		}
//		if (browser.isNS) {
//			x = document.getElementById('edit_details').offsetLeft + window.scrollX + 100;
//			y = document.getElementById('edit_details').offsetTop - 50;
//		}
//		document.getElementById("registration").style.top = y - 450;
//		document.getElementById("registration").style.left = x + 90;
//	
//		document.getElementById("email").value = document.getElementById("login_email").value
//		document.getElementById("firstname").focus()
//		document.getElementById("firstname").select()
}


function process_update_user()
{
	var firstname = document.getElementById("firstname").value;
	var surname =	document.getElementById("surname").value;
	var email =		document.getElementById("email").value;
	var company =	document.getElementById("company").value;
	var telephone = document.getElementById("telephone").value;
	var country =	document.getElementById("country").value;
	var website_url = document.getElementById("website_url").value;
	var subscription_status =	document.getElementById("subscription_status").value;
	var auto_login =	document.getElementById("auto_login").value;
	var password =	document.getElementById("password").value;
	var confirm =	document.getElementById("confirm").value;
	
	if(firstname=="" || surname=="" || email=="" || email.indexOf('@')==-1 || email.indexOf(".")==-1)	
	{
		document.getElementById("mandatory_legend").style.color = "#cc0000";
		document.getElementById("mandatory_fieldset").style.borderColor="#cc0000"
		if(email.indexOf('@')==-1 || email.indexOf(".")==-1)
		{
			document.getElementById("mandatory_legend").innerHTML = "mandatory details - email address incorrect";
		}
		else
		{
			document.getElementById("mandatory_legend").innerHTML = "mandatory details";
		}
		if(password=="")
		{
			document.getElementById("password_legend").style.color = "#cc0000";
			document.getElementById("password_fieldset").style.borderColor="#cc0000"
		}
		return;
	}
	else
	{
		document.getElementById("mandatory_legend").style.color = "";
		document.getElementById("mandatory_fieldset").style.borderColor=""
	}

	if(password=="")
	{
		document.getElementById("password_legend").style.color = "#cc0000";
		document.getElementById("password_fieldset").style.borderColor="#cc0000";
		document.getElementById("password_fieldset").style.borderColor="#cc0000"
		return;
	}

	if(password!=confirm)
	{
		document.getElementById("password_legend").innerHTML = "passwords do not match";
		document.getElementById("password_legend").style.color = "#cc0000";
		document.getElementById("password_fieldset").style.borderColor="#cc0000"
		return;
	}
	
	var xmlhttp = false
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	 try {
	  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
	  try {
	   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (E) {
	   xmlhttp = false;
	  }
	 }
	@end @*/
  
  	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			xmlhttp=false;
		}
	}
	if (!xmlhttp && window.createRequest) {
		try {
			xmlhttp = window.createRequest();
		} catch (e) {
			xmlhttp=false;
		}
	}
	url = "/includes/update.asp?firstname="+firstname+"&surname="+surname+"&email="+email+"&company="+company+"&telephone="+telephone+"&country="+country+"&website_url="+website_url+"&subscription_status="+subscription_status+"&auto_login="+auto_login+"&password="+password+"&key="+Date()
	xmlhttp.open("GET", url, true);
	xmlhttp.setRequestHeader("Content-Type", "text/html")
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4)
		{
			msg = xmlhttp.responseText
			if (msg == "True")
			{
				document.getElementById("registration").style.display = "none"
			}
			else
			{
			}
		}
	}
	xmlhttp.send(null)

	var login_http = false
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	 try {
	  login_http = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
	  try {
	   login_http = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (E) {
	   login_http = false;
	  }
	 }
	@end @*/
  
  	if (!login_http && typeof XMLHttpRequest!='undefined') {
		try {
			login_http = new XMLHttpRequest();
		} catch (e) {
			login_http=false;
		}
	}
	if (!login_http && window.createRequest) {
		try {
			login_http = window.createRequest();
		} catch (e) {
			login_http=false;
		}
	}
	url = "/includes/login.asp?email="+email+"&password="+password+"&auto_login="+auto_login+"&key="+Date()
	login_http.open("GET", url, true);
	login_http.setRequestHeader("Content-Type", "text/html")
	login_http.onreadystatechange=function()
	{
		if (login_http.readyState==4)
		{
			msg = login_http.responseText
			document.getElementById("register").innerHTML = msg
		}
	}
	login_http.send(null)
	return;
}

var y = 0
var x = 0
var xpress_html = false
var result = false
function xpress_show(x, y, newHeight, result)
{
	if(browser.isIE)
	{
	//	x = window.event.clientX
	//	y = window.event.clientY
	}
	xmlhttp = getNewHTTPObject()
	url = "/xpress/xpress_form.asp"
	xmlhttp.abort()
	xmlhttp.open("GET", url, true);
	xmlhttp.setRequestHeader("Content-Type", "text/html")
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4)
		{
			showform = xmlhttp.responseText
			if(!xpress_html)
			{
				document.body.innerHTML = document.body.innerHTML + showform;
				xpress_html = true;
			}
			else if (xpress_html && !result)
			{
				d = document.body
				var oldform = document.getElementById("xpress_form")
				d.removeChild(oldform)
				document.body.innerHTML = document.body.innerHTML + showform;
			}
			if(browser.isIE && (x==0 || y==0) )
			{
				x = 272 //window.event.clientX
				y = 331 //window.event.clientY
				//x = x + document.documentElement.scrollLeft + document.body.scrollLeft + 50;
				//y = y + document.documentElement.scrollTop + document.body.scrollTop - 20;
			}
			if(browser.isIE)
			{
				document.getElementById("xpress_form").style.filter = "revealTrans(transition=5, duration=1.5) shadow(color=#555555, direction=145, enabled=1) progid:DXImageTransform.Microsoft.Shadow(color='#666666', Direction=135, Strength=4);"
				document.getElementById("xpress_form").filters.revealTrans.apply();
			}
			if (browser.isNS && (x==0 || y==0)) {
				x = document.getElementById('Xpress').offsetLeft + window.scrollX + 175;
				y = document.getElementById('Xpress').offsetTop - 20;
			}
			document.getElementById("xpress_form").style.height = newHeight;
			document.getElementById("xpress_form").style.visibility = "";
			document.getElementById("xpress_form").style.display = "block";
			document.getElementById("xpress_form").style.left = x
			document.getElementById("xpress_form").style.top = y
			if (browser.isIE)
			{
				document.getElementById("xpress_form").style.height = newHeight - 20;
				document.getElementById("xpress_form").filters.revealTrans.play();
			}
		}
	}
//	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
//	xmlhttp.setRequestHeader('Content-Length', '48');
	xmlhttp.send(null)
}

var save_x = 0
var save_y = 0
function xpress_hide(GotResult)
{
	if(GotResult){result = false}
	save_x = document.getElementById("xpress_form").style.left
	save_y = document.getElementById("xpress_form").style.top
	if (browser.isIE)
	{
		xpress_form.style.filter = "revealTrans(transition=4, duration=0.8) shadow(color=#555555, direction=145, enabled=1) progid:DXImageTransform.Microsoft.Shadow(color='#666666', Direction=135, Strength=4);"
		xpress_form.filters.revealTrans.apply();
	}
	document.getElementById("xpress_form").style.visibility = "hidden";
	if (browser.isIE)
	{
		xpress_form.filters.revealTrans.play();
	}
}

function comment_count()
{
	var count = (document.getElementById("xcomments").value).length
	if(count > 1200)
	{
		document.getElementById("xcomments").value = (document.getElementById("xcomments").value).substr(0,1200)
		document.getElementById("comments_legend").innerHTML = "your comment was too long and has been truncated"
		document.getElementById("comments_legend").style.color = "#cc0000"
		document.getElementById("live_count").innerHTML = (document.getElementById("xcomments").value).length;
		return false;
	}
	else
	{
		document.getElementById("live_count").innerHTML = (document.getElementById("xcomments").value).length;
		document.getElementById("comments_legend").innerHTML = "comments"
		document.getElementById("comments_legend").style.color = ""
		return true;
	}
}

function xpress_send()
{
	var firstname = document.getElementById("xfirstname").value;
	var surname =	document.getElementById("xsurname").value;
	var email =		document.getElementById("xemail").value;
	var company =	document.getElementById("xcompany").value;
	var telephone = document.getElementById("xtelephone").value;
	var country =	document.getElementById("xcountry").value;
	var comments =	escape(document.getElementById("xcomments").value);
	var xmlhttp = getNewHTTPObject()

	if(firstname=="" || surname=="" || email=="" || email.indexOf('@')==-1 || email.indexOf(".")==-1)	
	{
		document.getElementById("your_details_legend").style.color = "#cc0000";
		document.getElementById("your_details_fieldset").style.borderColor="#cc0000"
		if(email.indexOf('@')==-1 || email.indexOf(".")==-1)
		{
			document.getElementById("your_details_legend").innerHTML = "your details - email address incorrect";
			return false;
		}
		else
		{
			document.getElementById("your_details_legend").innerHTML = "mandatory details";
			return false;
		}
	}
	else
	{
		document.getElementById("your_details_legend").innerHTML = "your details";
		document.getElementById("your_details_legend").style.color = "";
		document.getElementById("your_details_fieldset").style.borderColor=""
	}

	xpress_hide()

	url = "/xpress/send.asp?firstname="+firstname+"&surname="+surname+"&email="+email+"&company="+company+"&telephone="+telephone+"&country="+country+"&comments="+comments+"&key="+Date()
	xmlhttp.abort()
	xmlhttp.open("GET", url, true);
	xmlhttp.setRequestHeader("Content-Type", "text/html")
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4)
		{
			msg = xmlhttp.responseText
			msg = "<div style=\" padding: 20px; margin:5px 0 15px 0; background:url('/images/big_box_bg.jpg') no-repeat right bottom; border-left:1px solid #bbb; border-top:1px solid #bbb; \"><P style='margin:0px 0 0 0; font-weight:bold'>Dear " + firstname + " " + surname + "</P>"
			msg = msg + "<P'>Thank you for using our Xpress Contact System.</P>"
			msg = msg + "<P>Your details and comments have been successfully received and will be dealt with as soon as possible.</P>"
			msg = msg + "<P style='margin-bottom:0'>Regards<BR><b>Web Support System</b></P></div>"
			msg = msg + "<P><input type=button class=button onmousedown = \" this.style.border='1px inset' \" onmouseup= \" this.style.border='1px outset' \" onmouseout= \" this.style.border='1px outset' \" value='close' id=xpress_close_button name=xpress_close_button onclick='xpress_hide(true)'>"

//			document.getElementById("xpress_inner_div").outerHTML = msg
			document.getElementById("xpress_inner_div").innerHTML = msg
		}
	}
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlhttp.setRequestHeader('Content-Length', 1800);
	xmlhttp.send(null)
	window.setTimeout("xpress_show(save_x, save_y, 230, true)",1500)
}

function toggle_view()
{
	var xmlhttp = new getNewHTTPObject()
	url = "/includes/toggleview.asp"
	xmlhttp.abort()
	xmlhttp.open("GET", url, true);
	xmlhttp.setRequestHeader("Content-Type", "text/html")
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4)
		{
			window.location.reload(true)
		}
	}
	xmlhttp.send(null)
}
