
// built by Little Warsaw
// 2006 copyright
// www.littlewarsaw.com
// author info@littlewarsaw.com


// declarations

var SiteIsReady = 0;

var activeMenu = "";
var selectMenu = false;

var myLayer;
var origiLayer = "";
var origiImageName = "";
var origiImageSrc = "";
var origiParentLayer = "";
var sopLayerArray = new Array();
var sopTimer;
var extraTimer;
var origiExtraLayer = "";


// general initial functions

function initPage() {
    SiteIsReady = 1;
}

function initContent() {
    if ( window.top && window.top.initPage ) {
	window.top.initPage();
    }
    initPage();
    setBackground();
}

function setBackground() {
    if ( !document.layers ) {
	var displayWidth = screen.width;
	var displayBckImg = "img/" + displayWidth + "_bck.gif";
	if ( typeof( document.body.style.setExpression ) != "undefined" ) {
	    document.body.style.setExpression("backgroundImage","'url(" + displayBckImg + ")'");
	} else if ( typeof( document.body.style.background) != "undefined" ) {
	    document.body.style.background = "url(" + displayBckImg + ")";
	    document.body.style.backgroundAttachment = "fixed";
	}
    }
}

// functions for navigation

function openLayerMenu( layerName ) {

    setLayerStatus( layerName, "visible", "main" );

}

function closeLayerMenu( layerName ) {
    
    setLayerStatus( layerName, "hidden", "main" );

}

function clickMenu( menuName ) {

    // close it
    if ( menuName == activeMenu ) {

	closeLayerMenu( menuName );

	setImageOff( menuName );

	activeMenu = "";
	selectMenu = false;

    // open it
    } else {

	selectMenu = true;

	if ( activeMenu != "" )
	    setImageOff( activeMenu );

	setImageDown( menuName );
	
	window.top.frames["main"].scrollTo(0,0);

	openLayerMenu( menuName );
	
	activeMenu = menuName;

    }

}

function clickSimpleMenu( menuName ) {

    switch( menuName ) {
	case "hu_menu_4":
		setImageDown( menuName ); 
	    window.top.frames["main"].document.location.href = "forum/index.php";
	    break;
	case "hu_menu_5": 
		setImageDown( menuName );
	    window.top.frames["main"].document.location.href = "hu_informacio.html";
	    break;
		case "en_menu_4":
		setImageDown( menuName ); 
	    window.top.frames["main"].document.location.href = "forum/en_index.php";
	    break;
	case "en_menu_5": 
		setImageDown( menuName );
	    window.top.frames["main"].document.location.href = "en_information.html";
	    break;
	default:
	    break;
    }

}

function navigateContent( parentMenu, menuName ) {

    window.top.frames["menu"].clickMenu( parentMenu );

    switch( menuName ) {
	case "hu_menu_11":
	    window.top.frames["main"].document.location.href = "hu_eletrajz.html#eletrajz";
	    break;
	case "hu_menu_12":
	    window.top.frames["main"].document.location.href = "hu_eletrajz.html#dokumentumok";
	    break;
	case "hu_menu_21":
	    window.top.frames["main"].document.location.href = "#";
	    break;
	case "hu_menu_22":
	    window.top.frames["main"].document.location.href = "hu_idorend.html#idorend";
	    break;
	case "hu_menu_23":
	    window.top.frames["main"].document.location.href = "hu_nefertiti_teste.html";
	    break;
	case "hu_menu_24":
	    window.top.frames["main"].document.location.href = "hu_idorend.html#fuggelek";
	    break;
	case "hu_menu_31":
	    window.top.frames["main"].document.location.href = "hu_divatcsarnok.html#monitor";
	    break;
	case "hu_menu_32":
	    window.top.frames["main"].document.location.href = "hu_divatcsarnok.html#arckepcsarnok";
	    break;
		
		case "en_menu_11":
	    window.top.frames["main"].document.location.href = "en_biography.html#biography";
	    break;
	case "en_menu_12":
	    window.top.frames["main"].document.location.href = "en_biography.html#documents";
	    break;
	case "en_menu_21":
	    window.top.frames["main"].document.location.href = "en_chronology.html#chronology";
	    break;
	case "en_menu_22":
	    window.top.frames["main"].document.location.href = "en_the_body_of_nefertiti.html";
	    break;
	case "en_menu_23":
	    window.top.frames["main"].document.location.href = "en_chronology.html#appendix";
	    break;
	case "en_menu_31":
	    window.top.frames["main"].document.location.href = "en_events.html#monitor";
	    break;
	case "en_menu_32":
	    window.top.frames["main"].document.location.href = "en_events.html#portraitgallery";
	    break;
		
	
	default:
	    break;
    }

}

