glTermsOfUseDialogWindow=null;
function openTermsOfUse(file, title) {
	if(file==null)
		file='/terms.html';
	LoadingDialog.setText('Loading...');
	LoadingDialog.show();
	new Ajax.Request(file, {
		onComplete: function(response) {loadTermsOfUse(response.responseText, title);}
	});
}
function loadTermsOfUse(loadedText, title) {
	if(title==null)
		title='Terms of Use';
	LoadingDialog.hide();
	if(glTermsOfUseDialogWindow!=null)
		glTermsOfUseDialogWindow.destroy();
	glTermsOfUseDialogWindow = DialogManager.createDialog({
		withTitle: false, dialogWidth: "700px"
	});
	var div = Builder.node('div'), html = '';
	html+='<p class="loginTitle" id="bugTitle" style="border-bottom: 0pt none; margin-top:10px;margin-bottom:10px;margin-left:0px;">'+title+'</p><div class="termsData">'+loadedText+'</div>';
	html+='<div style="text-align:right;margin-right:10px;"><input type="submit" onclick="if(glTermsOfUseDialogWindow!=null) glTermsOfUseDialogWindow.destroy(); return false;" value="Close" style="color:red;" class="submit"/></div>';
	div.innerHTML = html;
	glTermsOfUseDialogWindow.setChild(div);
	glTermsOfUseDialogWindow.show();
	DialogManager.updateOverlay();
}

/**
 * Show/hide block
 */
sw_block = function(active) {
	el = $(active).up(1).next();
	if($(active).hasClassName('maximize')) {
		$(active).removeClassName('maximize');
		new Effect.BlindDown(el);
		saveBlockCondition(active.up(5).id, 1);
	} else {
		$(active).addClassName('maximize');
		new Effect.BlindUp(el);
		saveBlockCondition(active.up(5).id, 0);
	}
	return;
}

/**
 * Disabling standard applications
 */
function disableStandardApplication(sAppId, elementId, place) {
	if (!confirm('Are you sure?')) {
		return;
	}
	new Effect.Fade(elementId);
	new Ajax.Request(disableStandardApplication_url, {
		parameters: { sAppId: sAppId, activate: 0, place: place }
	});
}
