/*<script>*/
/*
AJAXed Wordpress
(C) Anthologyoi.com
*/



var aWP = function (){

		var _d=[]; /*_d is an object with an index of i that holds currently active "request" element information*/
		var _p=[]; /*_p is an object with an index of i that holds information that must exist between requests.*/
		var i; /*Currently processing element id*/
		var mrc = '';
		var force = 0;
		var com_hide = '';


	var $ = function(id) {
		return document.getElementById(id);
	};

	var pos = function(ele) {
		var e = $(ele);
		var etop = 0;
			if(e && e.style.display != 'none'){
				if (e.offsetParent) {
					etop = e.offsetTop
					while (e = e.offsetParent) {
						etop += e.offsetTop
					}
				}
			}
		return etop;

	};

	var get_current_scroll = function(){
		var cur_scroll = 0;

		if(document.body && document.body.scrollTop){

			cur_scroll = document.body.scrollTop;

		}else if(document.documentElement && document.documentElement.scrollTop){

			cur_scroll = document.documentElement.scrollTop;
		}

		return cur_scroll;
	};

	var get_form_data = function(i){
		var base = $(i).getElementsByTagName('input');
		var postobj = {};
		var x = base.length;
		var value = '';
		var name = '';
		var radios=[];

		for(y=0; y<x; y++){
			if(base[y].type != 'button'){
				if(base[y].type == 'text' || base[y].type == 'hidden' || base[y].type == 'password' || base[y].type == 'select'){
						value =  base[y].value;
						name = base[y].name;

				}else if(base[y].type == 'checkbox' || base[y].type == 'radio'){

					if (base[y].checked) {
						value =  base[y].value;
						name = base[y].name;
					}

				}

				if(name && value){
					postobj[name] = value;
				}

				name = value= null;
			}
		}
		base = $(i).getElementsByTagName('textarea');
		x = base.length;

		for(y=0; y<x; y++){
			postobj[base[y].name]= base[y].value;
		}
		return postobj;
	};

	var get_throbber = function (){

			var img = document.createElement('img');
			img.src="http://www.alkekenge.com/wp-content/plugins/ajaxd-wordpress/images/throbber.gif";
			img.alt="Please hold now loading";
			img.id = "throbber"+i;
			if(_d[i].submit == 'TRUE'){

				try{$(_d[i].type+'_'+_d[i][_d[i].primary]).parentNode.appendChild(img);}catch(e){}

			}else if(_d[i].this_page && _d[i].pagenum){

				try{$('awppage_'+_d[i].this_page+'_'+_d[i][_d[i].primary]+'_link').appendChild(img);}catch(e){}

			}else if(_d[i].link_num){

				try{$('awp'+_d[i].type+'_link'+_d[i].link_num+'_'+_d[i][_d[i].primary]).appendChild(img);}catch(e){}

			}else{

				try{$('awp'+_d[i].type+'_link_'+_d[i][_d[i].primary]).appendChild(img);}catch(e){}

			}
		};

	return{

		doit : function() {
			var temp = arguments[0];
			var postobj = {};


			if(!temp.i){

				if((!temp.id && !temp.primary) || !temp.type){
					return false;
				}else{
					if(!temp.primary){
						temp.primary = 'id';
					}
				}

				i = 'awp'+temp.type+'_'+temp[temp.primary];

			}else{

				i = temp.i;
				temp.i = null;

			}

			if(!$(i)){
				return false;
			}else{
				e = $(i);
			}

			if(!_p[i]){
				_p[i] = [];
			}

			_d[i] = [];
			_d[i] = temp;

			temp = null;

			if(_d[i].submit == 'TRUE'){
				if($(_d[i].type+_d[i][_d[i].primary])){
					try{$(_d[i].type+_d[i][_d[i].primary]).disabled = true;} catch(e){}
				}
				postobj = get_form_data(i);
				_d[i].force = 1;
			}else{
				postobj['id'] = _d[i].id;
				postobj[_d[i].primary] = _d[i][_d[i].primary];
			}
				postobj['type'] =_d[i].type;

			switch(_d[i].type){


				case 'commentform':

					if(isNaN(_p[i].prev_link)){
						_p[i].prev_link = 1;
						_d[i].faked = 1;
					}

					if(isNaN(_d[i].com_parent)){
						_d[i].com_parent = 0;
					}

					break;				case 'comments':

					if(_d[i].show){
						_p[i].show = _d[i].show;
					}

					if(_d[i].hide){
						_p[i].hide = _d[i].hide;
					}

					break;				case 'post':
					if (_p[i].prev_page == 0 || isNaN(_p[i].prev_page)){ /*The post has never been loaded.*/

						/*If a pagenum isn't passed then there are only two pages.*/
						_d[i].this_page = (isNaN(_d[i].pagenum)) ? 2 : _d[i].pagenum;

						_p[i].prev_page = _d[i].fp;

						_d[i].force = 1;

						postobj['first_page'] = _d[i].fp;

					}else{/*post has been loaded so we are toggling.*/

						if(isNaN(_d[i].pagenum)){
							_d[i].this_page  = (_p[i].prev_page == 2) ? 1 : 2;
						}else{
							_d[i].this_page  = _d[i].pagenum;
						}
					}
					break;		case 'previewcomment':
			postobj['comment'] = $('comment_'+_d[i].id).value;
		break;

					default:
				break;
			}
			var n;
			n=0;
			if(e.innerHTML){
				n = e.innerHTML.length;
			}

			if (n==0 || _d[i].force == 1){

				if(!_d[i].sack){
				aWP.sack = function(){_d[i].result = ajax.responseXML; ajax = null; if(_d[i].result) {aWP.update();}}
			}
				get_throbber();
				ajax = new sack('http://www.alkekenge.com/wp-content/plugins/ajaxd-wordpress/aWP-response.php');
				ajax.method = 'POST';
				ajax.onCompletion = aWP.sack;
				for (k in postobj) {
					ajax.encVar( k, postobj[k]);
				}
				ajax.runAJAX();
			
			}else{

				aWP.toggle.main();

			}
		},

		update: function (){
			var e = $(i);
			_d[i].response = '';

			var nodes = _d[i].result.getElementsByTagName("var");
			if(nodes.length > 0){
				for (j=0; j<nodes.length; j++) {
					if(nodes.item(j).getAttribute('name') && nodes.item(j).firstChild.data){
						_d[i][nodes.item(j).getAttribute('name')] = nodes.item(j).firstChild.data;
					}
				}
			}

			nodes = _d[i].result.getElementsByTagName("response");
			if(nodes.length > 0){
				for (j=0; j<nodes.length; j++) {
					if(nodes.item(j).getAttribute('name')){
						_d[i][nodes.item(j).getAttribute('name')] = nodes.item(j).firstChild.data;
					}else{
						_d[i].response += nodes.item(j).firstChild.data
					}
				}
			}

			nodes = _d[i].result.getElementsByTagName("action");
			if(nodes.length > 0){
				for (j=0; j<nodes.length; j++) {
					if(nodes.item(j).firstChild.data){
						if(nodes.item(j).getAttribute('name')){
							_d[i][nodes.item(j).getAttribute('name')] = nodes.item(j).firstChild.data;
						}else{
							eval(nodes.item(j).firstChild.data);
						}
					}
				}
			}

			if(!_d[i].update_next){
				e.innerHTML = _d[i].response;
				aWP.toggle.main();
			}else{
				eval(_d[i].update_next+'();');
			}
		},

		toggle: {
			main: function (){
				var e = $(i);
				var style = $(i).style.display; /*Otherwise we need to get it several times.*/
				if(style != 'none' && style != 'block'){ /*If the element is displayed, but not explicitly set.*/
					$(i).style.display = 'block'; /*Explicitly set it.*/
				}

				var winHeight = window.innerHeight;
				if(!winHeight){
					//yet another IE fix
					winHeight = document.documentElement.clientHeight;
				}

				if(document.getElementById('throbber'+i)){
					setTimeout("try{document.getElementById('throbber"+i+"').parentNode.removeChild(document.getElementById('throbber"+i+"'));}catch(e){}",100);
				}

				switch(_d[i].type){

//<script>
					case 'commentform':
						var comparent;

							try{ comparent = $('comment_parent_'+_d[i][_d[i].primary]).value
							$('comment_parent_'+_d[i][_d[i].primary]).value = _d[i].com_parent;}catch(e){}


							if(!_p[i].nomove && style != 'none' && !_d[i].nomove){
								if(!$('awpcommentform_anchor_'+_d[i][_d[i].primary])){
									var div = document.createElement('div');
									div.id = 'awpcommentform_anchor_'+_d[i][_d[i].primary];
									div.style.display = 'none';
									$('awpcomments_'+_d[i][_d[i].primary]).parentNode.insertBefore(div, $('awpcommentform_'+_d[i][_d[i].primary]).nextSibling);
								}
							}else{
								_p[i].nomove = 1;
							}

						if(_p[i].prev_link != _d[i].link_num || !_p[i].nomove && comparent ==0 || _d[i].faked ){
							var pos1 = pos(i);

							try{ $('awpcommentform_link'+_d[i].link_num+'_'+_d[i][_d[i].primary]).parentNode.insertBefore($(i), $('awpcommentform_link'+_d[i].link_num+'_'+_d[i][_d[i].primary]).nextSibling);}catch(e){}
							var pos2 = pos(i);

							if(style == 'none' || _d[i].quickclose == 1 ||pos1 == pos2){
								aWP.toggle.pick_switch();
							}

     						try{
								if(_p[i].last_show && (pos1 != pos2  || _d[i].quickclose == 1) && $('awpcommentform_link'+_p[i].prev_link+'_'+_d[i][_d[i].primary])){
									$('awpcommentform_link'+_p[i].prev_link+'_'+_d[i][_d[i].primary]).firstChild.data = _p[i].last_show;
								}
							}catch(e){}


						}else{
							if(_p[i].nomove){
								aWP.toggle.pick_switch();
							}else{
								_d[i].force = 1;
								$('awpcommentform_anchor_'+_d[i][_d[i].primary]).parentNode.insertBefore($('awpcommentform_'+_d[i][_d[i].primary]),$('awpcommentform_anchor_'+_d[i][_d[i].primary]));


								try{$('comment_parent_'+_d[i][_d[i].primary]).value = 0;}catch(e){}


							}
						}

						try{$('submit_commentform_'+_d[i][_d[i].primary]).disabled = false;} catch(e){}

						try{
							if($('awpcommentform_link'+_d[i].link_num+'_'+_d[i][_d[i].primary]).firstChild.data == _d[i].show){
								$('awpcommentform_link'+_d[i].link_num+'_'+_d[i][_d[i].primary]).firstChild.data = _d[i].hide;
							}else{
								$('awpcommentform_link'+_d[i].link_num+'_'+_d[i][_d[i].primary]).firstChild.data = _d[i].show;

							}
						}catch(e){}

							_p[i].last_show = _d[i].show;
							_p[i].prev_link = _d[i].link_num;
						break;
//<script>
					case 'post':
						var hideChildren;
						if(_d[i].hideChildren){
							hideChildren = 'awppost_'+_d[i][_d[i].primary];
						}
						AOI_eff.start('awppage_'+_p[i].prev_page+'_'+_d[i][_d[i].primary], {'mode': 'hide', 'eff': 'Fade', 'queue': ['show::'+'awppage_'+_d[i].this_page+'_'+_d[i][_d[i].primary]], 'background': '#000000', 'hideChildren': hideChildren} );


							if(_d[i].pagenum){
		/*** Add class switching.  ***/
								$('awppage_'+_d[i].this_page+'_'+_d[i][_d[i].primary]+'_link').style.fontWeight = 'bold';

								if(_p[i].prev_page !=_d[i].this_page ){
										$('awppage_'+_p[i].prev_page+'_'+_d[i][_d[i].primary]+'_link').style.fontWeight = 'normal';
								}

							}else{
								var l = $('awppost_link'+'_'+_d[i][_d[i].primary]);
								if(l.firstChild.data == _p[i].hide && !_d[i].noChange){

									l.firstChild.data = _p[i].show;
									l.className = 'awppost_link';

								}else if(!_d[i].noChange){

									l.firstChild.data = _p[i].hide;
									l.className = 'awppost_link_hide';

								}

							}
							_p[i].prev_page = _d[i].this_page;
					break;
			case 'previewcomment':
		$(i).style.height = $('awpsubmit_commentform_'+_d[i].id).offsetHeight+'px';
		$(i).style.top = pos('awpsubmit_commentform_'+_d[i].id)+'px';
		$(i).style.width = $('awpsubmit_commentform_'+_d[i].id).offsetWidth+'px';
		$(i).style.display = 'none';
		$(i).style.overflow = 'auto';
		aWP.toggle.pick_switch();
		$(i).style.position = 'absolute';

		break;
	
					default:
						var toggle = 0;
						if(!_d[i].force){
							try{
								var l = $('awp'+_d[i].type+'_link'+'_'+_d[i][_d[i].primary]);

								if(l.firstChild.data == _p[i].hide){
									l.firstChild.data = _p[i].show;
									l.className = 'awp' + _d[i].type + '_link';;

								}else{

									l.firstChild.data = _p[i].hide;
									l.className = 'awp' + _d[i].type + '_link_hide';

								}
							}catch(e){}

							toggle = 1;
						}

						if( $(i).style.display != 'block' || toggle){
							aWP.toggle.pick_switch();
						}

					break;
				}
				if(_d[i].focus){
					setTimeout("aWP.toggle.smooth_scroll('"+_d[i].focus+"',0);",100);
				}else if(pos(i) > 0 && !_d[i].force && !_d[i].no_jump){
					aWP.toggle.smooth_scroll(i,-1*(winHeight/4));
				}

			},

			pick_switch:function(){

				
				AOI_eff.start(i, {'eff': 'Fade', 'background': '#000000'});


	
			},

			smooth_scroll: function(scrolluntil,extra){
				var end = pos(scrolluntil) + extra;
				var cur_scroll = get_current_scroll();
				var step = 50;
				var scrollto = 0;
				var val = cur_scroll - end;

				if(Math.abs(val) > 50){
					if(Math.abs(val) > 5000){step = 750;} else
					if(Math.abs(val) > 2500){step = 500;} else
					if(Math.abs(val) > 1000){step = 200;} else
					{ step = 50; }
					if (val > 0){
						scrollto =  cur_scroll - step;
					}else if (val < 0){
						scrollto =  cur_scroll + step;
					}

					try{window.parent.scrollTo(0,scrollto);}catch(e){}
					setTimeout("aWP.toggle.smooth_scroll('"+scrolluntil+"',"+extra+")",100);
				}

			}
		},

		complete: function (){
			try{$('throbber'+i).parentNode.removeChild($('throbber'+i));}catch(e){}

			switch(_d[i].type){
 //<script>
						case 'submit_commentform' :

							$('comment_result_'+_d[i][_d[i].primary]).innerHTML = _d[i].response;

							if(!_d[i].error){
								if($('awpcomments_none_'+_d[i][_d[i].primary])){
										if($('awpcomments_none_'+_d[i][_d[i].primary]).style.display != 'none'){
											$('awpcomments_none_'+_d[i][_d[i].primary]).style.display = 'none';
											$('awpcomments_link_'+_d[i][_d[i].primary]).style.display = 'inline';
										}
								}
								if(_d[i].show){

									if(_p[i].prev_link){
										var num = _p[i].prev_link;
									}else{
										var num = 1;
									}
									try{$('awpcommentform_link'+num+'_'+_d[i]['id']).firstChild.data = _d[i].show;}catch(e){}
								}
								/*If the comment form is inside of the comment div, reloading will destroy it, so we move it.*/

								if(_p['awpcommentform_'+_d[i][_d[i].primary]] && !_p['awpcommentform_'+_d[i][_d[i].primary]].nomove){
									$('awpcommentform_anchor_'+_d[i][_d[i].primary]).parentNode.insertBefore($('awpcommentform_'+_d[i][_d[i].primary]),$('awpcommentform_anchor_'+_d[i][_d[i].primary]));
								}else if(_p['awpcommentform_'+_d[i][_d[i].primary]] && _p['awpcommentform_'+_d[i][_d[i].primary]].nomove){
										$('awpcomments_'+_d[i][_d[i].primary]).parentNode.insertBefore($('awpcommentform_'+_d[i][_d[i].primary]), $('awpcomments_'+_d[i][_d[i].primary]));
										$('awpcommentform_'+_d[i][_d[i].primary]).style.display='none';
								}
	
									$('comment_parent_'+_d[i][_d[i].primary]).value = 0;

									$('comment_'+_d[i][_d[i].primary]).value = '';
								try{$(_d[i].type+'_'+_d[i][_d[i].primary]).disabled = false;} catch(e){}

									var temp = 0
									if($('awpcomments_'+_d[i].id).innerHTML.length > 0){
										temp = 1;
									}
								try{
									if(_p['awpcomments_'+_d[i].id] && _p['awpcomments_'+_d[i].id].hide){
										$('awpcomments_link_'+_d[i].id).firstChild.data = _p['awpcomments_'+_d[i].id].hide
									}
								}catch(e){}
									aWP.doit({'id': _d[i].id, 'type': 'comments', 'force': temp, 'focus': 'comment-'+_d[i].mrc});

							}
						break;
			}
		}
	}
}();



