function fielderror(fieldname, fieldvalue, message)
{
 if (fieldname.value == fieldvalue)
 {
    alert(message);
    fieldname.focus();
    return true;
 }


}


function breturn(address)
{
 document.location.href=address;
}






function cancel(str)
{
//alert(str);
//alert('http://chicagodiocese.org/admin/editor.php');
parent.frames['middle'].location.href = str;
}




function prompt_confirm(txt)
{
input_box=confirm("Are you sure that you want to delete this "+txt+"?");
if (input_box==true)
{
return 1;
}
else
{
return 0;
}

}

function prompt_backup_load()
{
input_box=confirm("Loading this backup file will overwrite your existing website.  Are you sure that you want to continue?");
if (input_box==true)
{
return 1;
}
else
{
return 0;
}

}


function submit_window(form_name)
{
var w = 0, h = 0;

if (document.all) {
   /* the following is only available after onLoad */
   w = document.body.clientWidth;
   h = document.body.clientHeight;
}
else if (document.layers) {
   w = window.innerWidth;
   h = window.innerHeight;
}

var popW = 700, popH = 300;

var leftPos = (w-popW)/2, topPos = (h-popH)/2;

  _submit_window = window.open('','_submit_window','width='+popW+',height='+popH+',top='+topPos+',left='+leftPos+',scrollbars=yes,resizable=yes,location=no');
 form_name.submit();
}

function process_window(address)
{
var w = 0, h = 0;

if (document.all) {
   /* the following is only available after onLoad */
   w = document.body.clientWidth;
   h = document.body.clientHeight;
}
else if (document.layers) {
   w = window.innerWidth;
   h = window.innerHeight;
}

var popW = 300, popH = 200;

var leftPos = (w-popW)/2, topPos = (h-popH)/2;

  _process_window = window.open(address,'_process_window','width='+popW+',height='+popH+',top='+topPos+',left='+leftPos+',scrollbars=no,resizable=yes,location=yes');
}

function preview_window(address)
{
var w = 0, h = 0;

if (document.all) {
   /* the following is only available after onLoad */
   w = document.body.clientWidth;
   h = document.body.clientHeight;
}
else if (document.layers) {
   w = window.innerWidth;
   h = window.innerHeight;
}

var popW = 800, popH = 550;

var leftPos = (w-popW)/2, topPos = (h-popH)/2;

  _preview_window = window.open(address,'_preview_window','width='+popW+',height='+popH+',top='+topPos+',left='+leftPos+',scrollbars=yes,resizable=yes,location=yes');
}

function preview_site(address)
{
var w = 0, h = 0;

if (document.all) {
   /* the following is only available after onLoad */
   w = document.body.clientWidth;
   h = document.body.clientHeight;
}
else if (document.layers) {
   w = window.innerWidth;
   h = window.innerHeight;
}

var popW = 800, popH = 550;

var leftPos = (w-popW)/2, topPos = (h-popH)/2;

  _preview_site = window.open(address,'_preview_window','width='+popW+',height='+popH+',top='+topPos+',left='+leftPos+',status=yes,menubar=yes,toolbar=yes,scrollbars=yes,resizable=yes,location=yes');
}

function bulletin_attach_window(address)
{
var w = 0, h = 0;

if (document.all) {
   /* the following is only available after onLoad */
   w = document.body.clientWidth;
   h = document.body.clientHeight;
}
else if (document.layers) {
   w = window.innerWidth;
   h = window.innerHeight;
}

var popW = 700, popH = 300;

var leftPos = (w-popW)/2, topPos = (h-popH)/2;

  _bulletin_attach_window = window.open(address,'_bulletin_attach_window','width='+popW+',height='+popH+',top='+topPos+',left='+leftPos+',scrollbars=yes,resizable=yes,location=no');
}


function open_manual(address)
{
var w = 0, h = 0;

if (document.all) {
   /* the following is only available after onLoad */
   w = document.body.clientWidth;
   h = document.body.clientHeight;
}
else if (document.layers) {
   w = window.innerWidth;
   h = window.innerHeight;
}

var popW = 800, popH = 600;

var leftPos = (w-popW)/2, topPos = (h-popH)/2;

  _manual = window.open(address,'_manual','width='+popW+',height='+popH+',top='+topPos+',left='+leftPos+',status=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,location=no');
}

function editor_window(form_name, str)
{
var w = 0, h = 0;

if (document.all) {
   /* the following is only available after onLoad */
   w = document.body.clientWidth;
   h = document.body.clientHeight;
}
else if (document.layers) {
   w = window.innerWidth;
   h = window.innerHeight;
}

var popW = 800, popH = 600;

var leftPos = (w-popW)/2, topPos = (h-popH)/2;

str2 = str;
//alert(str2);

 str = window.open('',str2,'width='+popW+',height='+popH+',top='+topPos+',left='+leftPos+',scrollbars=yes,resizable=yes,location=yes,status=yes,menubar=yes');
 form_name.submit();
}

function view_article(id)
{
  open_article('/article.php?id='+id);
}



