var request = null;var initialHandleChange = true;var promoSecs = 60;var promo_interval_id;function timer_promo_update(){	request = createRequest();		var url;    var myRandom = parseInt(Math.random()*99999999);	url = "ajax_update_promos.php";	request.open("GET", url+"?rand="+myRandom, true);	request.onreadystatechange = function()	{		if	(request.readyState == 4)		{       		if	(request.status == 200)       		{				//if ( CheckSession(request) )				if (request.responseText != "")				{					var mySplitResult = request.responseText.split("|");					if	(mySplitResult[1])						if(document.getElementById(mySplitResult[1]))							document.getElementById(mySplitResult[1]).innerHTML = mySplitResult[2];					if	(mySplitResult[3])						if(document.getElementById(mySplitResult[3]))							document.getElementById(mySplitResult[3]).innerHTML = mySplitResult[4];					if	(mySplitResult[5])						if(document.getElementById(mySplitResult[5]))							document.getElementById(mySplitResult[5]).innerHTML = mySplitResult[6];					if	(mySplitResult[7])						if(document.getElementById(mySplitResult[7]))							document.getElementById(mySplitResult[7]).innerHTML = mySplitResult[8];					if	(mySplitResult[9])						if(document.getElementById(mySplitResult[9]))							document.getElementById(mySplitResult[9]).innerHTML = mySplitResult[10];					if	(mySplitResult[11])						if(document.getElementById(mySplitResult[11]))							document.getElementById(mySplitResult[11]).innerHTML = mySplitResult[12];				}			}					}	}    request.send(null);}function createRequest(){var xmlhttp;if	(window.XMLHttpRequest)	{ // Mozilla, Safari, Opera...    	xmlhttp = new XMLHttpRequest();    	//if (xmlhttp.overrideMimeType) xmlhttp.overrideMimeType('text/xml');  	} else if 	(window.ActiveXObject)			{ // IE      			try 	{        			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");      				} catch (e)					{          				try	{            					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");          					} catch (e) {}     					}  			}if 	(!xmlhttp)	{    	alert('Cannot create an XMLHTTP instance');   	return false;  	}return xmlhttp;}// -----// e_jajax_usecredit - Onclick routine for "use free credit" link on home page.// -----function e_jajax_usecredit(ep, title, type){	question = 'Do you want to use one free credit to get the "' + title + '"';	if ( type == 0 )		question += " photo club?";	else		question += " video club?";	if ( confirm(question) )	{		request = createRequest();			var url;		var myRandom = parseInt(Math.random()*99999999);		url = "ajax_usecredit.php?ep=" + ep;		request.open("GET", url+"&rand="+myRandom, true);		request.onreadystatechange = function()		{			if	(request.readyState == 4){				if	(request.status == 200){					if (CheckSession(request)){											var mySplitResult = request.responseText.split("|");						if ( mySplitResult[0] == 0 )						{							alert( mySplitResult[1] );							document.getElementById("cbodypad").innerHTML = mySplitResult[2];							document.getElementById("lbodypad").innerHTML = mySplitResult[3];							if	(mySplitResult[4])							{								Lightbox.init();								updatelightbox = false;							}						}						else						{							alert( mySplitResult[1] );						}					}				}			}		};		request.send(null);	}}function comment_report_abuse(formele, abuseid, cid){	// formele - form element	// abuseid - id of abuse div to hide	// cid - id of comment abuse is being reported on		var reason;		for (var i = 0; i < formele.opt.length; i++)	{		if(formele.opt[i].checked)			break;	}	reason = formele.opt[i].value;		var url = "ajax_commentabusereport.php?cid=" + cid + "&reason=" + reason;	var myRandom = parseInt(Math.random()*99999999);	request = createRequest();	request.open("GET", url+"&rand="+myRandom, true);	request.onreadystatechange = function()	{		if	(request.readyState == 4){			if	(request.status == 200){				if (CheckSession(request)){									var mySplitResult = request.responseText.split("|");					//alert(mySplitResult[0]);					switch (mySplitResult[1])					{						case '0':// no errors							alert(mySplitResult[2]);							comment_show_abuse_div(abuseid);							break;													default: // error							alert(mySplitResult[2]);							break;					}				}			}		}	};	request.send(null);}function comment_show_abuse_div(abuseid){	if	(document.getElementById(abuseid).style.display == "block")		document.getElementById(abuseid).style.display = 'none';	else		document.getElementById(abuseid).style.display = 'block';}// -----// comment_showby_alias - onclick for alias link to show comments by alias.// -----function comment_showby(mode,alias){	var url = "ajax_comments_showby.php?mode=" + urlencode(mode) + "&alias=" + urlencode(alias);	var myRandom = parseInt(Math.random()*99999999);	request = createRequest();	request.open("GET", url+"&rand="+myRandom, true);	request.onreadystatechange = function()	{		if	(request.readyState == 4){			if	(request.status == 200){				if (CheckSession(request)){					var mySplitResult = request.responseText.split("|");					document.getElementById(mySplitResult[1]).innerHTML = mySplitResult[2];				}			}		}	};	request.send(null);}// -----// section_showcomments - onclick for Show Comments in a rowcol section.// -----function section_showcomments(id, pid, title){	if	(document.getElementById(id).style.display == "block")		document.getElementById(id).style.display = 'none';	else	{		var w = (parseInt(document.getElementById(id).style.width));		var lpad = (parseInt(document.getElementById(id).style.paddingLeft));				w -= (lpad+14);				request = createRequest();		var url = "ajax_comments_show.php?id=" + id +"&pid=" + pid + "&title=" + title + "&w=" + w;    	var myRandom = parseInt(Math.random()*99999999);		    	request.open("GET", url+"&rand="+myRandom, true);		request.onreadystatechange = sections_update_homeintro;		    	request.onreadystatechange = function()		{			if	(request.readyState == 4){        		if	(request.status == 200){					if ( CheckSession(request) ){						var mySplitResult = request.responseText.split("|");												if	(lastcommentsdiv != ''){							section_hidediv(6, -1);						}						upddivid = mySplitResult[2] + '-txt';						document.getElementById(upddivid).innerHTML = mySplitResult[1];						document.getElementById(mySplitResult[2]).style.display = 'block';						lastcommentsdiv = mySplitResult[2];					}				}			}		};    	request.send(null);	}}function comment_showcommentdiv(nickname,nnid,caid){	if	(document.getElementById(nnid).style.display == 'block')		alert('You may not add your comment while being prompted for a nickname. If you do not wish to enter a nickname, click "Cancel".');	else	{		if	(nickname == '')		{			document.getElementById(nnid).style.display = "block";		}		else		{			document.getElementById(caid).style.display = "block";		}	}}// -----// comment_changepage - onclick in a comment area page link.// -----function comment_changepage(pagenum){	request = createRequest();	var url;	var myRandom = parseInt(Math.random()*99999999);	url = "ajax_comments_changepage.php?pagenum=" + pagenum;	request.open("GET", url+"&rand="+myRandom, true);	request.onreadystatechange = function()	{		if	(request.readyState == 4){			if	(request.status == 200){				if (CheckSession(request)){					var mySplitResult = request.responseText.split("|");					document.getElementById(mySplitResult[1]).innerHTML = mySplitResult[2];				}			}		}	};	request.send(null);}function comment_cancel(id){	document.getElementById(id).style.display = "none";}function comment_changenickname(nnid, caid){	document.getElementById(caid).style.display = "none";								 	document.getElementById(nnid).style.display = "block";}// -----// comment_addnickname - onclick for Accept Nickname button.// -----function comment_addnickname(eid, aid){	var ok = true;	var len = document.getElementById(aid).value.length;	if	(len == 0)	{		alert('Your nickname is empty.');		ok = false;	}	else if (len > 30)	{		alert('Your nickname is too long.');		ok = false;	}	else	{		var myRegxp = /^([a-zA-Z0-9]+)$/;		if(myRegxp.test(document.getElementById(aid).value)==false) 		{			alert("Please use only letters and numbers in your nickname.");			ok = false;		}	}		if ( ok )	{		var url = "ajax_comments_nickname.php";		var params = 'n=' + urlencode(document.getElementById(aid).value);		/*					+ "&eid=" + urlencode(eid)					+ "&idroot2=" + urlencode(idroot2)					+ "&prodid=" + urlencode(prodid)					+ "&width=" + urlencode(width);		*/				request = createRequest();		request.open("POST", url, true);		request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");		request.setRequestHeader("Content-length", params.length);		request.setRequestHeader("Connection", "close");				request.onreadystatechange = function()		{					if	(request.readyState == 4){				if	(request.status == 200){					if (CheckSession(request)){						var mySplitResult = request.responseText.split("|");						//alert(mySplitResult[0]);						switch (mySplitResult[1])						{							case '0':// no errors								document.getElementById(eid).innerHTML = mySplitResult[2];								break;															default:								if ( mySplitResult[2] )									alert(mySplitResult[2]);								else									alert('Sorry, an error ocurred while processing your nickname.');								break;						}					}				}			}		};		request.send(params);	}}// -----// comment_addcomment - onclick for Add Comment button.// -----function comment_addcomment(eid, ctxtid){	var len = document.getElementById(ctxtid).value.length;		if	(len == 0)		alert('Nothing is in your comment.');	else	if	(len > 1000)		alert('Comment too long.  Please use 1000 characters or less.');	else	{		var url = "ajax_comments_add.php";		var params = 'c=' + urlencode(document.getElementById(ctxtid).value);		/*					+ "&eid=" + urlencode(eid)					+ "&idroot2=" + urlencode(idroot2)					+ "&prodid=" + urlencode(prodid)					+ "&width=" + urlencode(width);		*/						request = createRequest();		request.open("POST", url, true);		request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");		request.setRequestHeader("Content-length", params.length);		request.setRequestHeader("Connection", "close");				request.onreadystatechange = function()		{					if	(request.readyState == 4){				if	(request.status == 200){					if (CheckSession(request)){						var mySplitResult = request.responseText.split("|");						//alert(mySplitResult[0]);						switch (mySplitResult[1])						{							case '0':	// no errors								document.getElementById(eid).innerHTML = mySplitResult[2];								break;															default:								alert('Sorry, an error ocurred while processing your comment.');								break;						}					}				}			}		};		request.send(params);	}}function member_settings(mode){		request = createRequest();	var url;	var myRandom = parseInt(Math.random()*99999999);	url = "ajax_member_settings.php?mode=" + mode;	request.open("GET", url+"&rand="+myRandom, true);	request.onreadystatechange = function()	{				if	(request.readyState == 4){			if	(request.status == 200){				if (CheckSession(request)){					var mySplitResult = request.responseText.split("|");					//alert(mySplitResult[0]);					switch (mySplitResult[0])					{						case '0':							document.getElementById("cbodypad").innerHTML = mySplitResult[1];							document.getElementById("lbodypad").innerHTML =mySplitResult[2];							if ( mySplitResult[3] )							{								Lightbox.init();								updatelightbox = false;							}							break;						case '1':							alert('Your Settings have been saved.  When you log in choose "Restore to Saved Settings" to reset various display options to the settings you just saved.');							break;						case '2':							alert('You do not have any settings saved.  Choose "Save Settings" to save settings.');							break;						case '3':							alert('Error restoring or saving your settings.');							break;						case '4':							document.getElementById("cbodypad").innerHTML = mySplitResult[1];							break;						default:							alert('Please reload or refresh your page or empty your cache.');							break;					}				}			}		}	};	request.send(null);	}function ratings(mode, type, id, val, voted){		//alert(document.getElementById(id).style.width);	switch (mode)	{		case 0:	// mouseover			document.getElementById(id).style.width=(val*22)+'px';			break;					case 1:	// mouseout			document.getElementById(id).style.width=(val*22)+'px';			break;					case 2:	// onclick			if	(type == 0)				x = 'photo club';			else				x = 'video';			if	(voted != 0)			{				alert("You have already rated this " + x + " during this login session.");			}			else			{				if ( confirm("You rated this " + x + " " + val + " out of 10. Click OK to accept or Cancel to rate again.") )				{					request = createRequest();					var url;					var myRandom = parseInt(Math.random()*99999999);					url = "ajax_ratings.php?id=" + id + "&val=" + val + "&ptype=" + type;					request.open("GET", url+"&rand="+myRandom, true);					request.onreadystatechange = function()						{							if	(request.readyState == 4){								if	(request.status == 200){									if ( CheckSession(request) )									{										document.getElementById("prodrate").innerHTML = request.responseText;									}								}							}						}					request.send(null);					alert("Your rating was accepted. Thank you.");				}			}			break;					case 3:			document.getElementById(id).style.width=val+'px';			break;	}}function update_md_to_memberarea(){	if	(request.readyState == 4)	{		if	(request.status == 200)		{			if ( CheckSession(request) )			{				var mySplitResult = request.responseText.split("|");								document.getElementById("cbodypad").innerHTML = mySplitResult[0];								//if	(mySplitResult[1] != '')				var ele = document.getElementById("tabspad");				if	(ele != null)					ele.innerHTML =mySplitResult[1];									if	(mySplitResult[2] != null)				{					Lightbox.init();					updatelightbox = false;				}			}		}	}}// -----// e_jajax_mdprefs - Initiate change Member Prefs on Model Directory// -----function e_jajax_mdprefs(ep){	request = createRequest();	var url;	var myRandom = parseInt(Math.random()*99999999);	url = "ajax_new_mdprefs.php?ep=" + ep;	request.open("GET", url+"&rand="+myRandom, true);	request.onreadystatechange = updatemodeldir;	request.send(null);	}// -----// e_jajax_lpprefs - Initiate change List Prefs on Model Directory// -----function e_jajax_lpprefs(ep){	request = createRequest();	var url;	var myRandom = parseInt(Math.random()*99999999);	url = "ajax_new_lpprefs.php?ep=" + ep;	request.open("GET", url+"&rand="+myRandom, true);	request.onreadystatechange = updatemodeldir;	request.send(null);	}// =================// Member Processing// =================// -----// jajax_memproduct_login - Handle login link on a member's page// -----function jajax_memproduct_login(productid, pagetype){	request = createRequest();	var url;	var myRandom = parseInt(Math.random()*99999999);		url = "ajax_authmember.php?rand=" + myRandom;	url += "&rl=" + 1 + "&pageid=" + pagetype + "&id=" + productid;		request.open("GET", url, true);	request.onreadystatechange = jajax_memproduct_login_response;	request.send(null);}// -----// jajax_memproduct_login_response - Update for ajax_authmember.php call// -----function jajax_memproduct_login_response(){		if	(request.readyState == 4)	{		if	(request.status == 200) 		{			// Valid un/pw for a product.						// To get here the user was on a member page of a product; but she was not logged in			// to access that product's member page.  So, she clicked on a login link which called			// jajax_memphotos_login above.  SHe then entered a username and password			// that was valid for the product's member area.  						// Now we handle this just as if she just clicked the member's tab			// while on a page other than the member's page -- in other words access again the members page.						var params = "pageid=" + request.responseText;			enablebb('/ajax_mem_relogin/', params, 'jajax_update_login');		}		else		{			// Invalid un/pw or cancel. 						// Don't need to go anywhere; but we must make sure the upper nav bar			// and modeldir reflect that we aren't logged in.						var params = "nothing=" + 0;			enablebb('/ajax_mem_relogin_failed/', params, 'jajax_update_failedlogin');		}            	}}// -----// jajax_update_failedlogin - Update for ajax_mem_relogin_failed.php call.// -----function jajax_update_failedlogin(){		if	(request.readyState == 4)	{		if	(request.status == 200)		{			if ( CheckSession(request) )			{				var mySplitResult = request.responseText.split("|");				alert("You are not logged in.");				document.getElementById("lbodypad").innerHTML =mySplitResult[1];				document.getElementById("uppernav").innerHTML =mySplitResult[2];				if	(mySplitResult[3]){					document.getElementById("cbodypad").innerHTML =mySplitResult[3];				}				//if	(mySplitResult[5])				//{				//	Lightbox.init();				//	updatelightbox = false;				//}			}		}	}}// -----// jajax_members_login - process login tab or re-login link inside members area. DON MOD// -----function jajax_members_login(reLogIn){	clearInterval(promo_interval_id);	request = createRequest();	var url;	var myRandom = parseInt(Math.random()*99999999);	url = 'ajax_authmember.php?rand=' + myRandom + "&rl=" + reLogIn;	request.open("GET", url, true);	request.onreadystatechange = jajax_members_login_response;	request.send(null);}// -----// jajax_members_login response handler.. Checks result of attempted login..  DON MOD// -----function jajax_members_login_response(){		//alert('jajax_members_login_response');		if	(request.readyState == 4)	{		//If status of 200 we are good...		if	(request.status == 200) 		{			alert("Welcome! You are now logged in.");			jajax_continue_login(1);			promo_interval_id = setInterval(timer_promo_update, promoSecs*1000);		}		else		{			clearInterval(promo_interval_id);			alert("You are not logged in.");			jajax_continue_login(0);		}	}}function jajax_continue_login(success){	var params = "success=" + success + "&x=" + parseInt(Math.random()*99999999);	enablebb('/ajax_newlogin/', params, 'jajax_update_login');}function jajax_update_login(){		if	(request.readyState == 4)	{		if	(request.status == 200)		{			if ( CheckSession(request) )			{				var mySplitResult = request.responseText.split("|");								document.getElementById("cbodypad").innerHTML = mySplitResult[1];								//document.getElementById("tabspad").innerHTML =mySplitResult[2];				var ele = document.getElementById("tabspad");				if	(ele != null)					ele.innerHTML =mySplitResult[2];									document.getElementById("lbodypad").innerHTML =mySplitResult[3];				document.getElementById("uppernav").innerHTML =mySplitResult[4];				if	(mySplitResult[5])				{					Lightbox.init();					updatelightbox = false;				}			}		}	}}// -----// jajax_checkbox_onclick - ONCLICK in order form checkbox.// -----function jajax_checkbox_onclick(id,product,special,sgd){	request = createRequest();		var cboxObj;	cboxObj = document.getElementById(id);		var checked;	checked = 0;	if	(cboxObj.checked)		checked = 1;		var myRandom = parseInt(Math.random()*99999999);	url = "ajax_checkbox_onclick.php?product=" + product +"&special=" + special +"&sgd=" + sgd +"&checked=" + checked;	request.open("GET", url+"&rand="+myRandom, true);	request.onreadystatechange = jajax_checkbox_onclick_update;	request.send(null);}// -----// e_jajax_checkbox_onclick - ONCLICK in order form checkbox.// -----function e_jajax_checkbox_onclick(id, ep){	request = createRequest();		var cboxObj;	cboxObj = document.getElementById(id);		var checked;	checked = 0;	if	(cboxObj.checked)		checked = 1;	var myRandom = parseInt(Math.random()*99999999);	url = "ajax_checkbox_onclick.php?ep=" + ep + "&checked=" + checked;	request.open("GET", url+"&rand="+myRandom, true);	request.onreadystatechange = jajax_checkbox_onclick_update;	request.send(null);}// -----// jajax_checkbox_onclick_update - Change HTML of order form box after checkbox ONCLICK.// -----function jajax_checkbox_onclick_update(){    if    (request.readyState == 4)    {        if    (request.status == 200)        {			if ( CheckSession(request) )			{				updatelightbox = false;				var mySplitResult = request.responseText.split("|");								if ( mySplitResult[1] != 30 )				{					if ( mySplitResult.length > 3 )					{						// We need to update the modelpageintro and ordermenu						document.getElementById("modelpageintro").innerHTML = mySplitResult[3];						document.getElementById("ordermenu").innerHTML = mySplitResult[4];						updatelightbox = true;					}										// mySplitResult[2] contains all products currently checked on order form delimited by "!".					// Call UpdateOrderDivs with this string to update all the order info on the page.					UpdateOrderDivs(mySplitResult[2]);				}								document.getElementById("of_order").innerHTML = mySplitResult[0];								if ( updatelightbox )				{					Lightbox.init();					updatelightbox = false;				}			}		}	}}// -----// e_jajax_specials_orderlink - Handle onclick within a special's order link.// -----function e_jajax_specials_orderlink(ep){	var params = "ep=" + ep;	enablebb('/ajax_specials_orderlink/', params, 'updatecenter');}// -----// jajax_checkout_now - Handle onclick in checkout NOW button on orderform.// -----function jajax_checkout_now(){	request = createRequest();	var url;	var myRandom = parseInt(Math.random()*99999999);	url = "ajax_checkout_now.php?mode=0";	request.open("GET", url+"&rand="+myRandom, true);	//request.onreadystatechange = update_checkout_now;	request.onreadystatechange = function()		{			if	(request.readyState == 4)			{				if	(request.status == 200)				{					if ( CheckSession(request) )					{						document.getElementById("of_order").innerHTML = request.responseText;					}				}			}		}	request.send(null);	}/*// -----// update_checkout_now - Update html after checkout	NOW button processing.// -----function update_checkout_now(){	if	(request.readyState == 4){		if	(request.status == 200) {			document.getElementById("of_order").innerHTML = request.responseText;			}		}}*/// -----// jajax_clearorder - Handle onclick to clear order form.// -----function jajax_clearorder(pageid){	request = createRequest();		// NOTE. If we change the pageid thing later, be sure to change pageid here.	var url;	var myRandom = parseInt(Math.random()*99999999);	url = "ajax_clearorder.php?pageid=" + pageid;	request.open("GET", url+"&rand="+myRandom, true);	request.onreadystatechange = jajax_clearorder_update;	request.send(null);	}// -----// jajax_clearorder_update - Change HTML of order form box.// -----function jajax_clearorder_update(){    if	(request.readyState == 4)	{        if	(request.status == 200) 		{			if ( CheckSession(request) )			{				//document.getElementById("of_order").innerHTML = request.responseText;				var mySplitResult = request.responseText.split("|");								if	(mySplitResult[2] != 30)				{					updatelightbox = false;					if ( mySplitResult.length > 3 )					{						// We need to update the modelpageintro and ordermenu						document.getElementById("modelpageintro").innerHTML = mySplitResult[3];						document.getElementById("ordermenu").innerHTML = mySplitResult[4];						updatelightbox = true;					}												// If the clear order button was pressed from the home page:					// 1. Change Check box text to read Click to Order					// 2. Uncheck the Check box					// 3. Hide the View Form text					// 4. Hide the order form div						UncheckFromOrder(""); // 1-3					section_hidediv(5, -1);	// 4												if ( updatelightbox )					{						Lightbox.init();						updatelightbox = false;					}				}				else					document.getElementById("of_order").innerHTML = mySplitResult[1];			} 		}	}}			function of_errdisplay(errs, numerrs, errAreaDivObj, errlines){	var x;	var numerrs;	var txtDivObj;	if	(numerrs == 0)		numerrs = errs[0]+errs[1]+errs[2]+errs[3];			if	(numerrs != 0)	{		x = "<span class='of2_error_hdr'>";		if	(numerrs == 1)			x += "Error:";		else			x += "Errors:";		x += " (Make corrections below to continue.)<br /></span>";		x += "<div id='of_error_lines'>";		x += "<span class='of2_error_txt'>" + errlines + "</span>";		x += "</div>";		errAreaDivObj.innerHTML = x;		errAreaDivObj.style.display = "block";	}	else	{		errAreaDivObj.style.display = "none";	}			txtDivObj = document.getElementById('of_usernameID');	if	(errs[0])		txtDivObj.style.color = '#880000';	else		txtDivObj.style.color = '#5b6489';		txtDivObj = document.getElementById('of_passwordID');	if	(errs[1])		txtDivObj.style.color = '#880000';	else		txtDivObj.style.color = '#5b6489';			txtDivObj = document.getElementById('of_confirmID');	if	(errs[2])		txtDivObj.style.color = '#880000';	else		txtDivObj.style.color = '#5b6489';		txtDivObj = document.getElementById('of_agreeID');	if	(errs[3])		txtDivObj.style.color = '#880000';	else		txtDivObj.style.color = '#5b6489';}// -----// jajax_checkout_secure2 - Handle onclick in checkout SECURE button on orderform.// -----function jajax_checkout_secure2(valnotused){	var errAreaDivObj = document.getElementById('of_error_area');	var agreeObj = document.getElementById("agreetoterms");	var errlines = '';	var errs = new Array(0,0,0,0);		// un/pw edits	errlines = of_edit_unpw(errs);		// Agree must be checked.	if	(!agreeObj.checked)	{		errlines += "&bull;&nbsp;Read and agree to 'Foxes.com Terms and Conditions'.<br />";		errs [3] = 1;	}		if	(errlines != '')	{		of_errors = true;	}	else	{		errAreaDivObj.style.display = "none";		of_errors = false;	}	of_errdisplay(errs, 0, errAreaDivObj, errlines);		// If errors above probably should set a global so that upon reentry to the order page	// we can unhide the errAreaDivObj show the error conditions.  **** Why?  If we go to	// another page now, we lose the un/pw entries.  Why worry about saving the error txt?		// If no errors above process the secure order page.		if	(!of_errors)	{		request = createRequest();				var unameobj = document.getElementById("username");		var pwordobj = document.getElementById("password");		var cpwordobj = document.getElementById("confpassword");		var url;		var myRandom = parseInt(Math.random()*99999999);				url = "ajax_checkout_server.php?username=" + unameobj.value + "&password=" + pwordobj.value;		request.open("GET", url+"&rand="+myRandom, true);		request.onreadystatechange = jajax_checkout_server_update;		request.send(null);	}}// -----// jajax_server_checkout_update - Update html server's checkout edits.// -----function jajax_checkout_server_update(){    if    (request.readyState == 4) 	{        if    (request.status == 200) 		{			if ( CheckSession(request) )			{				var errAreaDivObj;				var mySplitResult;				var numerrors;				var errs = new Array(0,0,0,0);								mySplitResult = request.responseText.split("|");				numerrors = mySplitResult[0];				//alert(numerrors);								if	(numerrors != 0)				{					errs[0]=1; // un					errs[1]=1;	// pw				}				errAreaDivObj = document.getElementById('of_error_area');				of_errdisplay(errs, numerrors, errAreaDivObj, mySplitResult[1]);								// If no errors, transfer to secure cc processing				if	(numerrors == 0)				{					// If no errors, we have in mySplitResult:					// [1] = orderid					// [2] = un					// [3] = pw					// [4] = orderdata					// Should POST these in a hidden form call to seurecc.php.					// theForm is currently defined at the bottom of x2.php.						document.theForm.orderid.value = mySplitResult[1];					document.theForm.datamode.value = '0';					document.theForm.un.value = mySplitResult[2];					document.theForm.pw.value = mySplitResult[3];					document.theForm.orderdata.value = mySplitResult[4];										document.theForm.submit();				}			}        }	}			}// -----// of_edit_unpw - Edit orderform un/pw// -----function of_edit_unpw(errs){	var unameobj = document.getElementById("username");	var pwordobj = document.getElementById("password");	var cpwordobj = document.getElementById("confpassword");	var errlines = '';		// Username	if (unameobj.value == "")	{		errlines = "&bull;&nbsp;Specify 'Username'.<br />";		errs[0] = 1;	}	else	{		if	(unameobj.value.length < 6 || unameobj.value.length >16)		{			errlines += "&bull;&nbsp;Specify 'Username' with 6 to 16 characters (both letters and numbers).<br />";			errs[0] = 1;		}		else		{			var myRegxp = /^([a-zA-Z0-9]+)$/;			if(myRegxp.test(unameobj.value)==false) 			{				errlines += "&bull;&nbsp;Specify 'Username' with only letters and numbers.<br />";				errs[0] = 1;			}		}	}		// Passwird	if (pwordobj.value == "")	{		errlines += "&bull;&nbsp;Specify 'Password'.<br />";		errs[1] = 1;	}	else	{		if	(pwordobj.value.length < 6 || pwordobj.value.length >16)		{			errlines += "&bull;&nbsp;Specify 'Password' with 6 to 16 characters (both letters and numbers).<br />";			errs[1] = 1;		}		else		{			var myRegxp = /^([a-zA-Z0-9]+)$/;			if(myRegxp.test(pwordobj.value)==false) 			{				errlines += "&bull;&nbsp;Specify 'Password' with only letters and numbers.<br />";				errs[1] = 1;			}		}	}		// Test here for username same as password -- can't allow that.	if	(errs[0] == 0 && errs[1] == 0)		if	(unameobj.value == pwordobj.value)		{		errlines += "&bull;&nbsp;Username and Password must be different.<br />";		errs[0] = 1;		errs[1] = 1;		}	// Confirm	if (cpwordobj.value == "")	{		errlines += "&bull;&nbsp;Specify 'Confirm Password'.<br />";		errs[2] = 1;	}		if	(pwordobj.value != '')		if	(cpwordobj.value != "")			if	(pwordobj.value != cpwordobj.value)			{				errlines += "&bull;&nbsp;Password and Confirm Password must be the same.<br />";				errs[2] = 1;			}		return(errlines);}// -----// e_changemodelpage - Model page for particular girl// -----function e_changemodelpage(ep){//	updatelightbox = true;	var params = "ep=" + ep;	enablebb('/ajax_newmodelpage/', params, 'update_cent_ordermenu_tab');}function changemodelpage(aka,set){	var params = "aka=" + aka + "&set=" + set;	enablebb('/ajax_newmodelpage/', params, 'update_cent_ordermenu_tab');}// -----// e_jajax_md_to_memberarea - Initiate member page from modeldir click.// -----function e_jajax_md_to_memberarea(ep){		var params = "ep=" + ep;	enablebb('/ajax_md_to_memberarea/', params, 'update_md_to_memberarea');}function jajax_md_to_memberarea(aka,set,type){	var params = "aka=" + aka + "&set=" + set + "&type=" + type + "&x=" + parseInt(Math.random()*99999999);;	//alert(params);	enablebb('/ajax_md_to_memberarea/', params, 'update_md_to_memberarea');}// -----// e_change_mpintro - Change product showing in model page.// -----function e_change_mpintro(ep){	updatelightbox = true;		var params = "ep=" + ep;	enablebb('/ajax_newmpintro/', params, 'update_mpintro');}function change_mpintro(aka,set){	updatelightbox = true;		var params = "aka=" + aka + "&set=" + set;	enablebb('/ajax_newmpintro/', params, 'update_mpintro');}function update_mpintro(){    if (request.readyState == 4)    {        if (request.status == 200)        {			if ( CheckSession(request) )			{				var mySplitResult = request.responseText.split("|");								//document.getElementById("tabspad").innerHTML = mySplitResult[1];				var ele = document.getElementById("tabspad");				if	(ele != null)					ele.innerHTML =mySplitResult[1];					document.getElementById("modelpageintro").innerHTML = mySplitResult[2];				document.getElementById("ordermenu").innerHTML = mySplitResult[3];					if ( mySplitResult.length > 4 )				{					// update model sets section.					document.getElementById(mySplitResult[5]).innerHTML = mySplitResult[4];				}					// Always update lightbox				Lightbox.init();				updatelightbox = false;			}		}	}}// -----// e_changetab - Handle mousedown on tab to change page.// -----function e_changetab(ep){	var params = "ep=" + ep;	//alert('e_changetab');	enablebb('/ajax_newtabsel/', params, 'update_changetab');}// -----// update_changetab - Update for e_changetab// -----function update_changetab(){	if	(request.readyState == 4)	{		if	(request.status == 200)		{			if ( CheckSession(request) )			{				var mySplitResult = request.responseText.split("|");								//alert('update_changetab ' + mySplitResult[0]);				document.getElementById("cbodypad").innerHTML = mySplitResult[1];								//document.getElementById("tabspad").innerHTML =mySplitResult[2];				var ele = document.getElementById("tabspad");				if	(ele != null)					ele.innerHTML =mySplitResult[2];					if	(mySplitResult[3])				{					Lightbox.init();					updatelightbox = false;				}				if	(mySplitResult[4])				{					document.getElementById("ordermenu").innerHTML = mySplitResult[4];				}			}		}	}}function e_changecenter(ep){	var params = "ep=" + ep;	//alert('e_changecenter');	//enablebb('/ajax_newtabsel/', params, 'updatecenter');	enablebb('/ajax_newtabsel/', params, 'update_changetab');}//--------------------------------------------------------------------------------------------// Update Center//--------------------------------------------------------------------------------------------function updatecenter(){	//alert(request.readyState);	if	(request.readyState == 4)	{		if	(request.status == 200)		{			if ( CheckSession(request) )			{				var mySplitResult = request.responseText.split("|",2);				document.getElementById("cbodypad").innerHTML = mySplitResult[0];				if	(mySplitResult[1] != '')				{					//document.getElementById("tabspad").innerHTML =mySplitResult[1];					var ele = document.getElementById("tabspad");					if	(ele != null)						ele.innerHTML =mySplitResult[1];				}			}		}	}}// Use this when going to or changing model page.function update_cent_ordermenu_tab(){	if	(request.readyState == 4)	{		if	(request.status == 200)		{			if ( CheckSession(request) )			{				var mySplitResult = request.responseText.split("|",3);				document.getElementById("cbodypad").innerHTML = mySplitResult[0];				document.getElementById("ordermenu").innerHTML = mySplitResult[1];								//document.getElementById("tabspad").innerHTML =mySplitResult[2];				var ele = document.getElementById("tabspad");				if	(ele != null)					ele.innerHTML =mySplitResult[2];					// Always update lightbox				Lightbox.init();				updatelightbox = false;			}		}	}}// -----// e_changehomeview	-	Initiate change to home page in response to click on home page view buttons//						such as "Quick View", "Available Now", "Coming Soon", etc.// -----function e_changehomeview(ep){	var params = "ep=" + ep;	enablebb('/ajax_newhomeview/', params, 'newhomeview_update');}// -----// newhoveview_update	-	Update function for e_changehomeview.// -----function newhomeview_update(){	if	(request.readyState == 4)	{		if	(request.status == 200)		{			if ( CheckSession(request) )			{				var mySplitResult = request.responseText.split("|");								document.getElementById("cbodypad").innerHTML = mySplitResult[0];				if ( mySplitResult.length == 2 )				{					//document.getElementById("tabspad").innerHTML = mySplitResult[1];					var ele = document.getElementById("tabspad");					if	(ele != null)						ele.innerHTML =mySplitResult[1];					}			}		}	}}function e_changemodeldir(ep){    request = createRequest();    var url;    var myRandom = parseInt(Math.random()*99999999);    url = "ajax_newmodeldir.php?ep=" + ep;    request.open("GET", url+"&rand="+myRandom, true);    request.onreadystatechange = updatemodeldir;    request.send(null);}function updatemodeldir(){    if    (request.readyState == 4)    {        if    (request.status == 200)        {			if ( CheckSession(request) )			{				//document.getElementById("leftpad-MODELDIR").innerHTML = request.responseText;				document.getElementById("leftpad-MODELDIR").innerHTML = request.responseText;			}		}	}}function e_changepvmode(ep){    request = createRequest();    var url;    var myRandom = parseInt(Math.random()*99999999);    url = "ajax_new_pvprefs.php?ep=" + ep;    request.open("GET", url+"&rand="+myRandom, true);    request.onreadystatechange = updatemodeldir;    request.send(null);}// -----// e_addproducttoorder - Add product to order in response to menu selection on model intro page.// -----function e_addproducttoorder(ep){	var params = "ep=" + ep;	enablebb('/ajax_addtoorder/', params, 'updatecenter');}// -----// e_remove_productfromorder - Remove a product in response to remove button or remove link click on model intro page.// -----function e_remove_productfromorder(ep, producttitle){    var msg;    msg = 'Do you want to remove "' + producttitle + '" from your order?';    if ( confirm(msg) )    {         request = createRequest();        var url;        var myRandom = parseInt(Math.random()*99999999);        url = "ajax_removeproductfromorder.php?ep=" + ep;        request.open("GET", url+"&rand="+myRandom, true);        request.onreadystatechange = update_mpintro;                updatelightbox = true;                request.send(null);    }}// -----// e_jajax_removespecial - Remove a special from the order form in response to unchecking a special's checkbox.// -----function e_jajax_removespecial(element_id, ep, special_title){    var msg;    msg = 'Do you want to remove "' + special_title + '" from your order?';    if ( confirm(msg) )    {         request = createRequest();        var url;        var myRandom = parseInt(Math.random()*99999999);        url = "ajax_removespecial.php?ep=" + ep;        request.open("GET", url+"&rand="+myRandom, true);        request.onreadystatechange = jajax_removespecial_update;                request.send(null);    }    else    {        // Removal not confirmed. Recheck the special box.        var cboxObj;        cboxObj = document.getElementById(element_id);        cboxObj.checked = true;    }}// -----// jajax_removespecial_update - Change HTML of order form after unchecking a special.// -----function jajax_removespecial_update(){    if    (request.readyState == 4)    {        if    (request.status == 200)        {			if ( CheckSession(request) )			{				updatelightbox = false;				var mySplitResult = request.responseText.split("|");								if ( mySplitResult[1] != 30 )				{					if ( mySplitResult.length > 3 )					{						// We need to update the modelpageintro and ordermenu						document.getElementById("modelpageintro").innerHTML = mySplitResult[3];						document.getElementById("ordermenu").innerHTML = mySplitResult[4];						updatelightbox = true;					}										// mySplitResult[2] contains all products currently checked on order form delimited by "!".					// Call UpdateOrderDivs with this string to update all the order info on the page.					UpdateOrderDivs(mySplitResult[2]);				}								document.getElementById("of_order").innerHTML = mySplitResult[0];								if ( updatelightbox )				{					Lightbox.init();					updatelightbox = false;				}			}		}	}}// -----// e_jajax_cb_removeproduct -  Remove a normal product from the order form in response to unchecking a product's checkbox.// -----function e_jajax_cb_removeproduct(element_id, ep, title){    var msg;    msg = 'Do you want to remove "' + title + '" from your order?';    if ( confirm(msg) )    {         request = createRequest();        var url;        var myRandom = parseInt(Math.random()*99999999);        url = "ajax_cb_removeproduct.php?ep=" + ep;        request.open("GET", url+"&rand="+myRandom, true);        request.onreadystatechange = jajax_cb_removeproduct_update;                request.send(null);    }    else    {        // Removal not confirmed. Recheck the checkbox box.        var cboxObj;        cboxObj = document.getElementById(element_id);        cboxObj.checked = true;    }}// -----// jajax_cb_removeproduct_update - Change HTML of order form box after removing normal product. woody// -----function jajax_cb_removeproduct_update(){    if    (request.readyState == 4)    {        if    (request.status == 200)        {			if ( CheckSession(request) )			{				updatelightbox = false;								var mySplitResult = request.responseText.split("|");								if ( mySplitResult[1] != 30 )				{					if ( mySplitResult.length > 3 )					{						// We need to update the modelpageintro and ordermenu						document.getElementById("modelpageintro").innerHTML = mySplitResult[3];						document.getElementById("ordermenu").innerHTML = mySplitResult[4];						updatelightbox = true;					}													// mySplitResult[2] is the product id of the product being removed.					var productid = mySplitResult[2];										UncheckFromOrder(productid);				}							// note did the none and block wrap in attempt to workaround safari draw prob on home page.				document.getElementById("of_order").style.display = 'none';				document.getElementById("of_order").innerHTML = mySplitResult[0];				document.getElementById("of_order").style.display = 'block';								if ( updatelightbox )				{					Lightbox.init();					updatelightbox = false;				}			}		}	}}// -----// UncheckFromOrder - Uncheck product(s) from a clear order or remove (normal) product.//					Set productid to "" for clear order to uncheck all products. Otherwise//					set productid to the product id of the product to uncheck.// -----function UncheckFromOrder(productid){					// We need to PROCESS all products on the home page whose Order check box is checked.	//	// Here are two examples showing productid 0's checkbox and viewlink ids.	// cid: AVAILABLE-0-homecbox-47 vid: AVAILABLE-0-homeview-47	//	// Search through all input elements looking for checked checkboxes.	// When found, set the div's checked to false and set the view div's display to none.		var i;		// loop counter	var el;		// element	var vtlid;	// view text link id		// Get array of all input elements	var aryInputElements = document.getElementsByTagName('INPUT');	// Loop through array of input elements	for (i=0; i<aryInputElements.length; i++)	{		el = aryInputElements[i];		// We only want to concern ourselves with checked checkboxes...		if ( el.type == "checkbox" && el.checked )		{			// ...where the id is *homecbox-pid (where pid is the product id)			if ( el.id.indexOf("homecbox-"+productid) != -1 )			{				document.getElementById(el.id+'x').firstChild.nodeValue = 'Click to Order';	// 1. Change Check box text to read Click to Order				el.checked =  false;	// 2. Uncheck the Check box				vtlid = el.id.replace("homecbox", "homeview");				document.getElementById(vtlid).style.display = 'none'; // 3. Hide the View Form text			}		}	}}function UpdateOrderDivs(pidstr){	// -----	// pidstr contains all products currently checked on order form delimited by "!".	// On home page, we need to make sure all order boxes for products in the pid string are checked	// and products not in the pid string are unchecked.	// -----	var pidArray = pidstr.split("!");		var i;		// loop counter	var el;		// element	var vtlid;	// view text link id	var productid;		// Get array of all input elements	var aryInputElements = document.getElementsByTagName('INPUT');	// Loop through array of input elements	for (i=0; i<aryInputElements.length; i++)	{		el = aryInputElements[i];		if ( el.type == "checkbox" )		{			// Here are two examples showing productid 0's checkbox and viewlink ids.			// cid: AVAILABLE-0-homecbox-47 vid: AVAILABLE-0-homeview-47			pos = el.id.indexOf("homecbox-");			if ( pos != -1 )			{				// el is a checkbox that we are interested in.				// Get the product id from the checkbox id.				productid = el.id.substring(pos+9);				if ( IsInArray(pidArray, productid) )				{					// el is a checkbox for a product which should be checked.					// If it is not checked, check it.					if ( el.checked == false )					{						document.getElementById(el.id+'x').firstChild.nodeValue = 'Order';	// 1. Change Check box text to read Order						el.checked =  true;													// 2. Check the Check box						vtlid = el.id.replace("homecbox", "homeview");						document.getElementById(vtlid).style.display = 'block';				// 3. Show the View Form text					}				}				else				{					// el is a checkbox for a product which should not be checked.					// If it is checked, uncheck it.					if ( el.checked )					{						document.getElementById(el.id+'x').firstChild.nodeValue = 'Click to Order';	// 1. Change Check box text to read Click to Order						el.checked =  false;	// 2. Uncheck the Check box						vtlid = el.id.replace("homecbox", "homeview");						document.getElementById(vtlid).style.display = 'none'; // 3. Hide the View Form text					}				}			}		}	}}function IsInArray(thearray, value){	var l = thearray.length;	var i;	for(i=0; i<l; i++)	{		if( thearray[i]==value )			return( true);	}	return(false);}// ====================================================================================// Custom utility functionsfunction toTitleCase(str) {    return str.substr(0,1).toUpperCase() + str.substr(1).toLowerCase();}      function formatTitle(title) {    return 'SWFAddress Website' + (title != '/' ? ' / ' + toTitleCase(title.substr(1, title.length - 2).replace(/\//g, ' / ')) : '');}function handleChange(event){	if ( initialHandleChange )	{		// -----		// On the initial handle change, we don't want to do anything as		// foxes.php will have already created/drawn the page. If we don't		// do this check the content will be drawn twice on the initial 		// loading of foxes.php.		// -----		initialHandleChange = false;	}	else	{		if (Lightbox.center.style.display == "")			Lightbox.close();		if (myLytebox.doc.getElementById('lyteboxMain').style.display == "")			myLytebox.end();		var parameters = '';		var path;			if ( event.path == "/" )		{			// -----			// If path is "/" then we're to go back to the initial page, but parameters, updfunc, and path are not supplied.			// Set up parameters, updfunc, and path appropriately.			// -----			parameters = "&ep=27c5bnLV29ccgjJTCNmxAEXerasOCZUz_f8ddZccO3boQnQjcK_Vp3PAQTDCiXaekAgfWyv2j50wpFw,";	// newpageid=0			//updfunc = "updatecenter";			updfunc = "update_changetab";			//alert('handlechange');			path = "/ajax_newtabsel/";		}		else		{			for (var p in event.parameters)			{				if ( p == 'uf' )				{					// This parameter is the ajax update function.					// Set the updfunc here and don't add this to the parameter list.					updfunc = event.parameters[p];				}				else				{					parameters += '&' + p + '=' + event.parameters[p];				}			}			path = event.path;		}			request = createRequest();		request.onreadystatechange = eval(updfunc);		var url = geteventurl(path, parameters);		request.open('get', url, true);		request.send(null);	//    SWFAddress.setTitle(formatTitle(event.path));	}}SWFAddress.addEventListener(SWFAddressEvent.CHANGE, handleChange);function geteventurl(path, parameters){	var url = path;	if ( url != '/' )	{		var myRandom = parseInt(Math.random()*99999999);		url = url.replace(/\//g, '') + ".php?rand=" + myRandom + parameters;	}	return( url );}// -----// ajax_setafids - Called in first load of foxes to initialize the affiliate globals used later in links.// -----var NATSafid;var SMafid;function ajax_setafids(nafid, smafid){	NATSafid = nafid;	SMafid = smafid;}function enablebb(r,params,upd){		var x='';	var c='?';		if	(NATSafid)	{		x = "?nats=" + NATSafid;		c = '&';	}			if	(params != '')	{		x += c + params;		c = '&';	}		r += x + c + 'uf=' + upd;/*	if	(params != '')		r = r + '?' + params + '&uf=' + upd;	else		r = r + '?uf=' + upd;	alert(r);*/	SWFAddress.setValue(r);	//	this.blur(); 	return false;}// =====// ajax common routines // =====/*function ajax_make_url(params, url){	var rurl = url + "?nats=" + NATSafid + "&" + params + "&rand=" + parseInt(Math.random()*99999999);	return(rurl);}// -----// ajax_get_request - ajax GET request// -----function ajax_get_request(params, url, callback){	request = createRequest();	request.open("GET", url + params + "&rand="+parseInt(Math.random()*99999999), true);	request.onreadystatechange = callback;	request.send(null);}// -----// ajax_post_request - ajax POST request// -----function ajax_post_request(params, url, callback){	var myRandom = parseInt(Math.random()*99999999);	// url = url.replace(/\//g, '') + ".php?rand=" + myRandom		request = createRequest();	request.open("POST", url, true);	request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");	request.setRequestHeader("Content-length", params.length);	request.setRequestHeader("Connection", "close");	request.onreadystatechange = callback;	request.send(params);}*/// =====// Section.php support functions.// =====// -----// e_memphotos_slideshow - Initiate slideshow// -----function memphotos_download(size){	var obj = document.getElementById('dlmenu');	obj.blur();	if	(size != -1)	{		document.getElementById("dlmenu_0").selected = true;				request = createRequest();		var url;    	var myRandom = parseInt(Math.random()*99999999);    	url = "ajax_memphoto_download.php?size=" + size;    	request.open("GET", url+"&rand="+myRandom, true);		request.onreadystatechange = function()		{			if	(request.readyState == 4)			{        		if	(request.status == 200)        		{					if ( CheckSession(request) )					{						alert(request.responseText);					}				}			}		}    	request.send(null);	}}// -----// e_memphotos_slideshow - Initiate slideshow// -----function e_memphotos_slideshow(secs){	var obj = document.getElementById('ssmenu');	obj.blur();	//alert(obj.options);	if	(secs != -1)	{		document.getElementById("ssmenu_0").selected = true;		//alert(secs);		// Do the slideshow				myLytebox.updateLyteboxItems();		myLytebox.slideInterval = secs * 1000;		myLytebox.navType = 2;		myLytebox.resizeSpeed = 10;		myLytebox.doAnimations = false;		myLytebox.pauseOnNextClick = false;		myLytebox.pauseOnPrevClick = false;		myLytebox.start(document.getElementById("lyteshowstart"), true, false);	}}// -----// e_section_changemode - Change section mode values using encrypted params// -----function e_section_changemode(ep){	request = createRequest();	var url;	    var myRandom = parseInt(Math.random()*99999999);    url = "ajax_sections_echangemode.php?ep=" + ep;    request.open("GET", url+"&rand="+myRandom, true);		//url = ajax_make_url("ep=" + ep, 'ajax_sections_echangemode.php');	//request.open("GET", url, true);    request.onreadystatechange = sections_updatemode;    request.send(null);}// -----// section_changemode - Change section mode values using specified params// -----function section_changemode(pageid, pagetype, sectiontype, modeid, pv){	request = createRequest();		var url;    var myRandom = parseInt(Math.random()*99999999);    url = "ajax_sections_changemode.php?pageid=" + pageid +"&pagetype=" + pagetype + "&sectiontype=" + sectiontype + "&modeid=" + modeid + "&pv=" + pv;	//alert(sectiontype);	    request.open("GET", url+"&rand="+myRandom, true);    request.onreadystatechange = sections_updatemode;    request.send(null);}// -----// section_searchstr - Change search string using specified params// -----function section_searchstr(idx, pageid, pagetype, sectiontype, mode){		request = createRequest();		var val;	if	(mode != 0)		val = document.getElementById(idx).value;	else		val = '';		var url;    var myRandom = parseInt(Math.random()*99999999);    url = "ajax_sections_searchstr.php?pageid=" + pageid +"&pagetype=" + pagetype + "&sectiontype=" + sectiontype + "&str=" + val + "&mode=" + mode;	//alert(url);    request.open("GET", url+"&rand="+myRandom, true);    request.onreadystatechange = sections_updatemode;    request.send(null);}function section_change_srchopt(opt, pageid, pagetype, sectiontype, value){	request = createRequest();	var url;    var myRandom = parseInt(Math.random()*99999999);	url = "ajax_sections_searchstropts.php?opt=" + opt + "&pageid=" + pageid +"&pagetype=" + pagetype + "&sectiontype=" + sectiontype + "&value=" + value;	request.open("GET", url+"&rand="+myRandom, true);	request.onreadystatechange = function()		{			if	(request.readyState == 4)			{        		if	(request.status == 200)        		{					if ( CheckSession(request) )					{						var mySplitResult = request.responseText.split("|");						document.getElementById(mySplitResult[1]).innerHTML = mySplitResult[2];					}				}			}		}    request.send(null);}// -----// sections_updatemode - Update section mode values// -----function sections_updatemode(){	//alert('sections_updatemode');	if	(request.readyState == 4)	{        if	(request.status == 200)        {			if ( CheckSession(request) )			{				var mySplitResult = request.responseText.split("|",4);				//alert(mySplitResult[0]);				//alert(mySplitResult[1]);				//alert(mySplitResult[2]);				document.getElementById(mySplitResult[2]).innerHTML = mySplitResult[1];					if ( mySplitResult[3] == 1 )				{					Lightbox.init();				}			}		}	}}// -----// show_refer - Setup to display recommendation sites on home page.// -----function show_refer(mode){	var params = "mode=" + mode;	enablebb('/ajax_showrefer/', params, 'update_showrefer');}// -----// update_showrefer - Update to display photographer info and sets on home page.// -----function update_showrefer(){	if	(request.readyState == 4)	{		if	(request.status == 200)		{			if ( CheckSession(request) )			{				//alert('update_showrefer');				var mySplitResult = request.responseText.split("|");				document.getElementById("cbodypad").innerHTML = mySplitResult[0];				if ( mySplitResult.length == 2 )				{					//document.getElementById("tabspad").innerHTML = mySplitResult[1];										var ele = document.getElementById("tabspad");					if	(ele != null)						ele.innerHTML =mySplitResult[1];				}			}		}	}}// -----// show_photographer - Setup to display photographer info and sets on home page.// -----function show_photographer(id,name,path){	var params = "id=" + id + "&name=" + name + "&path=" + path;	enablebb('/ajax_showphotographer/', params, 'update_showphotographer');}// -----// show_friend - Setup to display friend info and sets on home page.// -----function show_friend(id,name,path){	var params = "id=" + id + "&name=" + name + "&path=" + path;	enablebb('/ajax_showfriend/', params, 'update_showphotographer');}// -----// update_showphotographer - Update to display photographer info and sets on home page.// -----function update_showphotographer(){	if	(request.readyState == 4)	{		if	(request.status == 200)		{			if ( CheckSession(request) )			{				var mySplitResult = request.responseText.split("|");				document.getElementById("cbodypad").innerHTML = mySplitResult[0];				if ( mySplitResult.length == 2 )				{					//document.getElementById("tabspad").innerHTML = mySplitResult[1];										var ele = document.getElementById("tabspad");					if	(ele != null)						ele.innerHTML =mySplitResult[1];				}			}		}	}}function helponoff(id){	if	(document.getElementById(id).style.display == "block")		document.getElementById(id).style.display = 'none';	else		document.getElementById(id).style.display = 'block';}// -----// section_showhide_csection - Show/Hide, Check/Uncheck collapsable section// -----function section_showhide_csection(sid,cid){	if	(document.getElementById(sid).style.display == "block")	{		document.getElementById(sid).style.display = 'none';		document.getElementById(cid).checked = false;	}	else	{		document.getElementById(sid).style.display = 'block';		document.getElementById(cid).checked = true;	}		// Call php to reset the session var for this section.	request = createRequest();    var url;    var myRandom = parseInt(Math.random()*99999999);    url = "ajax_leftpad_set_showarea.php?id=" + sid + "&status=" + document.getElementById(cid).checked;	//alert(document.getElementById(cid).checked);    request.open("GET", url+"&rand="+myRandom, true);    request.onreadystatechange = function()		{			if	(request.readyState == 4)			{				if	(request.status == 200)				{					if ( CheckSession(request) )					{						//alert(request.responseText);						//var mySplitResult = request.responseText.split("|");						//document.getElementById("cbodypad").innerHTML = mySplitResult[0];						//if ( mySplitResult.length == 2 )						//{						//	document.getElementById("tabspad").innerHTML = mySplitResult[1];						//}					}				}			}		}    request.send(null);	}function section_showintro(id, pid, title){	if	(document.getElementById(id).style.display == "block")		document.getElementById(id).style.display = 'none';	else	{		request = createRequest();		var url;    	var myRandom = parseInt(Math.random()*99999999);    	url = "ajax_sections_homeintro.php?id=" + id +"&pid=" + pid + "&title=" + title;    	request.open("GET", url+"&rand="+myRandom, true);    	request.onreadystatechange = sections_update_homeintro;    	request.send(null);	}}function home_show_specialdetails(id, sid, title){	if	(document.getElementById(id).style.display == "block")		document.getElementById(id).style.display = 'none';	else	{		request = createRequest();		var url;    	var myRandom = parseInt(Math.random()*99999999);    	url = "ajax_sections_homespecial.php?id=" + id +"&sid=" + sid + "&title=" + title;    	request.open("GET", url+"&rand="+myRandom, true);    	request.onreadystatechange = sections_update_homeintro;    	request.send(null);	}}function section_showsample(id, pid, ptype, pdir, title, aspect){	if	(document.getElementById(id).style.display == "block")		section_hidediv(3, -1);		//document.getElementById(id).style.display = 'none';	else	{		var idwidth = (parseInt(document.getElementById(id).style.width));		var pad = (parseInt(document.getElementById(id).style.paddingLeft));		idwidth -= pad;		request = createRequest();		var url;    	var myRandom = parseInt(Math.random()*99999999);    	url = "ajax_sections_homesample.php?id=" + id +"&pid=" + pid + "&ptype=" + ptype + "&pdir=" + pdir + "&title=" + title + "&idwidth=" + idwidth + "&aspect=" + aspect;    	request.open("GET", url+"&rand="+myRandom, true);    	//request.onreadystatechange = sections_update_homesample;		request.onreadystatechange = function()			{				if	(request.readyState == 4)				{        			if	(request.status == 200)        			{						if ( CheckSession(request) )						{							var mySplitResult = request.responseText.split("|");							if	(lastopensamplediv != '')							{								section_hidediv(3, -1);							}							document.getElementById(mySplitResult[2]).style.display = 'block';							upddivid = mySplitResult[2] + '-txt';							document.getElementById(upddivid).innerHTML = mySplitResult[1];							//document.getElementById(mySplitResult[2]).style.display = 'block';							lastopensamplediv = mySplitResult[2];						}					}				}			}    	request.send(null);	}}function section_showpromointro(id, prsiteid){	if	(document.getElementById(id).style.display == "block")		document.getElementById(id).style.display = 'none';	else	{		request = createRequest();		var url;    	var myRandom = parseInt(Math.random()*99999999);    	url = "ajax_sections_promointro.php?id=" + id +"&prsiteid=" + prsiteid;    	request.open("GET", url+"&rand="+myRandom, true);    	request.onreadystatechange = sections_update_homeintro;    	request.send(null);	}}function sections_update_homeintro(){	if	(request.readyState == 4)	{        if	(request.status == 200)        {			if ( CheckSession(request) )			{				var mySplitResult = request.responseText.split("|");								//alert('y' + mySplitResult[1]);				upddivid = mySplitResult[2] + '-txt';				document.getElementById(upddivid).innerHTML = mySplitResult[1];				document.getElementById(mySplitResult[2]).style.display = 'block';			}		}	}}/*function sections_update_homesample(){	if	(request.readyState == 4){        if	(request.status == 200){			var mySplitResult = request.responseText.split("|");						if	(lastopensamplediv != '')			{				//document.getElementById(lastopensamplediv).style.display = 'none';				//lastopensamplediv = '';				section_hidediv(3, -1);			}						//alert('x' + mySplitResult[1]);			upddivid = mySplitResult[2] + '-txt';			document.getElementById(upddivid).innerHTML = mySplitResult[1];			document.getElementById(mySplitResult[2]).style.display = 'block';			lastopensamplediv = mySplitResult[2];		}	}}*/// -----// home_ordercheckbox - Handle user clicking on the Order Checkbox.// -----function home_ordercheckbox(set, title, cid, vid, oid, ofid){	// Woody - Added ofid param which is id of the order form div.		//alert('home_ordercheckbox ' + ofid);		$showOrderOpts = true;		// Hide any Add to Order div that might be showing	if	(lastopenorderdiv != '')	{		section_hidediv(2, -1);	}	else	{		// Hide any View Order div that might be showing as well as removing the orderform html		if	(last_vieworder_id != '')		{			section_hidediv(5, -1);		}	}		if	(document.getElementById(cid).checked == false) // was checked	{		// Box is now unchecked. User wants to remove the product from the order.		// 1. Change the label of the checkbox to 'Click to Order'		// 2. Hide the 'View Order' text link div.		// 3. Set up AJAX call to remove the product from the order list.		document.getElementById(cid+'x').firstChild.nodeValue = 'Click to Order';		document.getElementById(vid).style.display = 'none';				request = createRequest();        var url;	    var myRandom = parseInt(Math.random()*99999999);		url = "ajax_removeproductfromhome.php?set=" + set;		request.open("GET", url+"&rand="+myRandom, true);		//request.onreadystatechange = removeproductfromhome_update;		request.onreadystatechange = function()			{				if	(request.readyState == 4)				{        			if	(request.status == 200)        			{						if ( CheckSession(request) )						{							var mySplitResult = request.responseText.split("|");														if 	( mySplitResult[1] != 30 )							{								updatelightbox = false;										if ( mySplitResult.length > 3 )								{									// We need to update the modelpageintro and ordermenu									document.getElementById("modelpageintro").innerHTML = mySplitResult[3];									document.getElementById("ordermenu").innerHTML = mySplitResult[4];									updatelightbox = true;								}																// mySplitResult[2] contains all products currently checked on order form delimited by "!".								// Call UpdateOrderDivs with this string to update all the order info on the page.								UpdateOrderDivs(mySplitResult[2]);									if ( updatelightbox )								{									Lightbox.init();									updatelightbox = false;								}							}						}					}				}			}		request.send(null);	}	else	{		// Box is now checked. User wants to add this product to the order list.		// Uncheck the box for now.  We will check it later if user doesn't cancel.		document.getElementById(cid).checked = false;				if	($showOrderOpts == true)		{			// Set up AJAX call to show the 'Add to Order' div.			request = createRequest();			var url;    		var myRandom = parseInt(Math.random()*99999999);			url = "ajax_sections_homeorder.php?set=" + set + "&title=" + title + "&id=" + oid + "&cid=" + cid + "&vid=" + vid + "&ofid=" + ofid;			//url = "ajax_sections_homeorder.php?id=" + oid + "&cid=" + cid + "&vid=" + vid + "&ep=" + ep;   	 		request.open("GET", url+"&rand="+myRandom, true);    		//request.onreadystatechange = sections_update_homeorder;			request.onreadystatechange = function()				{					if	(request.readyState == 4)					{        				if	(request.status == 200)        				{							if ( CheckSession(request) )							{								var mySplitResult = request.responseText.split("|");												// Hide any Add to Order div that might currently be showing.								if	(lastopenorderdiv != '')								{									section_hidediv(2, -1);								}												// Hide any View Order div that might currently be showing and destroy its Order Form innerhtml.								if	(last_vieworder_id != '')								{									section_hidediv(5, -1);								}												upddivid = mySplitResult[2] + '-txt';								document.getElementById(upddivid).innerHTML = mySplitResult[1];								document.getElementById(mySplitResult[2]).style.display = 'block';								lastopenorderdiv = mySplitResult[2];							}						}					}				}    		request.send(null);		}	}}// -----// home_addtoorder - Called by Add to Order button in Order Options div// -----function home_addtoorder(form, oid, cid, vid, ofid){	var val;		request = createRequest();		// If there is only one order option, there will be only 3 form items.	// If more than one order option, look through the opt for the correct	// value; otherwise use the only opt.value available.	if	(form.length == 3)	{		val = form.opt.value;	}	else	{		for (var i = 0; i < form.opt.length; i++){			if	(form.opt[i].checked)				break;		}		val = form.opt[i].value;	}	// Woody - Call section_hidediv to hide the order div instea of setting display to none. 	// document.getElementById(oid).style.display = 'none';	// Hide the order div	section_hidediv(2, -1);		var url;	var myRandom = parseInt(Math.random()*99999999);	url = "ajax_addtoorder_fromhome.php?ep=" + val;	request.open("GET", url+"&rand="+myRandom, true);	//request.onreadystatechange = home_addtoorder_update;	request.onreadystatechange = function()		{			if	(request.readyState == 4)			{        		if	(request.status == 200)        		{					if ( CheckSession(request) )					{						var mySplitResult = request.responseText.split("|");												if	( mySplitResult[1] != 30 )							{							// The user is not on the orderform page (30).														updatelightbox = false;							if ( mySplitResult.length > 3 )							{								// User is on a model page if length > 3																document.getElementById("modelpageintro").innerHTML = mySplitResult[3];								document.getElementById("ordermenu").innerHTML = mySplitResult[4];								updatelightbox = true;							}														// mySplitResult[2] contains all products currently checked on order form delimited by "!".							// Call UpdateOrderDivs with this string to update all the order info on the page.														UpdateOrderDivs(mySplitResult[2]);														if ( updatelightbox )							{								Lightbox.init();								updatelightbox = false;							}														//alert('call section_vieworder '+oid+ ' ' + cid + ' ' + vid + ' ' + ofid);														section_vieworder(vid, cid, ofid);						}					}				}			}		}	request.send(null);}function home_cancelorder(id){	section_hidediv(2, -1);	//document.getElementById(id).style.display = 'none';}var last_vieworder_id = '';var last_vieworder_oforder_id = '';var lastopenorderdiv = '';var lastopensamplediv = '';var lastcommentsdiv = '';// -----// section_vieworder - User has clicked on a View Order link.// -----function section_vieworder(vid, cid, id){	showViewOrderDiv = true;		//alert('section_vieworder '+vid+ ' ' + cid + ' ' + id);	// -----	// If we have a last_vieworder_id but the div does not exist or it's display is none	// then reset the view order ids so that the requested div will be shown.	// -----	if(last_vieworder_id != '')	{		if ( document.getElementById(last_vieworder_id) == null || document.getElementById(last_vieworder_id).style.display == 'none' )		{			last_vieworder_id = '';			last_vieworder_oforder_id = '';		}	}	// Hide any Add to Order div that might be showing	if	(lastopenorderdiv != '')	{		//document.getElementById(lastopenorderdiv).style.display = 'none';		//lastopenorderdiv = '';		section_hidediv(2, -1);	}	else	{		// Hide any View Order div that might be showing as well as removing the orderform html		if	(last_vieworder_id != '')		{			//Woody if	(last_vieworder_id == id)			//	showViewOrderDiv = false;							section_hidediv(5, -1);							//document.getElementById(last_vieworder_id).style.display = 'none';			//last_vieworder_id = '';			//document.getElementById(last_vieworder_oforder_id).innerHTML = null;			//last_vieworder_oforder_id = '';		}	}		if	(showViewOrderDiv == true)	{		var idwidth = (parseInt(document.getElementById(id).style.width));				request = createRequest();		var url;    	var myRandom = parseInt(Math.random()*99999999);    	url = "ajax_sections_vieworder.php?id=" + id + "&idwidth=" + idwidth;    	request.open("GET", url+"&rand="+myRandom, true);    	//request.onreadystatechange = sections_update_vieworder;		request.onreadystatechange = function()			{				if	(request.readyState == 4)				{        			if	(request.status == 200)        			{						if ( CheckSession(request) )						{							var mySplitResult = request.responseText.split("|");											last_vieworder_id = mySplitResult[2];							last_vieworder_oforder_id = last_vieworder_id + '-txt';											document.getElementById(last_vieworder_oforder_id).innerHTML = mySplitResult[1];							document.getElementById(last_vieworder_id).style.display = 'block';						}					}				}			}    	request.send(null);	}}/*// -----// sections_update_vieworder - Callback to allow vieworder div to show.// -----function sections_update_vieworder(){	if	(request.readyState == 4){        if	(request.status == 200){			var mySplitResult = request.responseText.split("|");						last_vieworder_id = mySplitResult[2];			last_vieworder_oforder_id = last_vieworder_id + '-txt';						document.getElementById(last_vieworder_oforder_id).innerHTML = mySplitResult[1];			document.getElementById(last_vieworder_id).style.display = 'block';		}	}}*/// -----// home_hidediv - Hide one of the opened usually hidden divs.// -----function section_hidediv(mode, id){	// For Intro and Sample divs we don't care how many are open therefore	// we use the id parameter to hide the div.  For the other div types	// we only allow one to be open at a time.  Instead of using the id param	// here we use the global div id to hide the div.  For the Order Form	// div we also need to null the innerHTML of the div holding the of_order div.	switch (mode)	{		// Intro		case 1:			document.getElementById(id).style.display = 'none';			break;					// Order Options		case 2:			if ( document.getElementById(lastopenorderdiv) != null )			{				document.getElementById(lastopenorderdiv).style.display = 'none';			}			lastopenorderdiv = '';			break;					// Sample		case 3:			if ( document.getElementById(lastopensamplediv) != null )			{								if ( document.getElementById("mediaplayerdiv") != null )					document.getElementById("mediaplayerdiv").innerHTML = "";									document.getElementById(lastopensamplediv).style.display = 'none';			}			lastopensamplediv = '';			break;					// Special Details		case 4:			document.getElementById(id).style.display = 'none';			break;					// Order Form		case 5:			if ( document.getElementById(last_vieworder_id) )			{				document.getElementById(last_vieworder_id).style.display = 'none';			}			last_vieworder_id = '';			if ( document.getElementById(last_vieworder_oforder_id) != null )			{				// -----				// For some reason we had commented this line out. But it NEEDS to be here.				// Otherwise we may have multiple form elements with the same name on the page				// when viewing and hiding the order form on the home page.				// -----				document.getElementById(last_vieworder_oforder_id).innerHTML = "";			}			last_vieworder_oforder_id = '';			break;					case 6:			if ( document.getElementById(lastcommentsdiv) != null )									document.getElementById(lastcommentsdiv).style.display = 'none';			lastcommentsdiv = '';			break;	}}// -----// e_showgallery - Initiate to show a new gallery section from link on free gallery page.// -----function e_showgallery(ep){	request = createRequest();	var url;	var myRandom = parseInt(Math.random()*99999999);	url = "ajax_showfreegallery.php?ep=" + ep;	request.open("GET", url+"&rand="+myRandom, true);	//request.onreadystatechange = updatefreegallery;	request.onreadystatechange = function()		{			if	(request.readyState == 4)			{        		if	(request.status == 200)        		{					if ( CheckSession(request) )					{						var mySplitResult = request.responseText.split("|");						document.getElementById("fp-GALLERY").innerHTML = mySplitResult[0];            						Lightbox.init();						updatelightbox = false;					}				}			}		}	request.send(null);	}// -----// memvideos_showvideo - Setup to show clip in video member area.// -----function memvideos_showvideo(part){	//alert(part);		request = createRequest();		var url;    	var myRandom = parseInt(Math.random()*99999999);    	url = "ajax_memvideo_showvideo.php?part=" + part;    	request.open("GET", url+"&rand="+myRandom, true);    	//request.onreadystatechange = update_memvideos_showvideo;		request.onreadystatechange = function()			{				if	(request.readyState == 4)				{        			if	(request.status == 200)        			{						if ( CheckSession(request) )						{							var mySplitResult = request.responseText.split("|");							document.getElementById(mySplitResult[2]).innerHTML = mySplitResult[1];						}					}				}			}    	request.send(null);}/*function update_memvideos_showvideo(){	//alert('x'); 	if	(request.readyState == 4){        if	(request.status == 200){			var mySplitResult = request.responseText.split("|");			//alert(mySplitResult[0]);			document.getElementById(mySplitResult[2]).innerHTML = mySplitResult[1];		}	}}*/function jajax_unpw_remember(){	var unpw_errors;	var email = document.getElementById("unpw_email").value;	var cc = document.getElementById("unpw2_captchacode").value;		var errAreaDivObj = document.getElementById('unpw_remember_error_area');		var errlines = '';	var errs = new Array(0,0);		// email must not be empty	if ( email == "" )	{		errlines = "&bull;&nbsp;Enter Your Email Address.<br />";		errs[0] = 1;	}	else	{		// Email address must have the correct form.		if ( ! validateEmail(email) )		{			errlines += "&bull;&nbsp;Your email address is invalid.<br />";			errs[0] = 1;		}	}		// Captcha code must not be empty	if ( cc == "" )	{		errlines += "&bull;&nbsp;Enter the Secret Code.<br />";		errs[1] = 1;	}			if ( errlines != "" )	{		unpw_errors = true;		unpw_errdisplay(errs, 0, errAreaDivObj, errlines);	}	else	{		errAreaDivObj.style.display = "none";		unpw_errors = false;	}			if ( ! unpw_errors )	{		request = createRequest();		var url;		var myRandom = parseInt(Math.random()*99999999);		url = "ajax_unpw_remember.php?email=" + urlencode(email) + "&cc=" + urlencode(cc);		request.open("GET", url+"&rand="+myRandom, true);		request.onreadystatechange = jajax_unpw_remember_update;		request.send(null);	}	else	{		document.getElementById("unpw2_captchacode").value = "";		document.getElementById("unpw2_captchaimage").src = "securimage/securimage_show.php?id=upr&sid=" + Math.random();	}}// ------// jajax_unpw_remember_update// -----function jajax_unpw_remember_update(){    if    (request.readyState == 4) 	{        if    (request.status == 200) 		{			if ( CheckSession(request) )			{				var errAreaDivObj = document.getElementById('unpw_remember_error_area');				var mySplitResult;				var numerrors;				var errs = new Array(0,0,0,0,0);					mySplitResult = request.responseText.split("|");				numerrors = mySplitResult[0];								if ( numerrors == 0 )				{					errAreaDivObj.style.display = 'none';					alert(mySplitResult[1]);				}				else					unpw_errdisplay(errs, numerrors, errAreaDivObj, mySplitResult[1]);									document.getElementById("unpw2_captchacode").value = "";				document.getElementById("unpw2_captchaimage").src = "securimage/securimage_show.php?id=upr&sid=" + Math.random();			}		}	}}function jajax_unpw_search(){	var unpw_errors;	var un = document.getElementById("unpw_un").value;	var pw = document.getElementById("unpw_pw").value;	var cc = document.getElementById("unpw_captchacode").value;		var errAreaDivObj = document.getElementById('unpw_error_area');		var errlines = '';	var errs = new Array(0,0,0);		// un must not be empty	if ( un == "" )	{		errlines = "&bull;&nbsp;Enter Your Username.<br />";		errs[0] = 1;	}		// password must not be empty	if ( pw == "" )	{		errlines += "&bull;&nbsp;Enter Your Password.<br />";		errs[1] = 1;	}		// Captcha code must not be empty	if ( cc == "" )	{		errlines += "&bull;&nbsp;Enter the Secret Code.<br />";		errs[2] = 1;	}			if ( errlines != "" )	{		unpw_errors = true;	}	else	{		errAreaDivObj.style.display = "none";		unpw_errors = false;	}	unpw_errdisplay(errs, 0, errAreaDivObj, errlines);		if ( ! unpw_errors )	{		request = createRequest();		var url;		var myRandom = parseInt(Math.random()*99999999);		url = "ajax_unpw_search.php?un=" + urlencode(un) + "&pw=" + urlencode(pw) + "&cc=" + urlencode(cc);		request.open("GET", url+"&rand="+myRandom, true);		request.onreadystatechange = jajax_unpwsearch_update;		request.send(null);	}	else	{		document.getElementById("unpw_captchacode").value = "";		document.getElementById("unpw_captchaimage").src = "securimage/securimage_show.php?id=upc&sid=" + Math.random();	}}function jajax_unpw_combine(un,pw){		request = createRequest();		if	(un=='')	{		document.getElementById("solutionlist").style.display = 'none';	}	else	{		var url;		var myRandom = parseInt(Math.random()*99999999);		url = "ajax_unpw_combine.php?un=" + urlencode(un) + "&pw=" + urlencode(pw);		request.open("GET", url+"&rand="+myRandom, true);		request.onreadystatechange = jajax_unpw_combine_update;		request.send(null);	}}// ------// jajax_unpw_combine_update// -----function jajax_unpw_combine_update(){    if    (request.readyState == 4) 	{        if    (request.status == 200) 		{			if ( CheckSession(request) )			{				document.getElementById("combine_unpw_butt").style.display = 'none';								if (request.responseText == 0 )				{					document.getElementById("combine_unpw_msg").style.display = 'block';				}				else					document.getElementById("combine_unpw_err").style.display = 'block';			}		}	}}function unpw_errdisplay(errs, numerrs, errAreaDivObj, errlines){	var x;	var numerrs;	var txtDivObj;		if	(numerrs == 0)		numerrs = errs[0]+errs[1]+errs[2];			if	(numerrs != 0)	{		x = "<span class='of2_error_hdr'>";		x += "</div><div class='contactformspacer'>&nbsp;</div>";		if	(numerrs == 1)			x += "Error:";		else			x += "Errors:";				x += " (Make corrections above to continue.)<br /></span>";		x += "<div id='unpw_error_lines'>";		x += "<span class='of2_error_txt'>" + errlines + "</span>";				errAreaDivObj.innerHTML = x;		errAreaDivObj.style.display = "block";	}	else	{		errAreaDivObj.style.display = "none";	}}// ------// jajax_unpwsearch_update// -----function jajax_unpwsearch_update(){    if    (request.readyState == 4) 	{        if    (request.status == 200) 		{			if ( CheckSession(request) )			{				var errAreaDivObj = document.getElementById('unpw_error_area');				var mySplitResult;				var numerrors;				var errs = new Array(0,0,0,0,0);				//alert("jajax_contact_update: " + request.responseText);					mySplitResult = request.responseText.split("|");				numerrors = mySplitResult[0];				unpw_errdisplay(errs, numerrors, errAreaDivObj, mySplitResult[1]);								if ( numerrors == 0 )				{					document.getElementById("solutionlist").innerHTML = mySplitResult[2];					document.getElementById("solutionlist").style.display = 'block';				}				else					document.getElementById("solutionlist").style.display = 'none';									document.getElementById("unpw_captchacode").value = "";				document.getElementById("unpw_captchaimage").src = "securimage/securimage_show.php?id=upc&sid=" + Math.random();			}		}	}}function jajax_contactsubmit(){	var help_errors;	var helpname = document.getElementById("helpname").value;	var helpemailaddr = document.getElementById("helpemailaddr").value;	var helpsubject = document.getElementById("helpsubject").value;	var helpmessage = document.getElementById("helpmessage").value;	var helpcaptchacode = document.getElementById("helpcaptchacode").value;		var errAreaDivObj = document.getElementById('help_error_area');		var errlines = '';	var errs = new Array(0,0,0,0,0);		// Name must not be empty	if ( helpname == "" )	{		errlines = "&bull;&nbsp;Please specify your name.<br />";		errs[0] = 1;	}	else	{		// Email address must have the correct form.		if ( ! validateHelpName(helpname) )		{			errlines += "&bull;&nbsp;Invalid characters in name.<br />";			errs[1] = 1;		}	}		// Email Address must not be empty	if ( helpemailaddr == "" )	{		errlines += "&bull;&nbsp;Please specify your email address.<br />";		errs[1] = 1;	}	else	{		// Email address must have the correct form.		if ( ! validateEmail(helpemailaddr) )		{			errlines += "&bull;&nbsp;Your email address is invalid.<br />";			errs[1] = 1;		}	}		// Message must not be empty	if ( helpmessage == "" )	{		errlines += "&bull;&nbsp;Please include a message.<br />";		errs[2] = 1;	}	else	{		// Message must not be too long.		if ( helpmessage.length > 1000 )		{			errlines += "&bull;&nbsp;The message is too long. Please use a shorter message.<br />";			errs[2] = 1;		}	}		// Captcha code must not be empty	if ( helpcaptchacode == "" )	{		errlines += "&bull;&nbsp;Please include the secret code.<br />";		errs[3] = 1;	}		if ( errlines != "" )	{		help_errors = true;	}	else	{		errAreaDivObj.style.display = "none";		help_errors = false;	}	help_errdisplay(errs, 0, errAreaDivObj, errlines);		if ( ! help_errors )	{		request = createRequest();		var url;		var myRandom = parseInt(Math.random()*99999999);		url = "ajax_contact.php?name=" + urlencode(helpname) + "&fromaddr=" + urlencode(helpemailaddr) + "&subject=" + urlencode(helpsubject) + "&message=" + urlencode(helpmessage) + "&ccode=" + urlencode(helpcaptchacode);		request.open("GET", url+"&rand="+myRandom, true);		request.onreadystatechange = jajax_contact_update;		request.send(null);	}	else	{		document.getElementById("helpcaptchacode").value = "";		document.getElementById("captchaimage").src = "securimage/securimage_show.php?id=cu&sid=" + Math.random();	}}// ------// jajax_contact_update// -----function jajax_contact_update(){    if    (request.readyState == 4) 	{        if    (request.status == 200) 		{			if ( CheckSession(request) )			{				var errAreaDivObj = document.getElementById('help_error_area');				var mySplitResult;				var numerrors;				var errs = new Array(0,0,0,0,0);				//alert("jajax_contact_update: " + request.responseText);					mySplitResult = request.responseText.split("|");				numerrors = mySplitResult[0];				help_errdisplay(errs, numerrors, errAreaDivObj, mySplitResult[1]);				if ( numerrors == 0 )				{					//document.getElementById("contactmailer").innerHTML = mySplitResult[2];										// Instead of setting innerHTML, we'll let user know the message has been sent with an alert.					alert(mySplitResult[2]);										// Clear out the contact form fields.					document.getElementById("helpname").value = "";					document.getElementById("helpemailaddr").value = "";					document.getElementById("helpsubject").value = 0;					document.getElementById("helpmessage").value = "";				}				document.getElementById("helpcaptchacode").value = "";				document.getElementById("captchaimage").src = "securimage/securimage_show.php?id=cu&sid=" + Math.random();			}		}	}}function validateEmail(emailaddr){	var emailregex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;	return( emailregex.test( emailaddr ) );}function validateHelpName(helpname){	var nameregex = /^[a-zA-Z0-9. _-]+$/;	return( nameregex.test( helpname ) );}function help_errdisplay(errs, numerrs, errAreaDivObj, errlines){	var x;	var numerrs;	var txtDivObj;		if	(numerrs == 0)		numerrs = errs[0]+errs[1]+errs[2]+errs[3]+errs[4];			if	(numerrs != 0)	{		x = "<span class='of2_error_hdr'>";		if	(numerrs == 1)			x += "Error:";		else			x += "Errors:";		x += " (Make corrections below to continue.)<br /></span>";		x += "<div id='of_error_lines'>";		x += "<span class='of2_error_txt'>" + errlines + "</span>";		x += "</div><div class='contactformspacer'>&nbsp;</div>";		errAreaDivObj.innerHTML = x;		errAreaDivObj.style.display = "block";	}	else	{		errAreaDivObj.style.display = "none";	}}function urlencode(clearString){	var output = '';	var x = 0;	clearString = clearString.toString();	var regex = /(^[a-zA-Z0-9_.]*)/;	while ( x < clearString.length )	{		var match = regex.exec(clearString.substr(x));		if ( match != null && match.length > 1 && match[1] != '')		{			output += match[1];			x += match[1].length;		}		else		{			if ( clearString[x] == ' ' )				output += '+';			else			{				var charCode = clearString.charCodeAt(x);				var hexVal = charCode.toString(16);				output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();			}			x++;		}	}	return(output);}function CheckSession(request){	var sessok = true;//	alert("<" + request.responseText + ">");	if (request.responseText == "")	{		alert("Either your session has expired or you do not have cookies enabled in your browser.");		window.location = "index.php";		sessok = false;	}	return( sessok );}/*function urlencode(str){	str = escape(str);	str = str.replace('+', '%2B');	str = str.replace('%20', '+');	str = str.replace('*', '%2A');	str = str.replace('/', '%2F');	str = str.replace('@', '%40');	return(str);}*/