﻿function capturekey(e){
    var key=(typeof event!='undefined')?window.event.keyCode:e.keyCode;
    if (key == 120){
       
        
	    document.getElementById('login').style.display=(document.getElementById('login').style.display=='none')?'block':'none';
	    if (document.getElementById('login').style.display == 'block'){
	       
	            document.admin.Uname.focus();
	        
	    }
    }
}
if(navigator.appName!= "Mozilla"){document.onkeyup=capturekey}
else{document.addEventListener("keypress",capturekey,true);}

function isValidObject(objToTest) {
  if (null == objToTest) return false;
  if ("undefined" == typeof(objToTest)) return false;
  return true;
}
function DelShop(id){
    if (confirm('Skal shoppen slettes ?')){
        window.location.href = '/include/actionadmin.asp?shopid='+id+'&actn=del&fUrl='+window.location.href;
    }
}

function Echeck(src) {
     var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
     var regex = new RegExp(emailReg);
     return regex.test(src);
  }


function SendKontakt(){
    if (document.kontakt.navn.value == ''){
        alert('Navn skal udfyldes')
        document.kontakt.navn.focus();
        return;
    }
    if (Echeck(document.kontakt.Email.value) == false){
        alert('E-mail er forkert')
        document.kontakt.Email.focus();
        return;
    }
    if (document.kontakt.besked.value == ''){
         alert('Der skal indtastes en besked')
         document.kontakt.besked.focus();
         return;
    }
    document.kontakt.submit();
}
function Search(){
if (document.search.search.value != ''){
    document.search.submit();
    }
}
function Deletesite(id){
    if (confirm('Slet denne anmodning?')){
        window.location.href = '/include/actionadmin.asp?shopid='+id+'&actn=del&fUrl='+window.location.href;
    }
}
function confirmShop(ID){
    if (confirm('Bekræft anmodning?')){
        window.location.href = '/include/actionadmin.asp?shopid='+ID+'&actn=Confirm&fUrl='+window.location.href;
    }
}

function displayVers(elm){
 document.getElementById(elm).style.display=(document.getElementById(elm).style.display=='none')?'block':'none';
}
function DelTags(ID){
    if (confirm('Slet tags ?')){
        window.location.href = '/include/actionadmin.asp?deltags='+ID+'&fUrl='+window.location.href;
    }
}
