var cookieValue
var exp = new Date();
var oneYearFromNow = exp.getTime() + (365 * 24 * 60 * 60 * 1000)
exp.setTime(oneYearFromNow)

function setSignOptions(onOrOff){
	if(onOrOff == 1 ){
		SetCookie("signImg","on",exp);
		document.getElementById("knappPA").disabled = true;
		document.getElementById("knappAV").disabled = false;
	}
	else{
		SetCookie("signImg","off",exp);
		document.getElementById("knappAV").disabled = true;
		document.getElementById("knappPA").disabled = false;
	}
}
function readSignOptions(){
	cookieValue = GetCookie("signImg");
}
function getCookieVal(offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function FixCookieDate(date) {
  var base = new Date(0);
  var skew = base.getTime(); // dawn of (Unix) time - should be 0
  if (skew > 0)  // Except on the Mac - ahead of its time
    date.setTime (date.getTime() - skew);
}

function GetCookie(name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
	i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break; 
  }
  return null;
}

function SetCookie(name,value,expires,path,domain,secure) {
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

function DeleteCookie(name,path,domain) {
  if (GetCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}
function writeMovieTags(fileName){
	document.write("<br>");
	document.write('<OBJECT ID="MediaPlayer1" width=352 height=362 classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" standby="Loading Microsoft® Windows® Media Player components..." type="application/x-oleobject">');
	document.write('<param name="AudioStream" value="-1">');
	document.write('<param name="AutoSize" value="-1">');
	document.write('<param name="AutoStart" value="0">');
	document.write('<param name="AnimationAtStart" value="-1">');
	document.write('<param name="AllowScan" value="-1">');
	document.write('<param name="AllowChangeDisplaySize" value="-1">');
	document.write('<param name="AutoRewind" value="0">');
	document.write('<param name="Balance" value="0">');
	document.write('<param name="BaseURL" value="">');
	document.write('<param name="BufferingTime" value="5">');
	document.write('<param name="CaptioningID" value>');
	document.write('<param name="ClickToPlay" value="-1">');
	document.write('<param name="CursorType" value="0">');
	document.write('<param name="CurrentPosition" value="-1">');
	document.write('<param name="CurrentMarker" value="0">');
	document.write('<param name="DefaultFrame" value>');
	document.write('<param name="DisplayBackColor" value="0">');
	document.write('<param name="DisplayForeColor" value="16777215">');
	document.write('<param name="DisplayMode" value="0">');
	document.write('<param name="DisplaySize" value="4">');
	document.write('<param name="Enabled" value="-1">');
	document.write('<param name="EnableContextMenu" value="-1">');
	document.write('<param name="EnablePositionControls" value="-1">');
	document.write('<param name="EnableFullScreenControls" value="0">');
	document.write('<param name="EnableTracker" value="-1">');
	document.write('<param name="Filename" value="mms://media.lartecken.se/medgrund/' + fileName + '">');
	document.write('<param name="InvokeURLs" value="-1">');
	document.write('<param name="Language" value="-1">');
	document.write('<param name="Mute" value="0">');
	document.write('<param name="PlayCount" value="1">');
	document.write('<param name="PreviewMode" value="0">');
	document.write('<param name="Rate" value="1">');
	document.write('<param name="SAMILang" value>');
	document.write('<param name="SAMIStyle" value>');
	document.write('<param name="SAMIFileName" value>');
	document.write('<param name="SelectionStart" value="-1">');
	document.write('<param name="SelectionEnd" value="-1">');
	document.write('<param name="SendOpenStateChangeEvents" value="-1">');
	document.write('<param name="SendWarningEvents" value="-1">');
	document.write('<param name="SendErrorEvents" value="-1">');
	document.write('<param name="SendKeyboardEvents" value="0">');
	document.write('<param name="SendMouseClickEvents" value="0">');
	document.write('<param name="SendMouseMoveEvents" value="0">');
	document.write('<param name="SendPlayStateChangeEvents" value="-1">');
	document.write('<param name="ShowCaptioning" value="0">');
	document.write('<param name="ShowControls" value="-1">');
	document.write('<param name="ShowAudioControls" value="-1">');
	document.write('<param name="ShowDisplay" value="0">');
	document.write('<param name="ShowGotoBar" value="0">');
	document.write('<param name="ShowPositionControls" value="0">');
	document.write('<param name="ShowStatusBar" value="-1">');
	document.write('<param name="ShowTracker" value="-1">');
	document.write('<param name="TransparentAtStart" value="0">');
	document.write('<param name="VideoBorderWidth" value="0">');
	document.write('<param name="VideoBorderColor" value="0">');
	document.write('<param name="VideoBorder3D" value="0">');
	document.write('<param name="Volume" value="-600">');
	document.write('<param name="WindowlessVideo" value="0">');
	document.write('<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" SRC="mms://media.lartecken.se/medgrund/' + fileName + '" name="MediaPlayer1" width="352" height="362" ShowStatusBar="true">');
	document.write('</OBJECT>');
	document.write("<br>");
}