window.defaultStatus="COPYTHIS";

function show(num)
{if(eval('admin'+num+'.style.display')=='none')
{eval('admin'+num+'.style.display=""')}
else {eval('admin'+num+'.style.display="none"')}}

function del(go)
{if (confirm("COPYTHIS     ")){self.location=(go)}else{}}

function addtoselection(before,after){
if(document.selection.createRange().text){
document.selection.createRange().text=before+document.selection.createRange().text+after;}}

function COPYTHISpopup(url)
{mywin = window.open(""+url+"","","scrollbars=no,resizable=no,toolbar=no,location=no,directories=no,status=no,menubar=no,width=400,height=200");}

function imgpopup(url)
{mywin = window.open("","","scrollbars=no,resizable=no,toolbar=no,location=no,directories=no,status=no,menubar=no,width=100,height=100");
with(mywin.document)
{open();
write("<html>\n<head>\n");
write("<meta http-equiv=\"imagetoolbar\" content=\"no\"><scr"+"ipt>awidth=(document.layers)?0:8;awidth+=(document.all)?4:0;aheight=(document.layers)?0:29;</scr"+"ipt>\n");
write("<title>COPYTHIS - BILD</title>\n");
write("</head>\n");
write("<body bgcolor=\"#COPYTHIS\" onclick=\"self.close()\" onload=\"window.resizeTo(document.images[0].width+awidth,document.images[0].height+aheight)\" style=\"overflow:hidden;margin:1px;cursor:hand;\">\n");
write("<img src=\""+url+"\" alt=\"STÄNG\">\n");
write("</body>\n</html>\n");
close();}}

function formCOPYTHIS()
{if (document.COPYTHISform.username.value==''){alert("Vänligen fyll i alla fält korrekt!");return false;}
else if (document.COPYTHISform.password.value==''){alert("Vänligen fyll i alla fält korrekt!");return false;}
else if (document.COPYTHISform.COPYTHIS.value=='COPYTHIS'){alert("Vänligen fyll i alla fält korrekt!");return false;}}

function preview(theForm){
txt = theForm.content.value;
txt = txt.replace(/\n/ig,"<br>")
txt = txt.replace(/\[IMG left\]/g,"<img align=left src=img/")
txt = txt.replace(/\[IMG\]/g,"<img align=right src=img/")
txt = txt.replace(/\[\/IMG\]/g,">")
popup = window.open("", "preview", "width=500, height=500;");
with(popup.document){
write("<html>\n<head>\n<title>FÖRHANDSVISNING</title>\n");
write("<link href=\"./inc/index.css\" rel=\"stylesheet\" type=\"text/css\">\n");
write("</head><body scroll=\"yes\">\n<table width=\"433\" height=\"100%\">\n<tr><td align=\"left\" valign=\"top\" id=\"content\">\n");
write(txt)
write("</<td></tr></table>\n</body>\n</html>");}}

function checklength(obj,dispobj,mlength)
{if(obj.value.length>mlength)
{obj.value = obj.value.substr(0,mlength);
obj.focus();}
dispobj.value=mlength-obj.value.length;}

function display(){
rtime=etime-ctime;
if (rtime>60)
m=parseInt(rtime/60);
else{
m=0;}
s=parseInt(rtime-m*60);
if(s<10)
s="0"+s
window.setTimeout("checktime()",1000)}
function settimes(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
etime=hours*3600+mins*60+secs;
etime+=1800;
checktime();}
function checktime(){
var time= new Date();
hours= time.getHours();
mins= time.getMinutes();
secs= time.getSeconds();
ctime=hours*3600+mins*60+secs
if(ctime>=etime){
expired();}
else
display();}
function expired(){
logoutquestion();}

function logoutquestion() 
{if(!confirm("VARNING! Du har inte varit aktiv på sidan!\nUtloggning kommer att ske om 10 minuter!\n\nAVBRYT för att LOGGA UT från sidan\n\nOK för att ÅTERGÅ och slutföra   ")) 
{window.location = 'http://www.noll498.se/?p=LOGGAUT'}}
