jQuery.noConflict();
(jQuery);function jJ(v,o) { return((typeof(o)=='object'?o:document).getElementById(v)); }
function jJS(o) { return((typeof(o)=='object'?o:jJ(o)).style); }
function agent(v) { return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); }
function abPos(o) { var o=(typeof(o)=='object'?o:jJ(o)), z={X:0,Y:0}; while(o!=null) { z.X+=o.offsetLeft; z.Y+=o.offsetTop; o=o.offsetParent; }; return(z); }
function XY(e,v) { var o=agent('msie')?{'X':event.clientX+document.body.scrollLeft,'Y':event.clientY+document.body.scrollTop}:{'X':e.pageX,'Y':e.pageY}; return(v?o[v]:o); }

star={};

star.mouse=function(e,o) { if(star.stop || isNaN(star.stop)) { star.stop=0;

	document.onmousemove=function(e) { var n=star.num;
	
		var p=abPos(jJ('star'+n)), x=XY(e), oX=x.X-p.X, oY=x.Y-p.Y; star.num=o.id.substr(4);

		if(oX<1 || oX>100 || oY<0 || oY>19) { star.stop=1; star.revert(); }
		
		else {

			jJS('starCur'+n).width=oX+'px';
			jJS('starUser'+n).color='#111';
			jJ('starUser'+n).value=Math.round(oX/75*75)+'%';
		}
	};
} };

star.update=function(e,o) { var n=star.num, v=parseInt(jJ('starUser'+n).value);

	n=o.id.substr(4); jJ('starCur'+n).title=v;

	req=new XMLHttpRequest(); req.open('GET','code/includes/vote.asp?vote='+(v/75),false); req.send(null);    
jQuery('#msg').attr("style", "display:block;color:#fff");
};

star.revert=function() { var n=star.num, v=parseInt(jJ('starCur'+n).title);

	jJS('starCur'+n).width=Math.round(v*75/75)+'px';
	jJ('starUser'+n).value=(v>0?Math.round(v)+'%':'');
	jJ('starUser'+n).style.color='#888';
	
	document.onmousemove='';

};

star.num=0;
function doComment() {
jQuery('#comment1').submit();
 
 }
 function deletePhoto(intID,newUrl){
	if(confirm('Are you sure you want to delete the selected photo?')){
jQuery.post("admin/code/includes/photo_delete.asp?_r="+Math.random(), {id: intID}, function(data){

if(data.length >0) {	
window.location = newUrl;
}});
}
}
function deleteComment(intID,newUrl){
	if(confirm('Are you sure you want to delete the selected comment?')){
jQuery.post("admin/code/includes/decline_blog_comment.asp?_r="+Math.random(), {intID: intID}, function(data){

if(data.length >0) {	
window.location = newUrl;
}});
}
}




function saveComment(intID,newUrl){
var textmsg = jQuery('#edit-comment'+intID).val();
var ed =tinyMCE.get('edit-comment'+intID);
ed.setProgressState(1); // Show progress



textmsg = ed.getContent();

jQuery.post("code/includes/updatecomment2.asp?_r="+Math.random(), {intID: intID, msg:textmsg, newUrl:newUrl}, function(data){

if(data.length >0) {	
window.location = newUrl;
}});
}
var edit_html='<textarea id="%id%" name="%id%" class="edit-comment-textarea">%text%</textarea>';
function editComment(btn,intID,newUrl){
 var p=jQuery(btn).parent().find('div.comment-text');
 var id='edit-comment'+intID;
	
	pth=p.html();
	pth=pth.replace(/<\/p>/g,'');
	pth=pth.replace(/<(p|br)( \/)?>/g,"\n");
 
	p.before(edit_html.replace(/%id%/g,id).replace(/%text%/g,pth));
	jQuery('#'+id).css({height:p.height()+20});
	p.hide();
	
	jQuery(btn).hide();
	jQuery(btn).parent().find('.save-comment').show();
tinyMCE.init({
		theme : "advanced",
		mode : "textareas",
		plugins : "emotions,paste,style,iespell,insertdatetime,preview,xhtmlxtras",
		
		doctype : '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
		theme_advanced_toolbar_align : "left",
		theme_advanced_toolbar_location : "top",
		skin : "o2k7",
		skin_variant : "black",
		theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,cut,copy,paste,pastetext,pasteword,|,justifyleft,justifycenter,justifyright,justifyfull",
		theme_advanced_buttons2 : "emotions,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "formatselect,fontselect,fontsizeselect",
		
		
	force_br_newlines : true,
        forced_root_block : '', // Needed for 3.x

		debug : false
	});
	
}