

function launchCenter(url, name, width, height) 
{
  var str = "scrollbars=yes, height=" + height + ",innerHeight=" + height;
  str += ",width=" + width + ",innerWidth=" + width;
  if (window.screen) {
    var ah = screen.availHeight - 30;
    var aw = screen.availWidth - 10;

    var xc = (aw - width) / 2;
    var yc = (ah - height) / 2;

    str += ",left=" + xc + ",screenX=" + xc;
    str += ",top=" + yc + ",screenY=" + yc;
  }
  return window.open(url, name, str);
}


function toggleDivVisibility(divItemName) {	
	if( document.getElementById(divItemName).style.display == '' ) {
		document.getElementById(divItemName).style.display='none';
	} else {
		document.getElementById(divItemName).style.display='';
	}
}

function setDivVisibility(divItemName, visible) {	
	if( visible ) {
		document.getElementById(divItemName).style.display='';
	} else {
		document.getElementById(divItemName).style.display='none';
	}
}

function showLogoDivs(logo_count)
{
	for(i=1;i<=logo_count;i++) {
		document.getElementById('logoDiv'+i).style.display='';
	}
	logo_count++;
	for(i=logo_count;i<=6;i++) {
		document.getElementById('logoDiv'+i).style.display='none';
	}
}
	
function preload() {
	this.length = preload.arguments.length;
	for (var i = 0; i < this.length; i++) {
	        this[i+1] = new Image();
	        this[i+1].src = preload.arguments[i];
	}
}
				

				
function switcheroo(imagename, newimage) {
    if (document.images) {
		eval("document."+imagename+".src=\""+newimage+"\";");
	}
}


function storeCaret (textEl) 
{
   if (textEl.createTextRange) 
   textEl.caretPos = document.selection.createRange().duplicate();
}

function insertAtCaret (textEl, text) 
{
	if (textEl.createTextRange && textEl.caretPos) 
	{
		var caretPos = textEl.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' 
						? text + ' ' 
						: text;
	}
	textEl.focus();
}

				 
function mySubmit() {
	document.DataForm.onsubmit();
	document.DataForm.submit();
}
				 
	    
function showFieldBlock( item_name, count, max_count )
{
	for(i=1; i<=count;i++)
	{
		document.getElementById("item_name+i").style.display='';
	}
	for(i=count+1; i<=max_count;i++)
	{
		document.getElementById("item_name+i").style.display='none'; 
	}
}
					 


if (document.images) {
    var stuff = new preload(
                        "grafix/tabimages/tabs_user_over.gif"
						,"grafix/tabimages/tabs_forum_over.gif"
                       ,"grafix/tabimages/tabs_edit_over.gif")
}


var focus_set = 0; // Communicates with the ShowEditForm() function

function trySetFocus() 
{
  if ( !document.forms || !document.forms[0] || !document.forms[0].elements )
    {
      return;
    }

  if ( focus_set ) return;

  for ( i = 0 ; i < document.forms[0].elements.length ; i++ ) 
    {
      var el = document.forms[0].elements[i];
      if ( el.type && el.type != 'hidden' && ! el.disabled )
        {
          el.focus();
          return; 
        }
    }
}
/*
function mySubmit() {
	document.DataForm.onsubmit();
	document.DataForm.submit();
}
*/