function popup(url,name,width,height,position,wplus,hplus,focus,left,top,menubar,status,toolbar,scrollbar,resizable,scrx,scry,directories,loc) {
	if ( !url ) return false;
	if ( !name ) name = 'popupWin';
	if ( !width ) width = '';
	if ( !height ) height = '';
	if ( !directories ) directories = 'no';
	if ( !loc ) loc = 'no';
	if ( !menubar ) menubar = 'no';
	if ( !status ) status = 'no';
	if ( !toolbar ) toolbar = 'no';
	if ( !scrollbar ) scrollbar = 'no';
	if ( !resizable ) resizable = 'no';
	if ( !scrx ) scrx = '100';
	if ( !scry ) scry = '100';
	if ( !left ) left = '100';
	if ( !top ) top = '100';
	if ( wplus ) width  += wplus;
	if ( hplus ) height += hplus;

	if ( position == '1' ) {
		var winleft = (screen.width - width) / 2;
		var wintop = (screen.height -  height) / 2;
	} else {
		var winleft = left;
		var wintop = top;
	}

    var popupWin = window.open(url,name,'width='+width+'px,height='+height+'px,left='+winleft+',top='+wintop+',menubar='+menubar+',status='+status+',toolbar='+toolbar+',scrollbars='+scrollbar+',resizable='+resizable+',screenX='+scrx+',screenY='+scry+'directories='+directories+',location='+loc);

	if ( focus ) popupWin.focus();
}

function copyField(from, to) {
  document.getElementById(to).value = document.getElementById(from).value;
}

function set(input) {

  input.value = '';
}

function leave(input) {

  input.value = (input.value == '') ? input.defaultValue : input.value;
}
function changeImage(img, img_src) {

  img.src = img_src;
}

function toggle( table ) {

    table_obj = document.getElementById(table);
	
	to = table_obj.style.display == 'none' ? 'block': 'none';

	table_obj.style.display = to;


}


var old_table_image = '';
var is_opened_image  = 'none';

function toggle_image( image ) {

    table_obj = document.getElementById(image);
    is_opened_image = table_obj.style.display;

	if (image != 'i01')
	{
		document.getElementById('i01').style.display = 'none';
	}

    if (old_table_image != '' && is_opened_image == 'none') {
        old_table_obj = document.getElementById(old_table_image);
        old_table_obj.style.display = 'none';
    }

    if (old_table_image != image || is_opened_image == 'none') {

        table_obj.style.display = 'block';
    }

    old_table_image = image;
}


var old_link = '';

function set_style(item) {
    item.className = 'focus';

    if( old_link != '' && old_link != item) old_link.className = '';

    old_link = item;

}

function confirmMsg (msg)
{
	var con = confirm(msg);
	if (con)
			return true ;
	else
			return false ;
}

function getObj( name ) {
	if ( typeof name == 'string' ) {
	    return document.getElementById( name );    
	} else {
	    return name;
	}
}

function getPos( name ) {

	obj = getObj( name );
	var curleft = curtop = 0;
	curleft = obj.offsetLeft;// + wsStyles.getStyle( obj, 'margin-left').toInt();
	curtop	= obj.offsetTop;// + wsStyles.getStyle( obj, 'margin-top' ).toInt();

	if ( obj.offsetParent ) {
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		}
	}

	return {left:curleft, top:curtop};
};

  function setPos() {
      var pos = getPos('data_bottom');
	  var leftDiv = getObj('left_bottom');

	  leftDiv.style.position = 'absolute';
	  leftDiv.style.top = (pos.top-100)+'px';

}
function other_text () {

	if (document.getElementById('first').style.display == 'none' && (document.getElementById('others').checked) )	{
		document.getElementById('first').style.display = 'block';
	} else {
		document.getElementById('first').style.display = 'none';
	}
}

var visibleList = 'defaultList';
function showList(character) {
    if ( visibleList != '' ) {
        document.getElementById(visibleList).style.display = 'none';
    }

    document.getElementById('wordlist_'+character).style.display = 'block';
    visibleList = 'wordlist_'+character;
}

var visibleWord = 'defaultWord';
function showItem(item) {
    if ( visibleWord != '' ) {
        document.getElementById(visibleWord).style.display = 'none';
    }

    document.getElementById(item).style.display = 'block';

    visibleWord = item;
}

