function redirectToTheme(){
	link = document.getElementById('selectedTheme').value;
	if( link != 0 && link != 1 ){
		document.location.href = link;
	}
}

function Is(){
	var agent = navigator.userAgent.toLowerCase();
	this.major = parseInt(navigator.appVersion);
	this.minor = parseFloat(navigator.appVersion);
	this.op = (agent.indexOf('opera') != -1);
	this.ns = ((agent.indexOf('mozilla') != -1) && ((agent.indexOf('spoofer') == -1) && (agent.indexOf('compatible') == -1)));
	this.ns2 = (this.ns && (this.major == 2));
	this.ns3 = (this.ns && (this.major == 3));
	this.ns4b = (this.ns && (this.major < 4.04));
	this.ns4 = (this.ns && (this.major >= 4));
	this.ns6 = (this.ns && (this.major >= 5));
	this.ie = (agent.indexOf('msie') != -1 && (!this.op));
	this.ie3 = (this.ie && (this.major == 2));
	this.ie4 = (this.ie && (this.major >= 4));
	this.win = (agent.indexOf('win') != -1);
	this.mac = (agent.indexOf('mac') != -1);
	this.unix = (agent.indexOf('unix') != -1);
}

var is = new Is();

function openfull (URL, name, x, y) {
	if (x==''){
		x=600;
	}
	if(x==''){
		x=550;
	}
	w=window.open(URL,name,'toolbar=no,status=no,scrollbars=yes,resizable,location=no,menubar=no,directories=no,width='+x+',height='+y)
	w.focus();
}

function openfull_nos(URL,name,x,y){
	if(x==''){
		x=600;
	}
	if(x==''){
		x=550;
	}
	w=window.open(URL,name,'toolbar=no,status=no,scrollbars=no,resizable,location=no,menubar=no,directories=no,width='+x+',height='+y)
	w.focus();
}

function confirm_slett(tittel,url){
	var Message=tittel+'?';
	if(confirm(Message)==true){
		location.href=url;
	}
}

function quick_login_submit( alerttext ){
	loginform = document.getElementById('quick_login_form');

	if(  document.getElementById('quick_login_form').username.value == "" || document.getElementById('quick_login_form').password.value == ""  ){
		alert( alerttext );
	}
	else{
		loginform.submit();
	}
}

var expanded_menu = -1;

function altermenu(menu){
	if(expanded_menu != menu){
		hidemenu();
		submenu = document.getElementById('menu_sub_'+menu);
		mainmenu = document.getElementById('menu_main_'+menu);
		submenu.style.visibility = 'visible';
		mainmenu.style.zIndex = '10';
		expanded_menu = menu;
	}
}

function hidemenu(){
	if(expanded_menu != -1){
		submenu = document.getElementById('menu_sub_'+expanded_menu);
		mainmenu = document.getElementById('menu_main_'+expanded_menu);
		submenu.style.visibility = 'hidden';
		mainmenu.style.zIndex = '1';
		expanded_menu = -1;
	}
}

function showhidemenu(menu){
	submenu = document.getElementById('menu_sub_'+menu);
	mainmenu = document.getElementById('menu_main_'+menu);
	if(submenu.style.visibility == 'hidden'){
		submenu.style.visibility = 'visible';
		mainmenu.style.zIndex = '10';
		expanded_menu = menu;
	}
	else{
		submenu.style.visibility = 'hidden';
		mainmenu.style.zIndex = '0';
		expanded_menu = -1;
	}
}

var oldcolor = '#ffffff';
var oldtextcolor = '#000000';

function set_menu_color(mainmenu,submenu){
	newcolorobj = document.getElementById('menu_subback_'+mainmenu+'_0');
	oldcolorobj = document.getElementById('menu_subback_'+mainmenu+'_'+submenu);
	oldcolor = oldcolorobj.style.backgroundColor;
	oldcolorobj.style.backgroundColor = newcolorobj.style.backgroundColor;
	newtextobj = document.getElementById('menu_text_'+mainmenu+'_0');
	oldtextobj = document.getElementById('menu_text_'+mainmenu+'_'+submenu);
	oldtextcolor =  oldtextobj.style.color;
	oldtextobj.style.color = newtextobj.style.color;
}

function unset_menu_color(mainmenu,submenu){
	colorobj = document.getElementById('menu_subback_'+mainmenu+'_'+submenu);
	oldcolorobj.style.backgroundColor = oldcolor;
	textobj = document.getElementById('menu_text_'+mainmenu+'_'+submenu);
	textobj.style.color = oldtextcolor;
}
//menu_image_$mainmenu"."_$submenu


function changeNameLogin(form) {
        var name = form.username.value;
        var userName = document.getElementById('usernameInput');
        if(name == "e-post") {
                userName.value = "";
        } else if (name == "") {
                userName.value = "e-post";
        }
}
function HideContent2(d) {
	if(d.length < 1){
		return; 
	}
	var menuStyle=document.getElementById(d).style;
	menuStyle.display='none';

}
function ShowContent2(d){
	if(d.length < 1) { 
		return; 
	}
	document.getElementById(d).style.display = "block";
}
function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
else { document.getElementById(d).style.display = "none"; }
}

function set_focus(form, field) {
	var f = 'document.' + form + '.' + field + "." + 'focus()';
	eval(f);
}

/*
function validate_session() {
	if (window.XMLHttpRequest) {
		XMLHttp = new XMLHttpRequest();
		browser = 'XMLHttpRequest (ie. non. IE)';
   } else if (window.ActiveXObject) {
		XMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
		browser = 'ActiveXObject (IE)';
   }
   alert(browser);
   XMLHttp.open('get', 'eurofoto-lib/listalbum.php')
   XMLHttp.onreadystatechange = handlerFunction;
   XMLHttp.send(null);
}

function handlerFunction() {
	if (XMLHttp.readyState == 4) {
		window.alert('Returned data: ' + XMLHttp.responseText);
	}
}
*/