function overMenu( menuName ) {

    if ( selectMenu ) {
    
	if ( menuName != activeMenu ) {
	    clickMenu( activeMenu );
	    clickMenu( menuName );
	} else
	    setImageDown( menuName );
    
    } else {
	setImageOn( menuName );
    }

}

function overSimpleMenu( menuName ) {

    if ( selectMenu ) {
    
	if ( menuName != activeMenu ) {
	    clickMenu( activeMenu );
	    setImageOn( menuName );
	}
    
    } else {
	setImageOn( menuName );
    }

}

function outMenu( menuName ) {

    if ( !selectMenu ) {
	setImageOff( menuName );
    }

}

function outSimpleMenu( menuName ) {

    setImageOff( menuName );

}

function downSimpleMenu( menuName ) {

    setImageDown( menuName );

}

function imageChanger( layerName, imageName ) {
				setImageSrc( layerName, imageName, 'img/menu/' + imageName + '-on.gif' );
								
}

function imageRestore( layerName, imageName ) {
    setImageSrc( layerName, imageName, 'img/menu/' + imageName + '-off.gif' );
}

// base funtions

function setImageOn( imageName ) {
    			if ( SiteIsReady == 1 ) {
				document.images[imageName].src = "img/menu/" + imageName + "-on.gif";
	}
}

function setImageOff( imageName ) {
    			if ( SiteIsReady == 1 ) {
				document.images[imageName].src = "img/menu/" + imageName + "-off.gif";
	}
}

function setImageDown( imageName ) {
  				 if ( SiteIsReady == 1 ) {
        		 document.images[imageName].src = "img/menu/" + imageName + "-down.gif";
    }
}

function setLayerStatus( layerName, layerStatus, frameName ) {
    if ( SiteIsReady == 1 ) {
	if ( ( frameName != null ) && ( frameName != "" ) )
	    fr = window.top.frames[frameName].document;
	else
	    fr = window.document;

	if ( document.layers && fr.layers[layerName] ) {
	    if ( layerStatus == "visible" )
		layerStatus = "show";
	    else
		layerStatus = "hide";
	    fr.layers[layerName].visibility = layerStatus ;
	} else if ( document.all && fr.all[layerName] ) {
	    fr.all[layerName].style.visibility = layerStatus;
	} else if ( document.getElementById && fr.getElementById(layerName) ) {
	    fr.getElementById(layerName).style.visibility = layerStatus;
	}
    }
}

function setImageSrc( parentLayer, imageName, imageSrc ) {
    if ( SiteIsReady == 1 ) {
	if ( document.layers && parentLayer != "" ) {
	    if ( ( document.layers[parentLayer] ) && ( document.layers[parentLayer].document.images[imageName] ) ) {
		document.layers[parentLayer].document.images[imageName].src = imageSrc;
	    }
	} else if ( document.images[imageName] ) {
	    document.images[imageName].src = imageSrc;
	}
    }
}

function popup( pic, name, w, h ) {
			Popup = window.open("","Popup", "width=" + w + ",height=" + h + ",left=10,top=10,scrollbars=0,toolbar=0,menubar=0,status=0,directories=0,resizable=0" );
			Popup.document.write("<html><head><title>  Little Warsaw</title></head><body topmargin=0 leftmargin=0 marginwidth=0 marginheight=0><img src=\"img/" + pic + "\"><br><img src=\"img/spacer.gif\" height=5,width=5><br>" + name + "</body></html>");
			Popup.focus();
}

