
function nordic() {
   var wNordic = open('login/annonser/nordic1.asp',"Seminarium","scrollbars=0,resizable,left=10,top=10,height=650,width=330");
}

function startVote() {
  var wVote = open('login/tavling/reminder/intro.asp' ,"Opinion","scrollbars=1,resizable,left=10,top=10,height=450,width=540");
}

function weekofuser() {
    open('weekofuser.htm' ,"medlem","scrollbars=1,resizable,left=10,top=10,height=650,width=330");
}
function visitkort (uid) { 
	var wVisit = open('http://www.dinbyggare.se/login/register/visitkort_view.asp?userid=' + uid ,"Visitkort","scrollbars=1,resizable,left=10,top=10,height=window.height-200,width=330");
 	document.isUnloading = false;
}

function nyhetsbrev () { 
	var wBrev = open('other/mail/2002/2002-12-19b.htm', "Visitkort","scrollbars=1,resizable,left=10,top=10,height=window.height-200,width=430");
 	document.isUnloading = false;
}

function openVisit (url) { 
 	var wHelp = open(url ,"Visitkort","scrollbars=1,resizable,left=10,top=10,height=window.height-200,width=360");
 	document.isUnloading = false;
}
function openVote (url) { 
	var wVote = open(url ,"Opinion","scrollbars=1,resizable,left=10,top=10,height=170,width=260");
 	document.isUnloading = false;
}
function openVoteResult (url) { 
	var wVote = open(url ,"Opinion","scrollbars=1,resizable,left=10,top=10,height=470,width=360");
 	document.isUnloading = false;
}

function vote () { 
	var wVote = open('login/tavling/intro/intro.asp' ,"Opinion","scrollbars=1,resizable,left=10,top=10,height=450,width=640");
 	document.isUnloading = false;
}

function show(id) {
	if (document.layers)
		document.layers[id].visibility = 'show'
	else 
		if (document.all)
			document.all[id].style.visibility = 'visible'
		else
			document.getElementById(id).style.visibility = 'visible'
}

function hide(id) {
	if (document.layers)
		document.layers[id].visibility = 'hide'
	else 
		if (document.all)
			document.all[id].style.visibility = 'hidden'
		else
			document.getElementById(id).style.visibility = 'hidden'
}

function expandIt(whichEl)
{
	if (navigator.appName == 'Microsoft Internet Explorer') {
		whichEl.style.display = (whichEl.style.display == "block" ) ? "none" : "block"; }
	else return;
}

function visitkortcentered(uid) {

	var height = 350;
	var width  = 550;
	var parms = ""

   if (height <= 1) { height = Math.floor(screen.height * height); }
   if (width <= 1) { width = Math.floor(screen.width * width); }

   var left = Math.floor( (screen.width - width) / 2);
   var top = Math.floor( (screen.height - height) / 2);
   var winParms = "top=" + top + ",left=" + left + ",height=" + height + ",width=" + width;
   if (parms) { winParms += "," + parms; }
   var win = window.open('/communicate/user/popup_visitcard.aspx?uid=' + uid, 'visitkort', winParms);
   if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
   return win;

}

function uploadcentered(tid) {

	var height = 325;
	var width  = 450;
	var parms = ""

   if (height <= 1) { height = Math.floor(screen.height * height); }
   if (width <= 1) { width = Math.floor(screen.width * width); }

   var left = Math.floor( (screen.width - width) / 2);
   var top = Math.floor( (screen.height - height) / 2);
   var winParms = "top=" + top + ",left=" + left + ",height=" + height + ",width=" + width;
   if (parms) { winParms += "," + parms; }
   var win = window.open('/communicate/userprogram/popup_upload.aspx?tid=' +tid, 'upload', winParms);
   if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
   return win;

}

function resizeWin() {
	if ((navigator.appVersion.indexOf("Win") != -1) && (navigator.appVersion.charAt(0) >= "4") && (navigator.appName.indexOf("Netscape") != -1)) {
	
		if ((screen.width == 640) && (screen.height == 480)) 
			self.resizeTo(670,500);
		else self.resizeTo(870,screen.height-200);
	}
	if ((navigator.appVersion.indexOf("Win") != -1) && (navigator.appVersion.charAt(0) >= "4") && (navigator.appName.indexOf("Microsoft") != -1)) {

		if ((screen.width == 640) && (screen.height == 480)) 
			self.resizeTo(640,480);
		else self.resizeTo(820,screen.height - 50);
	}
}

function openCenteredWindow(url, height, width, name, parms) {

   if (height <= 1) { height = Math.floor(screen.height * height); }
   if (width <= 1) { width = Math.floor(screen.width * width); }

   var left = Math.floor( (screen.width - width) / 2);
   var top = Math.floor( (screen.height - height) / 2);
   var winParms = "top=" + top + ",left=" + left + ",height=" + height + ",width=" + width;
   if (parms) { winParms += "," + parms; }
   var win = window.open(url, name, winParms);
   if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
   return win;
}

function deleteitem(id, message) {
	var x=window.confirm(message);
	if (x) {
		document.form1.btnaction.value = "delete";
		document.form1.id.value = id;
		document.form1.submit();
		}
	else { 
		document.form1.btnaction.value = "0";
	}
}

// aktiverar agenten
//var sekunder = 30;
//intervalID = window.setInterval("agent()", sekunder*1800);

function startchat() {
	var chatrefreshrate = 10;
	chatID = window.setInterval("chatrefresh()", chatrefreshrate*1800);
}


// kallar på agenten via javascriptet ajaxrequest.js
//function agent() {
//	
//	AjaxRequest.get(
//	{
//		'url':'/components/agent/checkstatus.aspx'
//		,'onSuccess':function(req){ eval(req.responseText); }
//	}
//	);
//}

// kallar på agenten via javascriptet ajaxrequest.js
function chatrefresh() {

	var now = new Date();
	var hours = now.getHours();
	var minutes = now.getMinutes();
	var seconds = now.getSeconds()
	var timeValue = "" + ((hours >12) ? hours -12 :hours)
	timeValue += ((minutes < 10) ? ":0" : ":") + minutes
	timeValue += ((seconds < 10) ? ":0" : ":") + seconds
	timeValue += (hours >= 12) ? " P.M." : " A.M."

	try {
	AjaxRequest.get(
		{
			'url':'/communicate/chat/chatupdate.aspx','onSuccess':function(req){ eval(req.responseText); }
		}
	);
	} catch (e) {
		window.status = 'error: ' + timeValue;
	}

	window.status = 'chat: ' + timeValue;
	
}


