/* Copyright (c) 2007 WildFireWeb Inc.* wildfireweb.com* All rights reserved* This copyright notice MUST stay intact* Developed by Steve Sweet*/function addBlogComment(obj, post_id) {	blogComment.select(obj, post_id);	BlogComment_operation = '0';}function blogContactForm(obj, post_id, name) {	blogComment.select(obj, post_id);	document.getElementById('post_title').innerHTML = "Send an Email to "+name;	document.getElementById('message_row').innerHTML = "<strong>NOTE:</strong> Your Internet session is being recorded<br>and can be traced back to your Internet account.<br>SPAM will not be tollerated.";	document.getElementById('name_row').style.display='';	document.getElementById('website_row').style.display='none';	document.getElementById('comment_row').style.display='';	BlogComment_operation = '1';}function blogAddToNotifyList(obj, post_id, name) {	blogComment.select(obj, post_id);	document.getElementById('post_title').innerHTML = "Notify me when changes are made to:<br>"+name;	document.getElementById('message_row').innerHTML = "";	document.getElementById('name_row').style.display='';	document.getElementById('website_row').style.display='none';	document.getElementById('comment_row').style.display='none';	BlogComment_operation = '2';}function blogRemoveFromNotifyList(obj, post_id, name) {	blogComment.select(obj, post_id);	document.getElementById('post_title').innerHTML = "Remove me from notify list for:<br>"+name;	document.getElementById('message_row').innerHTML = "";	document.getElementById('name_row').style.display='none';	document.getElementById('website_row').style.display='none';	document.getElementById('comment_row').style.display='none';	BlogComment_operation = '3';}function blogSendNotifyList(post_id, url) {	var operation = '4';	var query = 'subsendnotify=1&post_id='+post_id+'&url='+url+'&stamp='+stamp+'&operation='+operation;	ajaxRequest('/blogrequest.php', query, commentResponse);}function blogPublished(post_id, obj) {	if (obj.checked)		published = '1';	else		published = '0';	var query = 'subblogpostpublished=1&site_id='+site_id+'&page='+page+'&post_id='+post_id+'&published='+published;	ajaxRequest('/process.php', query, nothingResponse);}function showBlogArchive(obj, target) {	var top, left;	obj.style.display='block'; 	if (target) {		target.innerHTML = 'Hide Archive';		// measure relative to parent div		top = parseInt(target.offsetTop)+20;		left = parseInt(document.getElementById('wfw_blog_wrapper').offsetWidth)-parseInt(obj.offsetWidth);		obj.style.left=left+'px';		obj.style.top=top+'px'; 	}}function hideBlogArchive(obj, target) {	obj.style.display='none'; 	if (target)		target.innerHTML = 'View Archive'; }function toggleBlogArchive() {	var obj = document.getElementById('wfw_archive');	if (obj) {/*		// move archive into another div so it's position is relative to body		if (obj.parentNode.id != 'BlogArchiveDiv') {			var moveto = document.getElementById('BlogArchiveDiv');			moveto.insertBefore(obj, moveto.firstChild);			moveto.style.visibility='visible';		}*/		var target = document.getElementById('archive_link');		(obj.style.display=='block') ? hideBlogArchive(obj,target) : showBlogArchive(obj,target);	}}// move the blog archive into a block specified by anchorfunction moveBlogArchive(anchor) {	var archive = document.getElementById('wfw_archive');	if (archive) {		var moveto = document.getElementById(anchor);		if (moveto) {			moveto.insertBefore(archive, moveto.firstChild);			moveto.style.visibility='visible';			archive.style.display = 'block';			archive.style.position = 'relative';			var link = document.getElementById('archive_link');			link.style.display = 'none';		}	}}function blogShowHideUserForm() {	var newuser = document.getElementById('newuser');	if (document.forms.blog_user_form.user_id.value) {		newuser.style.display='none';	}	else {		newuser.style.display='block';	}}function blogShowHideAllowComments() {	var allow = document.forms.blog_settings_form.allow_comments.checked;	if (allow && isIE) {		document.getElementById('comment_1').style.display='block';		document.getElementById('comment_2').style.display='block';	}	else if (allow) {		document.getElementById('comment_1').style.display='table-row';		document.getElementById('comment_2').style.display='table-row';	}	else {		document.getElementById('comment_1').style.display='none';		document.getElementById('comment_2').style.display='none';	}}function blogShowHideNotifyEmail() {	var allow_comments = document.forms.blog_settings_form.allow_comments.checked;	var allow_notify = document.forms.blog_settings_form.allow_notify.checked;	if (allow_comments || allow_notify) {		if (isIE)			document.getElementById('comment_2').style.display='block';		else			document.getElementById('comment_2').style.display='table-row';	}	else {		document.getElementById('comment_2').style.display='none';	}}function blogShowHideDateFormat() {	var show = document.forms.blog_settings_form.show_date.checked;	if (show) {		document.getElementById('date_format_row').style.display='';	}	else {		document.getElementById('date_format_row').style.display='none';	}}function blogCancelForm(returnurl) {	window.location.href=returnurl;}var blogUrl;function blogSubmitUserForm(returnurl) {	blogUrl = returnurl;	var myform = document.forms.blog_user_form;	var blog_id = '';	var post_id = '';	// slates assign users to individual slate posts	if (myform.post_id)		post_id = myform.post_id.value;	// blogs assign users to entire blog	if (myform.blog_id)		blog_id = myform.blog_id.value;	var user_id = myform.user_id.value;	var client_id = myform.client_id.value;	var salutation = myform.salutation.value;	var first = myform.first.value;	var last = myform.last.value;	var email = myform.email.value;	var username = myform.username.value;	var pass1 = myform.password.value;	var pass2 = myform.passwordagain.value;	first = salutation + ' ' + first;	var query = 'subsetbloguser=1&blog_id='+blog_id+'&post_id='+post_id+'&site_id='+site_id+'&page='+page+'&client_id='+client_id+'&user_id='+user_id+'&first='+first+'&last='+last+'&email='+email+'&username='+username+'&pass1='+pass1+'&pass2='+pass2;	ajaxRequest('/process.php', query, blogFormResponse);}function blogSubmitSettingsForm(returnurl) {	blogUrl = returnurl;	var myform = document.forms.blog_settings_form;	var blog_id = myform.blog_id.value;	var allow_comments = '0';	var notify = '0';	var notify_email = '';	var pagecount = '6';	var show_breadcrumb_list = '0';	var showall = '0';	var is_directory = '0';	var directory_type = 'Department';	// certain options aren't on both slate and blog form so check for object	if (myform.allow_comments)		allow_comments = myform.allow_comments.checked ? '1' : '0';	if (myform.notify)		notify = myform.notify.checked ? '1' : '0';	if (myform.notify_email)		notify_email = myform.notify_email.value;	if (myform.pagecount)		pagecount = myform.pagecount.value;	if (myform.show_breadcrumb_list)		show_breadcrumb_list = myform.show_breadcrumb_list.checked ? '1' : '0';	if (myform.is_directory)		is_directory = myform.is_directory.checked ? '1' : '0';	if (myform.directory_type)		directory_type = myform.directory_type.value;	if (myform.showall)		showall = myform.showall.checked ? '1' : '0';	var show_author = myform.show_author.checked ? '1' : '0';	var show_category = myform.show_category.checked ? '1' : '0';	var show_keywords = myform.show_keywords.checked ? '1' : '0';	var show_summary = myform.show_summary.checked ? '1' : '0';	var show_date = myform.show_date.checked ? '1' : '0';	var show_back_next = myform.show_back_next.checked ? '1' : '0';	var date_format = myform.date_format.value;	var time_zone = myform.time_zone.value;	if (myform.layout[1].checked)		layout = '1';	else if (myform.layout[2].checked)		layout = '2';	else		layout = '0';	var query = 'subsetblogsettings=1&blog_id='+blog_id+'&site_id='+site_id+'&page='+page+'&allow_comments='+allow_comments+'&notify='+notify+'&notify_email='+notify_email+'&show_author='+show_author+'&show_category='+show_category+'&show_keywords='+show_keywords+'&show_summary='+show_summary+'&show_date='+show_date+'&date_format='+date_format+'&time_zone='+time_zone+'&layout='+layout+'&pagecount='+pagecount+'&show_breadcrumb_list='+show_breadcrumb_list+'&is_directory='+is_directory+'&directory_type='+directory_type+'&showall='+showall+'&show_back_next='+show_back_next;	ajaxRequest('/process.php', query, blogFormResponse);}function blogFormResponse() {	if (xmlhttp.readyState==4) {		if (xmlhttp.responseText != 'OK') {			var errobj = document.getElementById('blog_errors');			if (errobj) errobj.innerHTML = xmlhttp.responseText;			else alert(xmlhttp.responseText);		}		else			window.location.href=blogUrl;	}}// everything below here is for the popup blog comment formBlogComment_thisWindow = null;BlogComment_thisObject = null;BlogComment_post_id = null;BlogComment_operation = '0';	// 0=blog post 1=contact form 2=notify list 3=remove notify listfunction BlogComment_show(anchorname) {	this.showPopup(anchorname);}function BlogComment_doSubmit() {	var post_id = window.BlogComment_post_id;	var name = document.forms.blogform.elements['bcname'].value;	var email = document.forms.blogform.elements['bcemail'].value;	var website = document.forms.blogform.elements['bcwebsite'].value;	var comment = document.forms.blogform.elements['bccomment'].value;	var errs = '';	var errcnt = 0;	var operation=BlogComment_operation;	if (operation == '0' || operation == '1' || operation == '2') {		// validate name		var validRegExp = /^[a-z -_]+$/i;		if (name.search(validRegExp) == -1) {			errcnt++;			errs += errcnt+') Please enter a valid name\n';		}	}	// validate email	validRegExp = /^([_+a-z0-9-]+\.)*[_+a-z0-9-]+@([_+a-z0-9-]+\.)*([_+a-z0-9-]+\.)*[a-z0-9-]+\.[a-z]{2,}$/i;    if (email.search(validRegExp) == -1) {		errcnt++;		errs += errcnt+') Please enter a valid email address\n';	}	validRegExp = /^((http|https)(:\/\/))?([a-z0-9-]+\.)*[a-z0-9-]+\.[a-z]{2,}$/i;    if (website.length > 0 && website.search(validRegExp) == -1) {		errcnt++;		errs += errcnt+') Enter a valid website address or none at all\n';	}	if (operation == '0' || operation == '1') {		// validate comment		if (comment.length === 0) {			errcnt++;			errs += errcnt+') Please enter a comment\n';		}		else {			// no html allowed			var validRegExp = /<[^>]*>/;			// validate comment			if (comment.search(validRegExp) != -1) {				errcnt++;				errs += errcnt+') Sorry, no HTML is allowed in comment\n';			}		}	}	if (errcnt) {		alert('THERE WERE SOME ERRORS IN THE FORM\n'+errs);		return false;	}	var query = 'post_id='+post_id+'&name='+name+'&email='+email+'&website='+website+'&stamp='+stamp+'&operation='+operation+'&comment='+comment;	ajaxRequest('/blogrequest.php', query, commentResponse);	window.BlogComment_thisWindow.hidePopup();	return false;}function commentResponse() {	if (xmlhttp.readyState==4) {		if (xmlhttp.responseText != 'OK')			alert(xmlhttp.responseText);		else			window.location.reload( false );	}}function nothingResponse() {}function BlogComment_doCancel() {	window.BlogComment_thisWindow.hidePopup();	return false;}function BlogComment_select(anchorname,post_id) {	window.BlogComment_post_id = post_id;	this.show(anchorname);	// clear the form	document.forms.blogform.elements['bcname'].value='';	document.forms.blogform.elements['bcemail'].value='';	document.forms.blogform.elements['bcwebsite'].value='';	document.forms.blogform.elements['bccomment'].value='';}	function BlogComment() {	var windowMode = false;	var divname, cp;	// Create a new PopupWindow object	if (arguments.length===0) {		divname = "BlogCommentDiv";	}	else if (arguments[0] == "window") {		divname = '';		windowMode = true;	}	else {		divname = arguments[0];	}		if (divname !== "") {		cp = new PopupWindow(divname);	}	else {		cp = new PopupWindow();		cp.setSize(500,200);	}	// Object variables	cp.currentValue = "";		// Method Mappings	cp.show = BlogComment_show;	cp.select = BlogComment_select;	// this is our html for window	var cp_contents = "";	var windowRef = (windowMode)?"window.opener.":"";	window.BlogComment_thisWindow = cp;	window.BlogComment_thisObject = cp;	if (windowMode) {		cp_contents += '<HTML><HEAD>\n';		cp_contents += '<TITLE>Post a Comment</TITLE></HEAD>\n';		cp_contents += '<BODY MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" TOPMARGIN="0"><CENTER>\n';	}	cp_contents += '<form class="blogcommentform" name="blogform" onSubmit="return false;" action="" method="post" autocomplete="off">\n';	cp_contents += '<table align="center" border="0" cellspacing="0" cellpadding="4">\n';	cp_contents += '	<tr>\n';	cp_contents += '		<th colspan="2" id="post_title">Post a Comment</th>\n';	cp_contents += '	</tr>\n';	cp_contents += '	<tr>\n';	cp_contents += '		<td colspan="2" id="message_row">In order to limit spam, <strong>no HTML</strong> is allowed in the message.<br>Your email address will remain private.<br><strong>Please complete all required fields</strong>.</td>\n';	cp_contents += '	</tr>\n';	cp_contents += '	<tr id="name_row">\n';	cp_contents += '		<td align="right">Your Name <font color=red>*</font></td>\n';	cp_contents += '		<td align="left"><input type="text" name="bcname" size="32" maxlength="64"></td>\n';	cp_contents += '	</tr>\n';	cp_contents += '	<tr>\n';	cp_contents += '		<td align="right">Your Email <font color=red>*</font></td>\n';	cp_contents += '		<td align="left"><input type="text" name="bcemail" size="32" maxlength="64"></td>\n';	cp_contents += '	</tr>\n';	cp_contents += '	<tr id="website_row">\n';	cp_contents += '		<td align="right">Website (optional)</td>\n';	cp_contents += '		<td align="left"><input type="text" name="bcwebsite" size="32" maxlength="64"></td>\n';	cp_contents += '	</tr>\n';	cp_contents += '	<tr id="comment_row">\n';	cp_contents += '		<td colspan="2" align="left">Message <font color=red>*</font><br>\n';	cp_contents += '		<textarea name="bccomment" cols="64" rows="10"></textarea>\n';	cp_contents += '		</td>\n';	cp_contents += '	</tr>\n';	cp_contents += '	<tr>\n';	cp_contents += '		<td colspan="2" align="right"><font color=red>*</font> required fields \n';	cp_contents += '          <input onClick="'+windowRef+'BlogComment_doCancel();" class="submitinput" type="submit" name="Cancel" id="Cancel" value="Cancel">\n';	cp_contents += '          <input onClick="'+windowRef+'BlogComment_doSubmit();" class="submitinput" type="submit" name="Submit" id="Submit" value="Submit">\n';	cp_contents += '		</td>\n';	cp_contents += '	</tr>\n';	cp_contents += '</table>\n';	cp_contents += '</form>\n';	if (windowMode) {		cp_contents += "</CENTER></BODY></HTML>\n";	}	// Write the contents to the popup object	cp.populate(cp_contents+"\n");	cp.offsetY = -100;	cp.offsetX = -200;	cp.width = 400;	cp.autoHide();	return cp;}// placeholder for special function to be included in// templates that need itfunction blogLinkMouseOver(obj) {}function blogLinkMouseOut(obj) {}function blogLinkClick(obj) {	return true;}var blogComment = new BlogComment(); 