/* start live preview */
// <script>(to trick editors into using javascript syntax)

var aWP_livepreview = function(){
//Private Methods and Attributes are only accessible internally.
				var smilies = [':mrgreen:', ':neutral:', ':twisted:', ':arrow:', ':shock:', ':smile:', ':???:', ':cool:', ':evil:', ':grin:', ':idea:', ':oops:', ':razz:', ':roll:', ':wink:', ':cry:', ':eek:', ':lol:', ':mad:', ':sad:', '8-/?)', '8-/?O', ':-/?(', ':-/?)', ':-/??', ':-/?D', ':-/?P', ':-/?o', ':-/?x', ':-/?|', ';-/?)', ':!:', ':?:'];

			var smiliesfiles = ['mrgreen', 'neutral', 'twisted', 'arrow', 'eek', 'smile', 'confused', 'cool', 'evil', 'biggrin', 'idea', 'redface', 'razz', 'rolleyes', 'wink', 'cry', 'surprised', 'lol', 'mad', 'sad', 'cool', 'eek', 'sad', 'smile', 'confused', 'biggrin', 'razz', 'surprised', 'mad', 'neutral', 'wink', 'exclaim', 'question'];

			var smiliesalt = [':mrgreen:', ':neutral:', ':twisted:', ':arrow:', ':shock:', ':smile:', ':???:', ':cool:', ':evil:', ':grin:', ':idea:', ':oops:', ':razz:', ':roll:', ':wink:', ':cry:', ':eek:', ':lol:', ':mad:', ':sad:', '8-)', '8-O', ':-(', ':-)', ':-?', ':-D', ':-P', ':-o', ':-x', ':-|', ';-)', ':!:', ':?:'];

	
		var smiliescount = 0;
		var x = smiliescount = smilies.length;
		var smil_reg = [];

		while(x--){
				smilies[x] = smilies[x].replace(/([\\\^\$*+[\]?{}.=!:(|)])/g,"\\$1");
				smilies[x] = smilies[x].replace(/(\/\\?)/g,"?");
				smil_reg[x] = new RegExp('(>|\\s|^)'+smilies[x]+'(\\s|$|<)', "gm");
		}
			/* private attributes */

		var characters = new Array('---', ' -- ', '--', 'xn&#8211;', '\\.\\.\\.', '\\s\\(tm\\)','(\\d+)"',"(\\d+)'","(\\w)('{2}|\")",'(`{2}|")(\\w)',"(\\w)'","'([\\s.]|\\w)");
		var replacements = new Array('&#8212;', ' &#8212; ', '&#8211;', 'xn--', '&#8230;',' &#8482;','$1&#8243;', '$1&#8242;','$1&#8221;','&#8220;$2','$1&#8216;','&#8217;$1');
		var char_regex = [];
		var charcount =characters.length;
		for(x=0; x< charcount; x++){
			char_regex[x] = new RegExp(characters[x], "g")
		}
		var delay = 0;
	
		var element = [];

		var _cleanhtml = function(text){
					return text;
		};

/* private Methods */

	/*
	// Direct translation of wptexturize from php to javascript
	// Cleaned and optimized for speed and actual usage.*/
		var _js_wptexturize =  function(text) {
			var next = true;
			var output = '';
			var curl = '';
				text = text.replace(/(<[^>]*>)/g, '@%@%@$1@%@%@');
				var textarr = text.split('@%@%@');
				var stop = textarr.length;
				var i = 0;
			while (stop > i) {
				curl = textarr[i];
					if (curl.charAt(0) != '<' && next) { // If it's not a tag

						var x = charcount;
						while(x--){
							if(curl.match(char_regex[x])){
								curl = curl.replace(char_regex[x],replacements[x]);
							}
						}
					} else if ( curl.indexOf('<code') == 0 || curl.indexOf('<pre') == 0) {
						next = false;
					} else {
						next = true;
					}
				curl = curl.replace('/&([^#])(?![a-zA-Z1-4]{1,8};)/g', '&#038;$1');
				output += curl;
				i++;
			}
		return output;

		};

	
		var _js_wpautop = function (pee) {

			pee = pee + "\n\n";
			pee = pee.replace(/<br \/>\s*<br \/>/gi, "\n\n");
			pee = pee.replace(/(<(?:dl|dd|dt|ul|ol|li|pre|blockquote|p|h[1-6])[^>]*>)/gi, "\n$1");
			pee = pee.replace(/(<\/(?:dl|dd|dt|ul|ol|li|pre|blockquote|p|h[1-6])>)/gi, "$1\n\n");
			pee = pee.replace(/\r\n|\r/g, "\n");
			pee = pee.replace(/\n\s*\n+/g, "\n\n");
			pee = pee.replace(/([\s\S]+?)\n\n/gm, '<p>$1 </p>\n');
			pee = pee.replace(/<p>\s*?<\/p>/gi, '');
			pee = pee.replace(/(<p>)*\s*(<\/?(?:dl|dd|dt|ul|ol|li|pre|blockquote|p|h[1-6]|hr)[^>]*>)\s*(<\/p>)*/gi, "$2");
			pee = pee.replace(/<p>(<li.+?)<\/p>/i, "$1");
			pee = pee.replace(/<p><blockquote([^>]*)>/gi, "<blockquote$1><p>");
			pee = pee.replace(/<\/blockquote><\/p>/gi, '</p></blockquote>');
			pee = pee.replace(/\s*\n/gi, " <br />\n");
			pee = pee.replace(/(<\/?(?:dl|dd|dt|ul|ol|li|pre|blockquote|p|h[1-6])[^>]*>)\s*<br \/>/gi, "$1");
			pee = pee.replace(/'<br \/>(\s*<\/?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)/gi, '$1');
			pee = pee.replace(/^((?:&nbsp;)*)\s/gm, '$1&nbsp;');

			return pee;
		};

		var _update = function (id,suf){
			var comment = '';
				if(!element[id]){
					if(suf){

						element[id] = document.getElementById('comment'+suf)
					}else{
						base = document.getElementById('commentform_'+id).getElementsByTagName('textarea');
						x = base.length;
						for(i=0; i<x; i++){
							if(base[i].id = 'comment'){
								element[id] = base[i];
								i = x;
							}
						}
					}	
				}

				comment = element[id].value
				if(comment != ''){
					comment = _js_wpautop(comment);
					comment = _js_wptexturize(comment);
					comment = _cleanhtml(comment);

							 comment = _convertsmilies(comment);
	
      					document.getElementById('add_comment_live_preview_'+id).innerHTML = comment;
				}

		};

			var _convertsmilies = function(text){
			var x = smiliescount;
				while(x--){
					if(text.match(smil_reg[x])){
						text = text.replace(smil_reg[x],'$1<img src="http://www.alkekenge.com/wp-includes/images/smilies/icon_'+smiliesfiles[x]+'.gif" alt="'+smiliesalt[x]+'" class="wp-smiley" />$2');
					}
				}
			return text;
		};
	
	/* Public Methods */
	return {
		preview: function (id,suf) {
			if(delay >= 0){
				_update(id,suf);
				delay = 0;
			}else{
				delay++;
			}
		}
	}
}();

/* start quicktags */
/**
 Originally by Alex King
 http://www.alexking.org/
 edit toolbar used without permission
 This file has been edited from its original state
 The original author should not be held responsible for any bugs.
  **/

var aWP_qt = function(){
 var element =[];
	var edButtons = [];
	var edOpenTags = [];
	var suffix = '';

	var $ = function(id) {
		return document.getElementById(id);
	};

	var _$ = function(id) {

		if(!element[id]){
			if(!suffix){
				base = document.getElementById('commentform_'+id).getElementsByTagName('textarea');
				x = base.length;
				for(i=0; i<x; i++){
					if(base[i].id = 'comment'){
						element[id] = base[i];
						i = x;
					}
				}
			}else{
				element[id] = document.getElementById('comment'+suffix);
			}
		}
		return element[id];
	};


	function edButton(i, display, tagStart, tagEnd, access, open) {
		this.id = i;				// used to name the toolbar button
		this.display = display;		// label on button
		this.tagStart = tagStart; 	// open tag
		this.tagEnd = tagEnd;		// close tag
		this.access = access;		// access key
		this.open = open;			// set to -1 if tag does not need to be closed
	}

	function zeroise(number, threshold) {
		// FIXME: or we could use an implementation of printf in js here
		var str = number.toString();
		if (number < 0) { str = str.substr(1, str.length); }
		while (str.length < threshold) { str = "0" + str; }
		if (number < 0) { str = '-' + str; }
		return str;
	}

	var now = new Date();
	var datetime = now.getUTCFullYear() + '-' +
	zeroise(now.getUTCMonth() + 1, 2) + '-' +
	zeroise(now.getUTCDate(), 2) + 'T' +
	zeroise(now.getUTCHours(), 2) + ':' +
	zeroise(now.getUTCMinutes(), 2) + ':' +
	zeroise(now.getUTCSeconds() ,2) +
	'+00:00';

	edButtons[edButtons.length] = new edButton('ed_strong','b','<strong>','</strong>','b');
	edButtons[edButtons.length] = new edButton('ed_em','i','<em>','</em>','i');
	edButtons[edButtons.length] = new edButton('ed_link','link','','</a>','a'); // special case
	edButtons[edButtons.length] = new edButton('ed_block','b-quote','\n\n<blockquote>','</blockquote>\n\n','q');
	edButtons[edButtons.length] = new edButton('ed_img','img','','','m',-1); // special case
	edButtons[edButtons.length] = new edButton('ed_ul','ul','<ul>\n','</ul>\n\n','u');
	edButtons[edButtons.length] = new edButton('ed_ol','ol','<ol>\n','</ol>\n\n','o');
	edButtons[edButtons.length] = new edButton('ed_li','li','\t<li>','</li>\n','l');
	edButtons[edButtons.length] = new edButton('ed_code','code','<code>','</code>','c');
	edButtons[edButtons.length] = new edButton('ed_quote','Quote','<q>','</q>','');


	function edAddTag(button) {
		if(!edOpenTags[id]){
			edOpenTags[id] = [];}

		if (edButtons[button].tagEnd !== '') {
			edOpenTags[id][edOpenTags[id].length] = button;
			$(edButtons[button].id + '_'+ id).value = '/' + $(edButtons[button].id + '_'+ id).value;
		}
	};

	function edRemoveTag(button) {

		for (i = 0; i < edOpenTags[id].length; i++) {
			if (edOpenTags[id][i]== button) {
				edOpenTags[id].splice(i, 1);
				$(edButtons[button].id + '_'+ id).value = 		$(edButtons[button].id + '_'+ id).value.replace(/\//g, '');
			}
		}
	};

	function edCheckOpenTags(button) {
		if(!edOpenTags[id]){
			edOpenTags[id] = [];}

		var tag = 0;
		for (i = 0; i < edOpenTags[id].length; i++) {
			if (edOpenTags[id][i] == button) {
				tag++;
			}
		}
		if (tag > 0) {
			return true; // tag found
		}
		else {
			return false; // tag not found
		}
	};

		function edInsertContent  (myValue) {
		var myField = _$(id);
			//IE support
			if (document.selection) {
				myField.focus();
				sel = document.selection.createRange();
				sel.text = myValue;
				myField.focus();
			}
			//MOZILLA/NETSCAPE support
			else if (myField.selectionStart || myField.selectionStart == '0') {
				var startPos = myField.selectionStart;
				var endPos = myField.selectionEnd;
				myField.value = myField.value.substring(0, startPos)
						+ myValue
						+ myField.value.substring(endPos, myField.value.length);
				myField.focus();
				myField.selectionStart = startPos + myValue.length;
				myField.selectionEnd = startPos + myValue.length;
			} else {
				myField.value += myValue;
				myField.focus();
			}
		};

	return {
		edCloseAllTags: function (the_id, suf) {
			if( the_id){
				id = the_id;}
		if (suf){
		suffix = suf;}
			if(!edOpenTags[id]){
				edOpenTags[id] = [];}

			var count = edOpenTags[id].length;
			for (o = 0; o < count; o++) {
				aWP_qt.edInsertTag(id,edOpenTags[id][edOpenTags[id].length - 1]);
			}
		},

	// insertion code
		edInsertTag: function (the_id,i, suf) {
		if (the_id){
		id = the_id;}
		if (suf){
		suffix = suf;}
		var myField = _$(id);

			//IE support
			if (document.selection) {
				myField.focus();
			sel = document.selection.createRange();
				if (sel.text.length > 0) {
					sel.text = edButtons[i].tagStart + sel.text + edButtons[i].tagEnd;
				}
				else {
					if (!edCheckOpenTags(i) || edButtons[i].tagEnd === '') {
						sel.text = edButtons[i].tagStart;
						edAddTag(i);
					}
					else {
						sel.text = edButtons[i].tagEnd;
						edRemoveTag(i);
					}
				}
				myField.focus();
			}
			//MOZILLA/NETSCAPE support
			else if (myField.selectionStart || myField.selectionStart == '0') {
				var startPos = myField.selectionStart;
				var endPos = myField.selectionEnd;
				var cursorPos = endPos;
				var scrollTop = myField.scrollTop;
				if (startPos != endPos) {
					myField.value = myField.value.substring(0, startPos)
							+ edButtons[i].tagStart
							+ myField.value.substring(startPos, endPos)
							+ edButtons[i].tagEnd
							+ myField.value.substring(endPos, myField.value.length);
					cursorPos += edButtons[i].tagStart.length + edButtons[i].tagEnd.length;
				}
				else {
					if (!edCheckOpenTags(i) || edButtons[i].tagEnd === '') {
						myField.value = myField.value.substring(0, startPos)
								+ edButtons[i].tagStart
								+ myField.value.substring(endPos, myField.value.length);
						edAddTag(i);
						cursorPos = startPos + edButtons[i].tagStart.length;
					}
					else {
						myField.value = myField.value.substring(0, startPos) +
										edButtons[i].tagEnd  +
										myField.value.substring(endPos, myField.value.length);
						edRemoveTag(i);
						cursorPos = startPos + edButtons[i].tagEnd.length;
					}
				}
				myField.focus();
				myField.selectionStart = cursorPos;
				myField.selectionEnd = cursorPos;
				myField.scrollTop = scrollTop;
			}
			else {
				if (!edCheckOpenTags(i) || edButtons[i].tagEnd === '') {
					myField.value += edButtons[i].tagStart;
					edAddTag(i);
				}
				else {
					myField.value += edButtons[i].tagEnd;
					edRemoveTag(i);
				}
				myField.focus();
			}
		},

		edInsertLink: function(the_id, i, suf) {
		if (the_id){
			id = the_id;
		}		if (suf){
		suffix = suf;}

			if (!edCheckOpenTags(i)) {
				var URL = prompt('Enter the URL' ,'http://');
				if (URL) {
					edButtons[i].tagStart = '<a href="' + URL + '">';
					aWP_qt.edInsertTag(the_id,i);
				}
			}
			else {
				aWP_qt.edInsertTag(the_id,i);
			}
		},

		edInsertImage: function (the_id,myField, suf) {
			if (the_id){
				id = the_id;
			}

			if (suf){
				suffix = suf;
			}

			var myValue = prompt('Enter the URL of the image', 'http://');
			if (myValue) {
				myValue = '<img src="'
						+ myValue
						+ '" alt="' + prompt('Enter a description of the image', '')
						+ '" />';
				edInsertContent(myValue);
			}
		},


		edInsertSmilie: function (the_id,smilie, suf) {
			if (smilie) {
				if (the_id){
					id = the_id;
				}
				if (suf){
					suffix = suf;
				}
				edInsertContent(smilie);
			}
		}
	}
}();

/* start effects */

/**
*	Copyrighted 2007 to:
*	Aaron Huran http://anthologyoi.com
*	The code is released under a Creative Commons Liscense
*	(Attribution-NonCommercial-ShareAlike 2.0)
*	TERMS: (Removal this section indicates agreement with these Terms.)
*	For Personal (non-distribution) this notice (sans Terms section) must remain.
*	For Distribution this notice must remain and attribution through
*	a publically accessible "followable" link on applicable information/download page is required.
*	No Commercial use without prior approval.
**/

var AOI_eff = function () {
	var delay = 100;
	var _d = [];
	var $ = function (id) {
		return document.getElementById(id);
	};

	var hideChildren = function(id){
		var c = document.getElementById(id).getElementsByTagName('div');

		for(x=0; x < c; x++){

			if(c.parentNode.id == id){
				console.log('hi');
			}
		console.log(id, c, document.getElementById(c).parentNode.id)
		}

	}

	return {
		start: function () {
			var	i = arguments[0];

			if (!_d[i]) {
				_d[i] = arguments[1] || [];

				if (!_d[i].queue) {
					_d[i].queue = '';
				}

				if (!_d[i].mode) {
					if ($(i).style.display === 'block') {
						_d[i].mode = 'hide';
					} else {
						_d[i].mode = 'show';
					}
				}

				if(_d[i].hideChildren)
					hideChildren(_d[i].hideChildren);
				AOI_eff.setup(i);
			}
		},
		setup: function (i) {

			if ($(i)) {
				if (_d[i].mode === 'hide') {
					_d[i].step = -10;

					AOI_eff.ready(i, 'hide');
				} else if (_d[i].mode === 'show') {

					_d[i].step = 10;
					AOI_eff.ready(i, 'show');
				} else if (_d[i].mode === 'other') {
					_d[i].step = 10;
					AOI_eff.ready(i, 'other');
				}

				if (!_d[i].delay) {
					_d[i].delay = delay;
				}

				AOI_eff.doit(i);
			} else {
				return false;
			}
		},
		ready: function (i, m) {
			var e = $(i).style;
			switch (_d[i].eff) {
				case 'Expand':

					_d[i]['overflow'] = e.overflow;
					_d[i]['lineHeight'] = e.lineHeight;
					_d[i]['letterSpacing'] = e.letterSpacing;

					if (m === 'show') {
						e.overflow = 'hidden';
						e.lineHeight = '300%';
						e.letterSpacing = '1em';
					}

					break;
				case 'SlideUp':
					_d[i]['height'] = $(i).offsetHeight;
					if (m === 'show') { /*We need an object to be displayed to retrieve height.*/
						e.position='absolute'; /*Pull the element out of its default location*/
						e.visibility='hidden'; /*Hide the element*/
						e.display='block';/*"Display" the hidden element*/
						_d[i]['height'] = $(i).offsetHeight;
						e.visibility=''; /*Show it*/
						e.position='relative'; /*Put it back where it was*/
						e.height = '0px'; /*shrink it for the effect.*/
					}
					e.overflow="hidden";
					break;

				case 'ScrollLeft':
					_d[i]['marginLeft'] = e.marginLeft;
					if (m === 'show') {
						e.marginLeft = 80+'%';
					}
					break;
				case 'Fade':
					e.zoom = 1;/*IE fix*/
					e.backgroundColor = _d[i].background;
					if (m === 'show') {
						e.filter = 'alpha(opacity=0)';
						e.opacity = 0;
					}
					break;
			}

			if (m === 'show') {
				e.display = 'block';
			}
		},
		doit: function (i) {
			var e = $(i).style; /**/
			var m = _d[i].mode;
			var s = _d[i].step;
			var v = 0;

			if ( _d[i].step !== 0  ) {
				switch (_d[i].eff) {
					case 'Expand':
						if 	( m === 'hide' ) {
							v = (100+ (10+s)*20); /*IE fix*/
							e.lineHeight = v+'%';
							e.letterSpacing = ((10+s)*3)+'px';
							_d[i].step += 1;
						} else {
							v = (300 - (10-s)*20);/*IE fix*/
							e.lineHeight = v+'%';
							e.letterSpacing = s*2+'px';
							_d[i].step -= 1;
						}
					break;

					case 'SlideUp':
						if 	( m === 'hide' ) {
							e.height =  Math.floor( _d[i]['height']*s*-0.1)+'px';
							_d[i].step += 1;
						} else {
							e.height = Math.floor( _d[i]['height']*(10-s)*0.1)+'px';
							_d[i].step -= 1;
						}
					break;

					case 'ScrollLeft':

						if 	( m === 'hide' ) {
							if ((!window.innerHeight && s < -3) || window.innerHeight ) {/*IE fix*/
								e.marginLeft=((10 + s)*10)+'%';
							}
							_d[i].step += 1;
						} else {
							e.marginLeft=(s*8)+'%';
							_d[i].step -= 1;
						}
					break;

					case 'Fade' :
						if 	( m === 'hide' ) {
							e.opacity = (s)/-10;
							e.filter = 'alpha(opacity='+(s*-10)+')';
							_d[i].step+= 1;
						} else {
							e.filter = 'alpha(opacity='+((10-s)*10)+')';
							e.opacity = (10 - s)/10;
							_d[i].step -= 1;
						}
						break;
					default:
						_d[i].step = 0;
						break;

				}
					setTimeout("AOI_eff.doit('"+i+"');",  _d[i].delay); /*Call next frame after delay.*/
			} else {
				AOI_eff.finish(i); /*Clean up*/
			}
		},
		finish: function (i) {
			var e = $(i).style; /**/
			if ( _d[i].mode === 'hide' ) {
				e.display = 'none';
			}

			switch (_d[i].eff) {
				case 'Expand':
					if ( _d[i]['overflow'] ) {
						e.overflow = _d[i]['overflow'];
					}

					e.lineHeight ="normal";
					e.letterSpacing ="normal";

					break;
				case 'SlideUp':
					e.height = _d[i]['height']+'px';
					if(window.innerHeight){ /*IE has problems setting height to auto.*/
						e.height = 'auto';}
					e.overflow="visible";
					break;
				case 'ScrollLeft':
					e.marginLeft = _d[i]['marginLeft'] ;
					break;
				default :
					e.opacity = 10;
					e.filter = 'alpha(Opacity=100)';
			}

			if ( _d[i].queue.length > 0 ) {/* Checks to see if there is another effect*/
				var val;

				val = _d[i].queue.shift().split('::'); /*Gets values for first queue'd item*/
				if (val[2]) { /*Sets effect*/
					_d[i].eff = val[2];
				}
				if (val[3]) { /*Sets delay*/
					_d[i].delay = val[3];
				}
				dtemp = _d[i];
				_d[i] = null;
				_d[val[1]] = [];
				_d[val[1]] = dtemp;
				_d[val[1]].mode = val[0];


				AOI_eff.setup(val[1]);
			} else {
				_d[i] = null;
			}
		}
	};
}();