function open_article(address)
{
var w = 0, h = 0;

if (document.all) {
   /* the following is only available after onLoad */
   w = document.body.clientWidth;
   h = document.body.clientHeight;
}
else if (document.layers) {
   w = window.innerWidth;
   h = window.innerHeight;
}

var popW = 700, popH = 640;

var leftPos = (w-popW)/2, topPos = (h-popH)/2;

  _article = window.open(address,'_article_window','width='+popW+',height='+popH+',top='+topPos+',left='+leftPos+',status=yes,menubar=yes,toolbar=yes,scrollbars=yes,resizable=yes,location=no');
}


function openWin(img, popW, popH) {

var w = 0, h = 0;


if (document.all) {
   /* the following is only available after onLoad */
   w = document.body.clientWidth;
   h = document.body.clientHeight;
}
else if (document.layers) {
   w = window.innerWidth;
   h = window.innerHeight;
}

popW = parseInt(popW) + 25;
popH = parseInt(popH) + 25;


var leftPos = (w-popW)/2, topPos = (h-popH)/2;

  winId = window.open('','newwin','width='+popW+',height='+popH+',top='+topPos+',left='+leftPos+',scrollbars=yes,resizable=yes');
  if (winId)
  {
    winId.innerWidth = popW;
    winId.innerHeight = popH;
 //   winId.resizeTo(popW, popH);
  }
//  winId = window.open('','newwin','width='+w+',height='+h+'top='+topPos+',left='+leftPos+');
  winId.document.write('<body topmargin="0" leftmargin="0" bottommargin="0" rightmargin="0" marginwidth="0" marginheight="0" onLoad="if (window.focus) window.focus()"><center>');
  winId.document.write('<a href="#" onclick="window.close(); return false"><img border="0" src="' + img + '"></a>');
  winId.document.write('</center></body>');
  winId.document.close();
}

function preview_title_font(fontname, text, shadow)
{
preview_template_font('/admin/font_preview.php?fontname='+fontname);

}


function preview_template_font(address)
{
var w = 0, h = 0;

if (document.all) {
   /* the following is only available after onLoad */
   w = document.body.clientWidth;
   h = document.body.clientHeight;
}
else if (document.layers) {
   w = window.innerWidth;
   h = window.innerHeight;
}

var popW = 450, popH = 200;

var leftPos = (w-popW)/2, topPos = (h-popH)/2;

  _preview_template_font_window = window.open(address,'_preview_template_font_window','width='+popW+',height='+popH+',top='+topPos+',left='+leftPos+',scrollbars=no,resizable=no,location=no');
}


function calendar_window(form_name)
{
var w = 0, h = 0;

if (document.all) {
   /* the following is only available after onLoad */
   w = document.body.clientWidth;
   h = document.body.clientHeight;
}
else if (document.layers) {
   w = window.innerWidth;
   h = window.innerHeight;
}

var popW = 800, popH = (screen.availHeight - 150);

var leftPos = (w-popW)/2, topPos = (h-popH)/2;

  _month_edit = window.open('','_month_edit','width='+popW+',height='+popH+',top='+topPos+',left='+leftPos+',location=yes,toolbar=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,location=no');
 form_name.submit();
}


function printing_instructions_window(address)
{
var w = 0, h = 0;

if (document.all) {
   /* the following is only available after onLoad */
   w = document.body.clientWidth;
   h = document.body.clientHeight;
}
else if (document.layers) {
   w = window.innerWidth;
   h = window.innerHeight;
}

var popW = 400, popH = 300;

var leftPos = (w-popW)/2, topPos = (h-popH)/2;

  _printing_instructions_window = window.open(address,'_printing_instructions_window','width='+popW+',height='+popH+',top='+topPos+',left='+leftPos+',scrollbars=no,resizable=yes,location=no');
}


function slideshow_window(address)
{
var w = 0, h = 0;

if (document.all) {
   /* the following is only available after onLoad */
   w = document.body.clientWidth;
   h = document.body.clientHeight;
}
else if (document.layers) {
   w = window.innerWidth;
   h = window.innerHeight;
}

var popW = 600, popH = 500;

var leftPos = (w-popW)/2, topPos = (h-popH)/2;

  _slideshow_window = window.open(address,'_bulletin_attach_window','width='+popW+',height='+popH+',top='+topPos+',left='+leftPos+',scrollbars=yes,resizable=yes,location=yes');
}



function open_receipt(address)
{
var w = 0, h = 0;

if (document.all) {
   /* the following is only available after onLoad */
   w = document.body.clientWidth;
   h = document.body.clientHeight;
}
else if (document.layers) {
   w = window.innerWidth;
   h = window.innerHeight;
}

var popW = 800, popH = 600;

var leftPos = (w-popW)/2, topPos = (h-popH)/2;

  _receipt = window.open(address,'_receipt','width='+popW+',height='+popH+',top='+topPos+',left='+leftPos+',status=yes,menubar=yes,toolbar=yes,scrollbars=yes,resizable=yes,location=no');
}

