function findBrowser() {
var browser;
if (navigator.appName == 'Netscape' && document.layers != null) {
browser = "ns";
} else if (document.all != null) {
browser = "ie"
} else if (navigator.appName == 'Netscape' && document.layers == null && navigator.appVersion.substring(0,1) > 4) {
browser = "ns6";
}
return browser;
}
function getRef(id) {
if (findBrowser() == "ns") {
return document.layers[id];
} else if (findBrowser() == "ie") {
return document.all[id];
} else if (findBrowser() == "ns6") {
return document.getElementById(id);
}
}
function changeColor(id,color) {
if (findBrowser() == "ns") {
getRef(id).bgcolor = color;
}
else if (findBrowser() == "ie" || findBrowser() == "ns6") {
getRef(id).style.backgroundColor = color;
}
}
function changeClass(id,newClass) {
getRef(id).className = newClass;
}
function changeImage(id,imageUrl) {
document.images[id].src = imageUrl;
}
function hideLayer(id) {
if (findBrowser() == "ns") {
if (getRef(id).visibility == "show") {
getRef(id).visibility = "hide";
}
}
else if (findBrowser() == "ie" || findBrowser() == "ns6") {
if (getRef(id).style.visibility == "visible") {
getRef(id).style.visibility = "hidden";
}
}
}
function showLayer(id) {
if (id) {
if (findBrowser() == "ns") {
if (getRef(id).visibility == "hide") {
getRef(id).visibility = "show";
}
}
else if (findBrowser() == "ie" || findBrowser() == "ns6") {
if (getRef(id).style.visibility == "hidden") {
getRef(id).style.visibility = "visible";
}
}
}
}
function changeLocation(mmId,smId,sideId) {
document.location.href = "index.asp?mainmenuid="+mmId+"&submenuid="+smId+"&sideid="+sideId;
}
function openWindow(URL) {
window.open(URL);
}
function openBestemmelser() {
bestemmelserWindow = window.open('bestemmelser.asp', 'bestemmelser', 'toolbar=no,status=no,width=600,height=500,scrollbars=yes');
bestemmelserWindow.focus();
}
function openHund(id,anchorid) {
hundWindow = window.open('hunddata.asp?id='+id+'#resultat'+anchorid, 'hund', 'toolbar=no,status=no,width=600,height=500,scrollbars=yes');
hundWindow.focus();
}
var activeMmLayerId = "";
function changeMenuColor(layerId, newColor) {
if (layerId != "mainmenu" + activeMmLayerId) {
changeColor(layerId, newColor);
}
}
function changemenu(id) {
var layerId = "mainmenu" + id;
var submenuLayerId = "submenuLayer" + id;
var menuPilLayer = "mainmenulayerArrow" + id;
if (id == activeMmLayerId) {
newState = 'none'; //hide
newMenuPil = "
";
activeMmLayerId = "";
} else {
if (activeMmLayerId != "") { //fjern den undermenu som vises nu
var tempLayerId = "mainmenu" + activeMmLayerId;
var tempMenuPilLayer = "mainmenulayerArrow" + activeMmLayerId;
var tempSubmenuLayerId = "submenuLayer" + activeMmLayerId;
changeColor(tempLayerId,'');
getRef(tempMenuPilLayer).innerHTML = "
";
if (document.all) { //IS IE 4 or 5 (or 6 beta)
eval( "document.all." + tempSubmenuLayerId + ".style.display = 'none'");
}
if (document.layers) { //IS NETSCAPE 4 or below
document.layers[tempSubmenuLayerId].display = 'none';
}
if (document.getElementById &&!document.all) {
hza = document.getElementById(tempSubmenuLayerId);
hza.style.display = 'none';
}
}
newState = 'block'; //show
activeMmLayerId = id;
newMenuPil = "
";
}
if (document.all) { //IS IE 4 or 5 (or 6 beta)
eval( "document.all." + submenuLayerId + ".style.display = newState");
}
if (document.layers) { //IS NETSCAPE 4 or below
document.layers[submenuLayerId].display = newState;
}
if (document.getElementById &&!document.all) {
hza = document.getElementById(submenuLayerId);
hza.style.display = newState;
}
getRef(menuPilLayer).innerHTML = newMenuPil;
}
function showhide(layer_ref, link_ref) {
var state = "";
if (document.all) { //IS IE 4 or 5 (or 6 beta)
state = getRef(layer_ref).style.display;
}
if (document.layers) { //IS NETSCAPE 4 or below
state = document.layers[layer_ref].display;
}
if (document.getElementById &&!document.all) {
hza = document.getElementById(layer_ref);
state = hza.style.display;
}
if (state == 'block') {
state = 'none';
link_html = "vis";
} else {
state = 'block';
link_html = "skjul";
}
if (document.all) { //IS IE 4 or 5 (or 6 beta)
eval( "document.all." + layer_ref + ".style.display = state");
eval( "document.all." + link_ref + ".innerHTML = link_html");
}
if (document.layers) { //IS NETSCAPE 4 or below
document.layers[layer_ref].display = state;
document.layers[link_ref].innerHTML = link_html;
}
if (document.getElementById &&!document.all) {
hza = document.getElementById(layer_ref);
hza.style.display = state;
document.getElementById(link_ref).innerHTML = link_html;
}
}
function checkEmail(str) {
var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
//alert("Invalid E-mail ID")
return false
}
if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
//alert("Invalid E-mail ID")
return false
}
if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
//alert("Invalid E-mail ID")
return false
}
if (str.indexOf(at,(lat+1))!=-1){
//alert("Invalid E-mail ID")
return false
}
if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
//alert("Invalid E-mail ID")
return false
}
if (str.indexOf(dot,(lat+2))==-1){
//alert("Invalid E-mail ID")
return false
}
if (str.indexOf(" ")!=-1){
//alert("Invalid E-mail ID")
return false
}
return true
}