function popBranchGoogleMap (dealerid) {
	window.open('/pop_googlemap.cfm?dealerid=' + dealerid, "ViewMap", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=1,width=600,height=600,top=0,left=0");
}

// warranty regn confirm
function CheckFRMWarrantyRegistration() {
	if($.trim($("#dealerother").val()) == "")
	{
		if (FRMWarrantyRegistration.DealerID.value == 0)
		{
			alert("Please select the dealer you purchased your product from");
			FRMWarrantyRegistration.DealerID.focus();
			return false;
		}
	}
	
	if (FRMWarrantyRegistration.datepurchased.value == '')
	{
		alert("Please enter the date the product was purchased");
		FRMWarrantyRegistration.datepurchased.focus();
		return false;
	}
	
	if (FRMWarrantyRegistration.ItemUse.value == '')
	{
		alert("Please select the Equipment Use");
		FRMWarrantyRegistration.ItemUse.focus();
		return false;
	}
	
	
	if (FRMWarrantyRegistration.BrandID.value == 0) {
		alert("Please select the product brand");
		FRMWarrantyRegistration.BrandID.focus();
		return false;
	}
	
	if (FRMWarrantyRegistration.CategoryID.value == 0) {
		alert("Please select the product type");
		FRMWarrantyRegistration.CategoryID.focus();
		return false;
	}
		
	if($.trim($("#modelother").val()) == "")
	{
		
		
		if (FRMWarrantyRegistration.ItemID.value == 0) {
			alert("Please select the product model");
			FRMWarrantyRegistration.ItemID.focus();
			return false;
		}
	}
	
	if (FRMWarrantyRegistration.Serial.value == '') {
		alert("Please enter the serial number");
		FRMWarrantyRegistration.Serial.focus();
		return false;
	}
	if(!$validserial)
	{
		alert("Please enter a valid serial number");
		FRMWarrantyRegistration.Serial.focus();
		return false;
	}
	
	if($("#itemuse").val() == "Domestic Use")
	{
		if (FRMWarrantyRegistration.fname.value == '') {
			if($iscustomer)
			{
				alert("Please enter your first name");
			}
			else
			{
				alert("Please enter the customer's first name");
			}
			FRMWarrantyRegistration.fname.focus();
			return false;
		}
		if (FRMWarrantyRegistration.sname.value == '') {
			if($iscustomer)
			{
				alert("Please enter your surname");
			}
			else
			{
				alert("Please enter the customer's surname");
			}
			FRMWarrantyRegistration.sname.focus();
			return false;
		}
	}
	else
	{
		if (FRMWarrantyRegistration.companyname.value == '') {
			if($iscustomer)
			{
				alert("Please enter your Company Name");
			}
			else
			{
				alert("Please enter the customer's Company Name");
			}
			FRMWarrantyRegistration.companyname.focus();
			return false;
		}
	}
		
	
	
	if (FRMWarrantyRegistration.address1.value == '') {
		if($iscustomer)
		{
			alert("Please enter your address");
		}
		else
		{
			alert("Please enter the customer's address");
		}
		FRMWarrantyRegistration.address1.focus();
		return false;
	}
	if (FRMWarrantyRegistration.city.value == '') {
		if($iscustomer)
		{
			alert("Please enter your city");
		}
		else
		{
			alert("Please enter the customer's city");
		}
		FRMWarrantyRegistration.city.focus();
		return false;
	}
	
	if (!$("#noemailcb").is(":checked") && FRMWarrantyRegistration.email.value == '') {
		if($iscustomer)
		{
			alert("Please enter your email address");
		}
		else
		{
			alert("Please enter the customer's email address");
		}
		FRMWarrantyRegistration.email.focus();
		return false;
	}
	
	if (FRMWarrantyRegistration.areacode.value == '') {
		if($iscustomer)
		{
			alert("Please enter your phone area code");
		}
		else
		{
			alert("Please enter the customer's phone area code");
		}
		FRMWarrantyRegistration.areacode.focus();
		return false;
	}
	
	if (FRMWarrantyRegistration.phone.value == '') {
		if($iscustomer)
		{
			alert("Please enter your phone number");
		}
		else
		{
			alert("Please enter the customer's phone number");
		}
		FRMWarrantyRegistration.phone.focus();
		return false;
	}
	
	
	return true;
}

function showPreview(url, border, width, height, desc)
{

  border = typeof(border) == "undefined" ? 0 : border;
  width = typeof(width) == "undefined" ? 100 : width;
  height = typeof(height) == "undefined" ? 100 : height;
  desc = typeof(desc) == "undefined" ? "" : desc;

  document.getElementById("sp").innerHTML = '<img src="' + url + '" border="' + border + '" width="' + width + '" height="' + height + '"><br>' + desc;

}

var _d = document;
function showTab(tab) {
	var tb=lt.id.substring(1); // pull out previous number
	ta=tab.id.substring(1); // pull out the current number
	lt.className='tabtextover'; // change previous to class o
	tab.className='tabtextover';
	lt=tab;
	
	// display table
	_d.getElementById('s'+tb).style.display="none";
	_d.getElementById('s'+ta).style.display="block";
	_d.getElementById('m'+ta).className='tabtextover';
	_d.getElementById('m'+tb).className='tabtext';
	
	_d.getElementById('tl'+ta).className='tab-left-over';
	_d.getElementById('tl'+tb).className='tab-left';
	
	_d.getElementById('tm'+ta).className='tab-middle-over';
	_d.getElementById('tm'+tb).className='tab-middle';
	
	_d.getElementById('tr'+ta).className='tab-right-over';
	_d.getElementById('tr'+tb).className='tab-right';
}

function m() {
	alert("ll");
}

function clearPreview()
{

  document.getElementById("sp").innerHTML = "";

}

function getnewsintro(newsid)
{
	ajax.requestFile = '/inc_news_intro.cfm?newsid='+newsid;	// Specifying which file to get
	//ajax.onCompletion = displayintro;	// Specify function that will be executed after file has been found
	document.getElementById("sp").innerHTML = eval(ajax.response);
	//document.getElementById("sp").innerHTML = '<img src="' + url + '" border="' + border + '" width="' + width + '" height="' + height + '"><br>';
	ajax.runAJAX();		// Execute AJAX function
	
}

function displayintro()
{
	var obj = document.getElementById('dhtmlgoodies_region');
	eval(ajax.response);	// Executing the response from Ajax as Javascript code	
}


// toggle visibility code

function toggle(obj) {
 var el = document.getElementById(obj);
 el.style.display = (el.style.display != 'none' ? 'none' : '');
}

// contractor display

function contractordisplay(ContractorID,URL) {
mywin = window.open(URL+'pop_contractors.cfm?ContractorID=' + ContractorID,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=620,height=600');
}

// Newsletter signup

function NewsletterSubmit() {
	if (FRMNewsletter.fname.value == '')
	{
		alert("Please enter your first name");
		FRMNewsletter.fname.focus();
		return false;
	}
	if (FRMNewsletter.sname.value == '')
	{
		alert("Please enter your surname");
		FRMNewsletter.sname.focus();
		return false;
	}
	if (FRMNewsletter.email.value == '')
	{
		alert("Please enter your email address");
		FRMNewsletter.email.focus();
		return false;
	}
	
	//basic email address syntax validation
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(FRMNewsletter.email.value) == false) {
		alert("Please enter a valid email address.");
		return false;
	}
		
	return true;
}
// specifications popup

function viewspecifications(URL,productid,display) {
	var newwinwidth = 620;
	var newwinheight = 500;
	window.open(URL+'pop_specifications.cfm?productid=' + productid + '&display=' + display, "ViewPhoto", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=1,width=" +newwinwidth+",height=" +newwinheight+",top=0,left=0");
	}	

// product enquiry popup

function productenquiry(URL,productid) {
	var newwinwidth = 620;
	var newwinheight = 600;
	window.open(URL+'pop_product_enquiry.cfm?productid=' + productid, "Enquiry", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=1,width=" +newwinwidth+",height=" +newwinheight+",top=0,left=0");
	}	
function productenquiryredvalue(URL,productid) {
	var newwinwidth = 620;
	var newwinheight = 600;
	window.open(URL+'pop_product_enquiry_redvalue.cfm?enquiryid=' + productid, "Enquiry", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=1,width=" +newwinwidth+",height=" +newwinheight+",top=0,left=0");
	}	
	 
	
// image popup

function viewimage(URL,productid) {
	var newwinwidth = 610;
	var newwinheight = 700;
	window.open(URL+'?productid=' + productid, "ViewPhoto", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=1,width=" +newwinwidth+",height=" +newwinheight+",top=0,left=0");
	}	

// print page


	function printPage() {
	if (window.print) {
		agree = confirm('Do you wish to print this page now?');
		if (agree) window.print(), initDelay(); 
		//else self.close();
	   }
	}
	function initDelay() {
		//e.g. delay the display for 0.5sec (500ms)
		setTimeout("self.close()",1000);
	}
	
	
// search form validation
function searchsubmit() {
	if (FRMsearch.keyword.value == '')
		{
			alert("Please enter a keyword to search for");
			FRMsearch.keyword.focus();
			return false;
		}
}
// add to basket submit

function prodoptionssubmit() {
	
	var boolReturn = false;
	var FieldCounter = new Number(0);
	//see if something has been selected
	//alert(FRMSubmit.COLOUR.length);
	if (typeof(FRMSubmit.COLOUR.length) == 'undefined') {
		FieldCounter = 1;
	} 
	else if (typeof(FRMSubmit.COLOUR.length) == '') {
		FieldCounter = 0;
		
	} else {
		FieldCounter = FRMSubmit.COLOUR.length;
	}
	//alert(FieldCounter);
	for (var i = 0; i < FieldCounter; i++) {
		if (FRMSubmit.COLOUR[i].checked) {
			boolReturn = true;
		}
	}
	if (!boolReturn) {
		alert("Please select a colour of this product you would like to purchase");
		return false;
	}
	
	if (FRMSubmit.Quantity.value == '')
		{
			alert("Please enter a quantity of this product you would like to purchase");
			FRMSubmit.Quantity.focus();
			return false;
		}
	
}

// Contact Us Form Validation
	function contactsubmit()
	
	{
		if (document.forms.FRMSubmit.contact_name.value == '')
		{
			alert("Please enter your name");
			document.forms.FRMSubmit.contact_name.focus();
			return false;
		}
		if (document.forms.FRMSubmit.contact_Email.value == '')
		{
			alert("Please enter your email address");
			document.forms.FRMSubmit.contact_Email.focus();
			return false;
		}			
		if (document.forms.FRMSubmit.contact_subject.value == '')
		{
			alert("Please enter a subject for the email");
			document.forms.FRMSubmit.contact_subject.focus();
			return false;
		}
		if (document.forms.FRMSubmit.contact_comments.value == '')
		{
			alert("Please enter the message.");
			document.forms.FRMSubmit.contact_comments.focus();
			return false;
		}
		
	return true;
	}

// Contact Us Form Validation
	function patientsubmit()
	
	{
		if (FRMSubmit.patientname.value == '')
		{
			alert("Please enter the patient name.");
			FRMSubmit.patientname.focus();
			return false;
		}
		if (FRMSubmit.address1.value == '')
		{
			alert("Please enter the patients street address.");
			FRMSubmit.address1.focus();
			return false;
		}			
		if (FRMSubmit.address3.value == '')
		{
			alert("Please enter the patients city.");
			FRMSubmit.address3.focus();
			return false;
		}
		if (FRMSubmit.Phone.value == '')
		{
			alert("Please enter the patients phone number.");
			FRMSubmit.Phone.focus();
			return false;
		}
		
	return true;
	}	

// Extranet Login Form Validation
	function extranetloginsubmit()
	
	{
		if (FRMLogin.user_email.value == '')
		{
			alert("Please enter your username");
			FRMLogin.user_email.focus();
			return false;
		}
		if (FRMLogin.user_password.value == '')
		{
			alert("Please enter your password");
			FRMLogin.user_password.focus();
			return false;
		}
		
	return true;
	}

	function leftloginsubmit()
	
	{
		if (FRMLeftLogin.user_email.value == '')
		{
			alert("Please enter your username");
			FRMLeftLogin.user_email.focus();
			return false;
		}
		if (FRMLeftLogin.user_password.value == '')
		{
			alert("Please enter your password");
			FRMLeftLogin.user_password.focus();
			return false;
		}
		
	return true;
	}

// Email Password Form Validation
	
	function passreqsubmit()
	
	{
		if (FRMPasswordReq.email.value == '')
		{
			alert("Please enter your email address");
			FRMPasswordReq.email.focus();
			return false;
		}
		
	return true;
	}	
	
// Extranet Registration Form Validation
	function extranetregistrationsubmit()
	{	
			
		if (FRMRegister.Fname.value == '')
		{
			alert("Please enter your first name");
			FRMRegister.Fname.focus();
			return false;
		}
		if (FRMRegister.Sname.value == '')
		{
			alert("Please enter your surname");
			FRMRegister.Sname.focus();
			return false;
		}	
		
		//basic email address syntax validation
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(FRMRegister.email.value) == false) {
			alert("Invalid E-mail Address! Please re-enter.");
			return false;
		}
		/*
		if (FRMRegister.companyname.value == '')
		{
			alert("Please enter your Practice name");
			FRMRegister.companyname.focus();
			return false;
		}	
		*/
		if (FRMRegister.address1.value == '')
		{
			alert("Please enter your address");
			FRMRegister.address1.focus();
			return false;
		}			
		if (FRMRegister.city.value == '')
		{
			alert("Please enter your city");
			FRMRegister.city.focus();
			return false;
		}					
		if (FRMRegister.phone.value == '')
		{
			alert("Please enter your phone number");
			FRMRegister.phone.focus();
			return false;
		}		
		if (FRMRegister.user_password.value == '')
		{
			alert("Please enter your password")
			FRMRegister.user_password.focus();
			return false;
		}
		
		if (FRMRegister.user_password.value.length < 3) {
			alert("Please enter a password that is more than 3 characters long.")
			FRMRegister.user_password.focus();
			return false;
		}
		if (FRMRegister.user_password_confirm.value == '')
		{
			alert("Please enter your password confirmation");
			FRMRegister.user_password_confirm.focus();
			return false;
		}
		if (FRMRegister.user_password.value != FRMRegister.user_password_confirm.value  ) {
			alert("Your password and password confirmation do not match.\nPlease make sure your password and password confirmation are the same");
			FRMRegister.user_password_confirm.value='';
			FRMRegister.user_password_confirm.focus();
			return false;
		}
		if (FRMRegister.disclaimer.checked == false) {
			alert("You must accpet the site Terms & Conditions to proceed.");
			FRMRegister.disclaimer.focus();
			return false;
		}		
		
	return true;
	}

// Extranet Registration Form Validation
	function extranetregistrationupdate()
	{	
			
		if (FRMRegister.Fname.value == '')
		{
			alert("Please enter your first name");
			FRMRegister.Fname.focus();
			return false;
		}
		if (FRMRegister.Sname.value == '')
		{
			alert("Please enter your surname");
			FRMRegister.Sname.focus();
			return false;
		}
		
		//basic email address syntax validation
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(FRMRegister.email.value) == false) {
			alert("Invalid E-mail Address! Please re-enter.");
			return false;
		}
		/*
		if (FRMRegister.companyname.value == '')
		{
			alert("Please enter your Practice name");
			FRMRegister.companyname.focus();
			return false;
		}	
		*/
		if (FRMRegister.address1.value == '')
		{
			alert("Please enter your address");
			FRMRegister.address1.focus();
			return false;
		}			
		if (FRMRegister.city.value == '')
		{
			alert("Please enter your city");
			FRMRegister.city.focus();
			return false;
		}					
		
		if (FRMRegister.phone.value == '')
		{
			alert("Please enter your phone number");
			FRMRegister.phone.focus();
			return false;
		}	
		if (FRMRegister.user_password.value == '')
		{
			alert("Please enter your password")
			FRMRegister.user_password.focus();
			return false;
		}
		
		if (FRMRegister.user_password.value.length < 3) {
			alert("Please enter a password that is more than 3 characters long.")
			FRMRegister.user_password.focus();
			return false;
		}
		
		if (FRMRegister.user_password.value != FRMRegister.user_password_confirm.value  ) {
			alert("Your password and password confirmation do not match.\nPlease make sure your password and password confirmation are the same");
			FRMRegister.user_password_confirm.value='';
			FRMRegister.user_password_confirm.focus();
			return false;
		}
		
		if (FRMRegister.disclaimer.checked == false) {
			alert("You must accpet the site Terms & Conditions to proceed.");
			FRMRegister.disclaimer.focus();
			return false;
		}		
		
	return true;
	}	
	
//Standard Functions
function open_new(url) {
	new_win = window.open(url,"new_win",'toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1');
	}			
function open_email(url) {
	new_email = window.open(url,"new_email",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0, width=450, height=500');
	}
function open_print(url) {
	new_print = window.open(url,"new_print",'toolbar=1,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0, width=630, height=600');
	}	
	
//Activeedit JS to handle custome links

  		function aeapi_custom_DynHyperlink(aeNum) {
			ae_hot=aeNum;
			DHTMLSafe=aeObjects[aeNum];
			DHTMLSafe.focus();
			DHTMLSafe.DOM.body.focus();	
			if(DHTMLSafe.DOM.selection.type=="Control") {
				var el=DHTMLSafe.DOM.selection.createRange().commonParentElement();
				var tr = DHTMLSafe.DOM.body.createTextRange();
				tr.moveToElementText(el);
				tr.select();
			}
			if (typeof(ae_linkwin) == "undefined" || ae_linkwin.closed) { //short circuit eval
				var szURL=inc + "hyperlink.cfm";
				ae_linkwin = window.open(szURL ,"ae_linkwin","scrollbars=auto,width=360,height=220, resizable=yes",true);
			}
			ae_linkwin.focus();
  		}
		function aeapi_custom_insertFile(aeNum) {
		//if the focus never touched the control, you get an error, so lets touch the control
		DHTMLSafe=aeObjects[aeNum];
		DHTMLSafe.focus();
		if (typeof(ae_filewin) == "undefined" || ae_filewin.closed) { //short circuit eval
			//spawn image window
			var szURL;
			szURL=inc + "file.cfm?instance=" + aeNum;
			szURL+="&filedata=";
			szURL+=ae_filedata[aeNum];
			szURL+="&fileurl=";
			szURL+=ae_fileurl[aeNum];
			ae_filewin = window.open(szURL ,"ae_filewin","scrollbars=yes,status=yes,width=650,height=400, resizable=yes");
	
		}
		ae_filewin.focus();		
		
		}
		//insert the image
		function onFile(u, base_url, y, itext, num) {
			DHTMLSafe=aeObjects[num];
			var img = "<a href=\"" + y + "\" target='_blank'>" + itext + "</a>";
			DHTMLSafe.DOM.selection.createRange().pasteHTML(img);
			ae_filewin.close();
		}	
		function ae_fileProperties(aeNum) {
			DHTMLSafe=aeObjects[aeNum];
			DHTMLSafe.focus();
			if (typeof(ae_filepropwin) == "undefined" || ae_filepropwin.closed) { //short circuit eval
				//spawn image properties window
				var szURL=inc + "fileProperties.htm?instance=" + num;
				ae_filepropwin = window.open(szURL ,"ae_filepropwin","scrollbars=no,width=370,height=305, resizable=no");
		 	}
		 	ae_filepropwin.focus();
		}	
		
//

// navigation
function sendToPage(toLocation) {
	if (toLocation != "")
		top.location.href=toLocation;
	}

// open view photo window

function viewphoto (photoid,winwidth,winheight,viewthumb) {
	var TheUrl = siteurl;
	var newwinwidth = winwidth + 30;
	var newwinheight = winheight + 30;
	//alert (viewthumb);
	if (viewthumb == 1) {
		window.open(TheUrl + 'pop_viewphoto.cfm?photoid=' + photoid+'&viewthumb=yes', "ViewPhoto", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=1,width=" +newwinwidth+",height=" +newwinheight+",top=0,left=0");
	}
	else {
		window.open(TheUrl + 'pop_viewphoto.cfm?photoid=' + photoid, "ViewPhoto", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=1,width=" +newwinwidth+",height=" +newwinheight+",top=0,left=0");
	}
}

// open view photo window

function viewslideshow (photoid,winwidth,winheight,categoryid,viewthumb) {
	
	var TheUrl = siteurl;
	var newwinwidth = winwidth + 50;
	var newwinheight = winheight + 50;
	//alert (TheUrl);
	if (viewthumb == 1) {
		window.open(TheUrl + 'pop_viewslideshow.cfm?photoid=' + photoid+'&categoryid='+categoryid+'&viewthumb=yes', "ViewPhoto", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=1,width=" +newwinwidth+",height=" +newwinheight+",top=0,left=0");
	}
	else {
		window.open(TheUrl + 'pop_viewslideshow.cfm?photoid=' + photoid+'&categoryid='+categoryid, "ViewPhoto", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=1,width=" +newwinwidth+",height=" +newwinheight+",top=0,left=0");
	}
}

//existing site functions
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}



// Global variables

var cookieQueries = new Array();
var isKonqueror = (navigator.vendor == 'KDE')
var isIE6 = ((window.ActiveXObject && !window.XMLHttpRequest) ? true : false);
var adHiders = [false, false, false]; // First element: Search suggestions, second: Browse categories menu, third: Community menu
var _nameidx, _lastbold; // Variables used to make new torrents on the today page bold


// Calculate real offset values of elements

function realOffset(el, offsetType) {

 var offset = 0;

 while(el) {
  offset += el[offsetType]; 
  el = el.offsetParent;
 }

 return offset;

}


// Array.indexOf fix

if(!Array.indexOf) {
 Array.prototype.indexOf = function(elValue) {

  for(var i=0; i<this.length; i++) {
   if(this[i] === elValue)
    return i;
  }

  return -1;

 };
}


// XMLHttpRequest fix for Internet Explorer

if(!window.XMLHttpRequest) {
 window.XMLHttpRequest = function() {
  var types = [
   'Microsoft.XMLHTTP',
   'MSXML2.XMLHTTP.5.0',
   'MSXML2.XMLHTTP.4.0',
   'MSXML2.XMLHTTP.3.0',
   'MSXML2.XMLHTTP'
  ];

  for(var i = 0; i < types.length; i++) {
   try {
    return new ActiveXObject(types[i]);
   } catch(e) {}
  }

  return false; // XMLHttpRequest not supported
 };
}


function updateAd() { // Checks if the top advertisement should be hidden or visible
 var ad = document.getElementById('adspot-a');

 if(ad != null) {
  if(adHiders[0] || adHiders[1] || adHiders[2])
   ad.style.visibility = 'hidden';
  else
   ad.style.visibility = 'visible';
 }
}



/*******************************
***** CHECK EMAIL VIA AJAX *****
*******************************/

$(function()
{
	var checkemailtimer;
	$(".checkemail").keyup(function(e)
	{
		$theemail = $(this).val();
		$thisparent = $(this).parent();
		
		$("div#prompt",$($thisparent)).remove();
		
		if(checkemailtimer)
		{
			clearTimeout(checkemailtimer);
		}
		checkemailtimer = setTimeout(function()
		{
			if($.trim($theemail) != "")
			{
				$.post(
					"/_checkemail.cfm",
					{
						emailaddress:$theemail,
						returnpath:$("#returnpath").val(),
						postcomment:$("#postcomment").val()
					},
					function(data)
					{
						$thisparent.append(data);
					}
				);
			}
		},500);
	});
	
	$(".autopasswordrequest").livequery("click",function(e)
	{
		e.preventDefault();
		$.post(
			"/_autopasswordrequest.cfm",
			{
				autopasswordrequest:$(this).attr("id"),
				returnpath:$("#returnpath").val(),
				postcomment:$("#postcomment").val()
			},
			function(data)
			{
				$("div#prompt").removeClass("notice").addClass("success").html(data);
			}
		);
	});
	
	$(".closeprompt").livequery("click",function(e)
	{
		e.preventDefault();
		$("div#prompt").remove();
	});

});