
if (document.layers) 
	{navigator.family = "nn4"}
if (document.all) 
	{navigator.family = "ie4"}
if (window.navigator.userAgent.toLowerCase().match("gecko"))
	{navigator.family = "gecko"}

overdiv="0";

function confirmClick(theLink, confirmMsg){
	
	if (typeof(window.opera) != 'undefined') {
        return true;
    }
	
    var is_confirmed = 
		confirm(confirmMsg);
	
    if (is_confirmed) {
        theLink.href += '&confirmed=1';
    }

    return is_confirmed;
}

function OpenPopup(link, dimensions)
{
	var popupURL = link;
	var popupDIM = dimensions;
	var popup = window.open(popupURL,"popupwindow",popupDIM);

	if( navigator.appName.substring(0,8) == "Netscape" ) 
	{
		popup.location = popupURL;
	}
}

function OpenNamedPopup(link,name,dimensions)
{
	var popupURL = link;
	var popupDIM = dimensions;
	var popupNAME = name;
	var popup = window.open(popupURL,popupNAME,popupDIM);

	if( navigator.appName.substring(0,8) == "Netscape" )
	{
		popup.location = popupURL;
	}
}

function ClosePopup()
{
	popup.window.close();
}


// Function for showing elements on certain operations
var tmp=null;
function show(elem){
	if(tmp)hide(tmp);
	with(document.getElementById(elem).style)display="block";
	tmp=elem;
}
function hide(elem){
	with(document.getElementById(elem).style)display="none";
}

// Function for story navigation
var tmp_tab=null;
function show_tab(elem){
	if(tmp)hide(tmp);
	if(tmp_tab)hide_tab(tmp_tab);
	with(document.getElementById(elem).style)display="block";
	tmp_tab=elem;
}
function hide_tab(elem){
	with(document.getElementById(elem).style)display="none";
}

 function entryTypeSubmit()
{
  if (document.file_post_form.title) {
    if (confirm('Changing entry type now may cause data lost on some fields!\n Are you sure you want to continue?')) {
      document.file_post_form.show.value='1';
      document.file_post_form.submit();
    } else {
      for (var i = 0; i < document.file_post_form.entry_type.length; i++){
      	if (document.file_post_form.entry_type[i].defaultSelected){
      	  document.file_post_form.entry_type.selectedIndex=i;
      	}
      }
    }
  } else {
    document.file_post_form.show.value='1';
    document.file_post_form.submit();
  }
}
