
function notification(msg) {
	msg += '<br/><br/><br/><a href="#" class="hover button" onclick="$(\'#newMsgCont\').hide(\'slow\');return false"> Luk </a>';

  msg += '<title>Ny besked...</title>';
	$("#newMsg").html(msg);
	$("#newMsgCont")[0].style.zIndex = "999";
	$("#newMsg")[0].style.background = "#ace";
	$("#newMsgCont")[0].style.position = "absolute";
	$("#newMsgCont")[0].style.top = (document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px";
	$("#newMsgCont")[0].style.left = "0px";
	
	// $("#newMsgCont").show(1000);
	$("#newMsgCont")[0].style.float = "right";
	$("#newMsgCont").show(1000);
	
	//setTimeOut ("document.title='new message';",3000);
	document.title='Ny besked!';
}

function toggle(id,display) {
      elid = document.getElementById(id);
			if (!elid) { return false; }
			if (display == null) {
      	elid.style.display=elid.style.display == 'none' ? 'block' : 'none';
			} else {
      	elid.style.display=display ? 'block' : 'none';
			}
      return false;
    }

function profilepicon(url) {
  p_scrollTop = document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
  if (p_scrollTop < 105) { p_scrollTop = p_scrollTop + (105 - p_scrollTop); }
  document.getElementById('profileIMGDIV').style.top=p_scrollTop + "px";
  document.getElementById('profileIMGDIV').style.display='block';
  document.getElementById('profileIMG').src="http://pics1.homo.dk/zsite/img/loading.gif";
  document.getElementById('profileIMG').src=url;
}

function profilepicoff() {
  document.getElementById('profileIMGDIV').style.display='none';
  document.getElementById('profileIMG').src='http://pics1.homo.dk/zsite/img/loading.gif';
  // document.getElementById('profileIMG').src='http://';
}

function popup(url) {
  popupwin = window.open (url,'_blank','fullscreen=no,toolbar=no,status=yes,menubar=no,scrollbars=yes, resizable=yes,directories=no,location=no');
}

function gourl(url) {
	document.location = url;
	return false;
}

function textCounter(field, countfield, maxlimit) {
  if (field.value.length > maxlimit) // if too long...trim it!
  field.value = field.value.substring(0, maxlimit);
  // otherwise, update 'characters left' counter
  else
  countfield.value = maxlimit - field.value.length;
}

function poppic(picid) {
	window.open('http://' + picid + '.foto.homo.dk','xkpic','width=790, height=720, fullscreen=no,toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no');
}

function popprofile(profileid) {
	window.open('http://homo.dk/?po=showProfile&profileID=' + profileid,'xkprofile','width=790, height=720, fullscreen=no,toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no');
}

function findPos(obj) {
  var fcurleft = fcurtop = 0;
  if (obj.offsetParent) {
    fcurleft = obj.offsetLeft
    fcurtop = obj.offsetTop
	  while (obj = obj.offsetParent) {
      fcurleft += obj.offsetLeft
      fcurtop += obj.offsetTop
    }
  }

  return [fcurleft,fcurtop];
}

function setCookie(c_name,value,expiredays) {
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
