var editing = false;
var x = 0;

function login()
{

	if (x++ < 2) return;	
	try 
	{
		if (window.thispagename == 'credapp') {
			location.href='fandistart.php';
			return;
		}
		if (window.thispagename == 'inventory') {
			location.href='/data/';
			return;
		}
		
	} catch (e) {}
	if (!editing)
	{
		document.getElementById('maincontenteditor').style.display='block'; 
		document.getElementById('pass').focus(); 
		document.getElementById('pass').value='';
	}
}

function toggleview (objid)
{
	if (document.getElementById(objid).style.display=='block')
	{
		document.getElementById(objid).style.display='none';
	}
	else
	{
		document.getElementById(objid).style.display='block';	
	}
}

function showeditor_home()
{
	$('#upcomingauctions').load ('editorauctiondates.php', {pass: document.getElementById('pass').value, job: 'starteditor'});
	$('#saying').load ('editorsaying.php', {pass: document.getElementById('pass').value, page: window.location.pathname, job: 'starteditor'} , function() {
		document.getElementById('maincontenteditor').style.display='none';																																				   });																																	
}

function shownewseditor()
{
	$('#maincontent').load ('editornews.php', {pass: document.getElementById('pass').value, page: window.location.pathname, job: 'starteditor'} , function() {
			document.getElementById('maincontenteditor').style.display='none';																																							    });																																	
	
}

function showeditor()
{
	if (window.location.pathname=='/' || window.location.pathname=='/index.php' ) 
	{
		$('#metatageditorcontainer').load ('editor.php', {pass: document.getElementById('pass').value, page: window.location.pathname, job: 'starteditor'} );						
		
		$('#upcomingauctions').load ('editorauctiondates.php', {pass: document.getElementById('pass').value, job: 'starteditor'});
	    $('#saying').load ('editorsaying.php', {pass: document.getElementById('pass').value, page: window.location.pathname, job: 'starteditor'} , function() {
		document.getElementById('maincontenteditor').style.display='none';																																				     });			
	}
	else
	{
		$('#maincontent').load ('editor.php', {pass: document.getElementById('pass').value, page: window.location.pathname, job: 'starteditor'} , function() {
			document.getElementById('maincontenteditor').style.display='none';																																							          });																																	
	}
}
