/*function blockUI()
{
	$jquery.blockUI();
}*/
function displayEntryEditor(id)	{
	$jquery("#EntryBody" + id).fadeOut(500);
	//$jquery("#BlogEntryLoading" +id).fadeIn(500);
	$jquery("#EntryBody" + id).html("");
	$jquery("#EntryBody" +id).load("/gospot/ajax.admin.EditBlogEntry/ContentId/" + id);	
	//$jquery("#BlogEntryLoading" +id).fadeOut(500);	
	$jquery("#EntryBody" + id).fadeIn(500);
}
function cancelEntryEdit(id)	{
	if (!id){
		$jquery("#EntryBody" + id).load("/gospot/ajax.admin.NewBlogEntry");	
	}
	else {
		document.location.href='/gospot/admin.BlogEntries';		
	}
}
function cancelPageEdit(id)	{
	if (!id){
		$jquery("#EntryBody" + id).load("/gospot/ajax.admin.NewBlogEntry");	
	}
	else {
		document.location.href='/gospot/admin.Pages';		
	}
}
function loadInviteForm(id){
	$jquery('#'+id).load('/gospot/ajax.inviteform/'+Math.random());
}

function inviteSent(id)	{
	loadInviteForm(id);
	setTimeout("$jquery('#"+id+"').prepend('<div style=\"font-weight:bold;text-align:center;\">Your invitations have been sent!</div>');",1000);
}
$jquery(document).ready(function() {
     $jquery("a[@id*=editEntry]").click(function(){
		displayEntryEditor(this.name);
   		return false;
	});
    return false;
});
function deleteContent(ContentId)	{
	if (confirm("Are you sure you want to permanently delete this item?"))	{
		$jquery("#ContentRow"+ContentId).hide();
		$jquery("#Response").load("/gospot/ajax.admin.DeleteContent/ContentId/"+ContentId);	
		$jquery("#Response").show();
		setTimeout("$jquery('#Response').fadeOut(500)",2000);
	}
}
function editCategory(id)	{
	$jquery("#CategoryLabelDiv"+id).hide();
	$jquery("#CategoryActionIcons"+id).hide();
	$jquery("#CategoryInputDiv"+id).show();
	$jquery("#CategoryEditIcons"+id).show();
}
function endCategoryEdit(id)	{
	$jquery("#CategoryLabelDiv"+id).show();
	$jquery("#CategoryActionIcons"+id).show();
	$jquery("#CategoryInputDiv"+id).hide();
	$jquery("#CategoryEditIcons"+id).hide();
}
function saveCategoryEdit(id)	{
	$jquery.ajax({
   		type: "POST",
   		url: "/gospot/ajax.admin.UpdateCategory",
   		data: "CategoryId="+id+"&Label="+$jquery("#CategoryLabelInput"+id).get(0).value,
   		success: function(msg){
     		$jquery("#CategoryLabelInput"+id).get(0).value=msg;
     		$jquery("#Label"+id).html(msg);
     		$jquery("#HiddenLabel"+id).html(msg);
     		endCategoryEdit(id);
   		}
 	});	
}
function deleteCategory(id){	
	if (confirm("Are you sure you want to permanently delete this item?")) {
		$jquery.ajax({
			type: "POST",
			url: "/gospot/ajax.admin.DeleteCategory",
			data: "CategoryId=" + id,
			success: function(msg){
				removeCategoryListItem(id);
			}
		});
	}
}
function cancelCategoryEdit(id)	{
	endCategoryEdit(id);
}
function removeCategoryListItem(id)	{
	$jquery("#CategoryRow"+id).hide();
}
function checkInvite(callbackId,Form){
	$jquery("#"+callbackId).load('/gospot/ajax.mainsite.checkInvite/invitecode/'+Form.InviteCode.value);
	$jquery("#"+callbackId).fadeIn(500);
	$jquery("#subContent").corner("round");
	return false;
}	
function startEmailCheck(){ try { clearTimeout(TimerId);}  catch (excpt){ } TimerId = setTimeout("checkEmail()",1000); }
function startDomainCheck() { try { clearTimeout(TimerId2);}  catch (excpt){ } TimerId2 = setTimeout("checkDomain()",1000);  } 
function checkEmail(){  try {  var email = document.getElementById('frmRegisterId').Email.value; document.getElementById('registerButton').style.display='none';  if (email.length){ $jquery('#RegisterEmailResult').load('/gospot/ajax.CheckEmail/email/'+email); setTimeout("showButton()",100); } } catch (excpt) {/*nada*/ } } 
function checkDomain(){  try {  var domain = document.getElementById('frmRegisterId').Domain.value; document.getElementById('registerButton').style.display='none';  if (domain.length){ $jquery('#RegisterDomainResult').load('/gospot/ajax.CheckDomain/headervalue/'+domain); setTimeout("showButton()",100); } } catch (excpt) {/*nada*/ } }
function showButton(){ var length = document.getElementById('RegisterEmailResult').innerHTML.length + document.getElementById('RegisterPasswordResult').innerHTML.length + document.getElementById('RegisterDomainResult').innerHTML.length;  if (document.getElementById('frmRegisterId').TOS.checked && !length){ document.getElementById('registerButton').style.display='block';}  else { document.getElementById('registerButton').style.display='none';document.getElementById('registerButton').style.display='none'; } }
function checkPassword(){  if (document.getElementById('frmRegisterId').Password.value != document.getElementById('frmRegisterId').RepeatPassword.value) { document.getElementById('RegisterPasswordResult').innerHTML	= 'Passwords must match'; return false; }  else{ document.getElementById('RegisterPasswordResult').innerHTML='';return true; } }
function swapForms(hideId,showId){ $jquery('#'+hideId).fadeOut(500);$jquery('#'+showId).fadeIn(500);}
function submitForm(){if (checkPassword()) {swapForms('registrationForm','registrationSent');doRegister(document.getElementById('frmRegisterId'));}}
function doRegister(){
    var options = { 
    	target: "#subContent",
        success: showRegisterResponse  // post-submit callback 
    };  
    $jquery("#frmRegisterId").ajaxForm(options);
	$jquery("#frmRegisterId").submit(); 	
}
function showRegisterResponse(responseText){
	$jquery("#subContent").html(responseText);
}
function biggieSize(){
	$jquery('#content').width('1200px');
	$jquery("#Content___Frame").height('800px');
	$jquery('#ZoomIn').hide();$jquery('#ZoomOut').show();
}
function enSmallinate(){
	$jquery('#content').width('860px');
	$jquery("#Content___Frame").height('300px');
	$jquery('#ZoomIn').show();$jquery('#ZoomOut').hide();
}
function blockUI()
{
	$jquery.blockUI({ message: '<div style="padding:25px;"><h1>Please Wait<br><img src="/images/loader-bar.gif" /></h1></div>' });
}