// JavaScript Document
$(function(){
		   $('#newpostfixed').click(function(){
											 if($('#newpostpage').html().indexOf("login") != -1){
											 	$('#loginwrap').toggle();
												scroll(0,0);
											 }
											 else{
												 $('#newpostpage').toggle()
												 $('#darkbg').toggle()
											 	
											 }
											 
											 });
		   });

$(function(){
		   $('#darkbg').click(function(){
									   $('#darkbg').toggle();$('#newpostpage').toggle();
									   })});
function highlightThread(id){
	$('#'+id).children().css({'background-color':'#ff95e7', 'text-shadow': '1px 1px 0px #fff', 'color':'#000000'});
	$('#'+id).children().children().css('color', '#000000');
}

function deHighlightThread(id){
	$('#'+id).children().css('background-color', '#ffb4ee');	
}
function showDetails(id){
	$('#'+id).toggle();
}

function getNewPost(thread){
	$('#newpostpage').load('getnewpostpage.php?'+thread);	
}
function getNewQuote(thread, quote){
	loadThing();
	$('#newpostpage').load('getnewpostpage.php?'+thread+'&quoteid='+quote);
}
function getNewEdit(thread, quote){
	loadThing();
	$('#newpostpage').load('getnewpostpage.php?'+thread+'&edit='+quote);
}
function showNewPost(thread){
	loadThing();
	$('#newpostpage').load('getnewpostpage.php?'+thread);
}
function replyPM(pm){
	loadThing();
	$('#newpostpage').load('newpm.php?pmreply='+pm);
}
function showReg(vd){
	$('#'+vd+'vd').show();	
}
function hideReg(vd){
	
	$('#'+vd+'vd').hide();
}
function deleteTopThing(topthing){
	$.post('../admin/admincontroller.php',
	{func:'deletetopthing',	topthing:topthing},	
	function(data){
		alert(data);
		$('#'+topthing).remove();	
	});
}

function loadThing(){
	$('#darkbg').toggle();
	var loadwrap = document.createElement('div');
	$('#newpostpage').html('');
	$(loadwrap).css({
			'top':'50%',
			'width':'100%',
			'height':'70px',
			'padding':'70px 0',
			'marginTop':'-105px',
			'position':'absolute',
			'background':'#000',
			'borderTop':'3px solid #f2f2f2',
			'borderBottom':'3px solid #f2f2f2',
			'textAlign':'center',
			'fontSize': '65px'
			});
			
	$(loadwrap).html('<img src="http://forums.kickitsfaceoff.com/images/Smilies/spacclap.GIF" />&nbsp; Loading...<img src="http://forums.kickitsfaceoff.com/images/Smilies/sunny.gif" />');
	$('#newpostpage').append(loadwrap).fadeIn();
}
