var IE4 = (document.all && !document.getElementById) ? true : false;
var IE5 = (document.all &&  document.getElementById && document.documentElement && !document.namespaces && ((document.designMode+"") != "undefined")) ? true : false;
var IE6 = (document.all &&  document.getElementById && document.documentElement && document.namespaces && ((document.designMode+"") != "undefined")) ? true : false;
var NS4 = (document.layers) ? true : false;
var NS6 = (document.getElementById && !document.all && document.documentElement) ? true : false;
var OP5 = (document.getElementById && !document.documentElement) ? true : false;
var OP7 = (document.all &&  document.getElementById && document.documentElement && ((document.designMode+"") == "undefined")) ? true : false;
var OP5pure = (document.getElementById && !document.all && !document.documentElement) ? true : false;
var KDE = (navigator.vendor == "KDE") ? true : false;

if(NS4){
	var tm_winWidth  = window.innerWidth;
	var tm_winHeight = window.innerHeight;
	window.onresize = function (){
		if (window.innerWidth == tm_winWidth && window.innerHeight == tm_winHeight) return;
		window.location.reload();
	}
}


function popp_admin(index){}

function render_me(){
	if(NS4){
		for(i = 0; i < (document.layers.length - 1); i++){
			var tmp = document.layers[i].id;
			if(tmp.indexOf("sub") >= 0)document.layers[i].onmouseout = menue_deactivate;
		}
	}
	if(IE5 | IE6){
		var mnu=document.getElementById("mnu");
		for(i=0;i<mnu.childNodes.length;i++){
			var node=mnu.childNodes[i];
			if(node.nodeName=="LI"){
				node.onmouseover=function(){this.className+=" over";}
				node.onmouseout=function(){this.className=this.className.replace(" over", "");}
			}
		}
	}
}
window.onload=render_me;

var module_userprofile_stat = "toolbar=no,status=no,location=no,menubar=no,resizable=no,scrollbars,width=710,height=620,top=140,left=200";
if(NS4||NS6)module_userprofile_stat = "toolbar=no,status=no,location=no,menubar=no,resizable=no,scrollbars,width=698,height=620,top=140,left=200";
var module_userprofile_win;
function apply_on_position(stilling){
	if(module_userprofile_win)if(!module_userprofile_win.closed)module_userprofile_win.close();
	module_userprofile_win = open("/modules/userprofile/admin.asp?c=edt&pos=" + stilling, "module_userprofile", module_userprofile_stat);
	if(module_userprofile_win.focus)module_userprofile_win.focus();
}


function profile_forgot_password(){
	if(document.frmlogin.mail.value != "" && document.frmlogin.mail.value != "E-postadresse" && document.frmlogin.mail.value.indexOf("@")>0){
		var module_userprofile_url = "/modules/userprofile/admin.asp?c=fgt&mail=" + escape(document.frmlogin.mail.value);
		if(module_userprofile_win)if(!module_userprofile_win.closed)module_userprofile_win.close();
		module_userprofile_win = open(module_userprofile_url, "module_userprofile", module_userprofile_stat);
		if(module_userprofile_win.focus)module_userprofile_win.focus();
	}
	else{
		alert("Du må fylle inn en reell E-postadresse!");
		document.frmlogin.mail.focus();
	}
	return(false);
}

function profile_new(){
	if(document.frmlogin.mail.value != "" && document.frmlogin.mail.value != "E-postadresse" && document.frmlogin.mail.value.indexOf("@")>0){
		if(module_userprofile_win)if(!module_userprofile_win.closed)module_userprofile_win.close();
		module_userprofile_win = open("/modules/userprofile/admin.asp?c=reg&mail=" + escape(document.frmlogin.mail.value), "module_userprofile", module_userprofile_stat);
		if(module_userprofile_win.focus)module_userprofile_win.focus();
	}
	else{
		alert("Du må fylle inn en reell E-postadresse!");
		document.frmlogin.password.value = "";
		document.frmlogin.mail.focus();
	}
	return(false);
}

function open_profile(){
	if(module_userprofile_win)if(!module_userprofile_win.closed)module_userprofile_win.close();
	module_userprofile_win = open("/modules/userprofile/admin.asp?c=edt", "module_userprofile", module_userprofile_stat);
	return(false);
}

function validate_login(the_form){
	if(the_form.mail.value == "" || the_form.mail.value == "E-postadresse"){
		alert("Du må fylle inn E-postadresse for å logge inn på \"Min Profil\"");
		the_form.mail.focus();
		return(false);
	}
	if(the_form.password.value == "" || the_form.password.value == "Passord"){
		alert("Du må fylle inn Passord for å logge inn på \"Min Profil\"");
		the_form.password.focus();
		return(false);
	}
	return(true);
}

var share_title,share_url,share_description,share_source;
function shareFacebook() {
	var wnd=window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(share_url)+'&t='+encodeURIComponent(share_title),'sharer','toolbar=0,status=0,width=626,height=436');
	wnd.focus();
}
function shareLinkedIn() {
	var wnd=window.open('http://www.linkedin.com/shareArticle?mini=true&url='+encodeURIComponent(share_url)+'&title='+encodeURIComponent(share_title)+'&summary='+encodeURIComponent(share_description)+'&source='+encodeURIComponent(share_source),'shareArticle','scrollbars=no,width=520,height=650');
	wnd.focus();
}
function shareMySpace() {
	var wnd=window.open('http://www.myspace.com/index.cfm?fuseaction=postto&'+'t='+encodeURIComponent(share_title)+'&c='+encodeURIComponent(share_description)+'&u='+encodeURIComponent(share_url)+'&l=3','sharer','toolbar=0,status=0,width=750,height=500');
	wnd.focus();
}
function shareNettby() {
	var wnd=window.open('http://www.nettby.no/user/edit_link.php?name='+escape(share_title)+'&url='+escape(share_url)+'&description='+escape(share_description),'edit_link','scrollbars=no,width=450,height=430');
	wnd.focus();
}
