﻿// JScript File

var currentmenyval=''

function fixamenyraden(menyval){
   currentmenyval=menyval
   var thisstyle="background-color:#FF5500;color:ghostwhite;font-weight:normal;"
   var o=document.getElementById(menyval)
   _setStyle(o, thisstyle); 

}

function fixamasterpage(epost){
   
   prefill()
   
   if (epost.length>0) {
     thisstyle='font-size:8pt;left:7px;width:112px;font-family:Verdana;position:relative;top:0px;height:16px;background-color:transparent;border:0px;'
     var o=document.getElementById('UserEpost')
     _setStyle(o, thisstyle); 

     thisstyle='font-size:8pt;left:7px;width:72px;font-family:Verdana;position:relative;top:0px;height:16px;background-color:transparent;border:0px;'
     var o=document.getElementById('UserPw')
     _setStyle(o, thisstyle); 
      
     document.getElementById('Loggin').value='Logga ut'

     
     hiddevisibility('txtnamn')
     hiddevisibility('txtpw')
     hiddevisibility('UserEpost')
     hiddevisibility('UserPw')
     hiddevisibility('glomtlogin')
     hiddevisibility('reguser')
     hiddevisibility('txtpw')
     hiddevisibility('txtpw')

     document.getElementById('glomtlogin').value=''
     document.getElementById('reguser').value=''


     setvisibility('logname0')
     setvisibility('logname')
     document.getElementById('logname').innerHTML=epost
     
     //coloroff(148,'Minasidor') //Visar cellen Minasidor med color:blue
     var thisstyle="background-color:silver;color:blue;font-weight:normal;"
     fixastylen('Minasidor',thisstyle)
     
   } else {
   
     document.getElementById('Loggin').value='Logga in'
     
     setvisibility('txtnamn')
     setvisibility('txtpw')
     setvisibility('UserEpost')
     setvisibility('UserPw')
     setvisibility('glomtlogin')
     setvisibility('reguser')
     setvisibility('logname')
     
     document.getElementById('glomtlogin').value='Glömt login?'
     document.getElementById('reguser').value='Bli användare'

     hiddevisibility('logname0')
     hiddevisibility('logname')
     document.getElementById('logname').innerHTML=''
   }  
}   

function hiddevisibility(forthisid){
     find_string="visibility:visible;"
     replace_string='visibility:hidden;'
     
     value = document.getElementById(forthisid).getAttribute("style")
     s=value
     if (typeof s=='object') {
         s=value.cssText
     }
     s=s.toLowerCase()
     s=exclude_spaces(s)
     s=s.replace(find_string,replace_string)
     var o=document.getElementById(forthisid)
     _setStyle(o, s); 
}

function setvisibility(forthisid){
     find_string="visibility:hidden;"
     replace_string='visibility:visible;'
     value = document.getElementById(forthisid).getAttribute("style")
     s=value
     if (typeof s=='object') {
         s=value.cssText
     }
     s=s.toLowerCase()
     s=exclude_spaces(s)
     s=s.replace(find_string,replace_string)

     var o=document.getElementById(forthisid)
     _setStyle(o, s); 
}

//function coloroff(id){
//   if (id==currentmenyval){
//       return
//   }    

//   if (id=="Startsidan" || id=="Sport" || id=="OmSpelen" || id=="KontaktaOss" || id=="faq" || (id=="Minasidor" && document.getElementById('logname').innerHTML!=''))   {
//       var thisstyle="background-color:silver;color:blue;font-weight:normal;"
//       fixastylen(id,thisstyle)
//   }    
//}

function loadpage(pid){
    //omgang=-1 och systemid=-1 betyder att det är ett nytt spel
    url='GamblerSQL.aspx?pid='+pid+'&omgang=-1&systemid=-1'
    MyWindow=window.open(url,"_blank", "directories=no, location=no, menubar=no, resizable=no, scrollbars=yes, status=no, toolbar=no, width=952, height=762")
}

function pageload(){
    window.open("Sinkadus.aspx","_self","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=yes")
}    
