ns4 = (document.layers) ? true : false;
ie4 = (document.all && !document.getElementById) ? true : false;
ie5 = (document.all && document.getElementById) ? true : false;
ns6 = (!document.all && document.getElementById) ? true : false;
// BROWSERCHECK
if (ie4||ie5||ns6) {
} else {
	if (sIgnoreOldBrowser != "yes") {
		location.replace("/oldbrowser.asp");
	}
}
// -------------------------------------------------------------------------------------
function SMTChat() {
	var sShowDrop, iRoomID;
	sShowDrop = "no";
	if (arguments.length) {
		if (arguments[1] == "showdrop") {
			sShowDrop = "yes";
		}
		if (!isNaN(arguments[0])) {
			var iRoomID = arguments[0];
		}
	}
	window.open('/chat/login.asp?showdrop='+sShowDrop+'&roomid='+iRoomID,'','width=600,height=400');
}
// -------------------------------------------------------------------------------------
function printFriendly(sURL) {
	if (sURL.length) {
		window.open("/library/scripts/printfriendly.asp?page="+sURL,"","width=600,height=480,scrollbars=yes");
	}
}
// -------------------------------------------------------------------------------------
sTextMode = "normal";
function toggleEasyText() {
	var oNormalStyle	= getBlock("div_textnormal");
	var oEasyStyle 		= getBlock("div_texteasy");

	if (sTextMode == "normal") {
		oNormalStyle.visibility = "hidden";
		oEasyStyle.visibility 	= "visible";
		oNormalStyle.display 	= "none";
		oEasyStyle.display 		= "inline";
		sTextMode	 			= "easy";
	} else {
		oNormalStyle.visibility	= "visible";
		oEasyStyle.visibility 	= "hidden";
		oNormalStyle.display 	= "inline";
		oEasyStyle.display 		= "none";
		sTextMode	 			= "normal";
	}
}
// -------------------------------------------------------------------------------------
function getBlock(sLayerID) {
if (ie4 || ie5 || ns6) {
	var oReturn
	if (ns4){
   	   oReturn = document.layers[sLayerID];
	}
	else if (ie4) {
	   oReturn = document.all[sLayerID].style;
	}
	else if (ie5 || ns6) {
	   oReturn = document.getElementById(sLayerID).style;
	}
	return oReturn;
	}
}

function checkemail(pk)
{
	//alert(pk);
	if(!((pk >= 65 && pk <= 90) || (pk >= 96 && pk <= 105) || (pk >= 48 && pk <= 57)))
	{
		if(pk != 36 && pk != 35 && pk != 37 && pk != 39 && pk != 16 && pk != 190 && pk != 17 && pk != 8 && pk != 46 && pk != 13 && pk != 189 && pk != 9)
		{
			return false;
		}
	}
}

function isEmail(sEmail) {
	var re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	if(!re.test(sEmail))
	{
		alert("E-postadressen är felaktig!\nVar god ange en korrekt e-postadress.");
	}
	return(re.test(sEmail));
	
}

function jobchecker(faqForm, sEmail)
{
	if(!verify(faqForm))
	{
		return false;
	}
	
	if(!isEmail(sEmail))
	{
		return false;
	}
}

function preloadImages()
{
	if (document.images)
	{
		var imgFiles = preloadImages.arguments;
		var preloadArray = new Array();
		for (var i=0; i<imgFiles.length; i++)
		{
			preloadArray[i] = new Image;
			preloadArray[i].src = imgFiles[i];
		}
	}
}

function openwin(url, name, width, height)
{
	//center the window on the screen
	var w = 480, h = 340;
	
	w = screen.availWidth; //document.body.clientWidth;
	h = screen.availHeight; //document.body.clientHeight;

	var leftPos = (w-width)/2, topPos = (h-height)/2;
	
	msgWindow = open(url, name,'menubar=0,status=0,scrollbars=1,resizable=1,toolbar=0,location=0,width=' + width + ',height=' + height + ',top=' + topPos + ',left=' + leftPos);
	msgWindow.focus;
	return msgWindow;
}

function openMessageWin(url, name, width, height)
{
	//Skapade denna funktion, ifall openwin används på andra ställen på jägareförbundets sajt..
	//center the window on the screen
	var w = 480, h = 340;
	
	w = screen.availWidth; //document.body.clientWidth;
	h = screen.availHeight; //document.body.clientHeight;

	var leftPos = (w-width)/2, topPos = (h-height)/2;
	
	msgWindow = open(url, name,'menubar=0,status=0,scrollbars=1,resizable=1,toolbar=0,location=0,width=' + width + ',height=' + height + ',top=' + topPos + ',left=' + leftPos);
	msgWindow.focus;
}

function displayBanners()
{
	document.getElementById("topbannerlarge").innerHTML	= document.getElementById("dtopbannerlarge").innerHTML;
	document.getElementById("topbannersmall").innerHTML	= document.getElementById("dtopbannersmall").innerHTML;
	document.getElementById("rightbanner").innerHTML	= document.getElementById("drightbanner").innerHTML;
}

function submitPoll(iVoteID, iPollID, sCommand)
{
	var answChecked	= 0;
	var pollyWin;
	
	pollyWin = openPoll('/poll/poll.asp?actions=' + sCommand + '&voteid=' + iVoteID + '&pollid=' + iPollID, 'test', 400, 450);
}

function openPoll(url, name, width, height)
{
	//center the window on the screen
	var w = 480, h = 340;
	
	w = screen.availWidth; //document.body.clientWidth;
	h = screen.availHeight; //document.body.clientHeight;

	var leftPos = (w-width)/2, topPos = (h-height)/2;
	
	msgWindow = open(url, name,'menubar=0,status=0,scrollbars=1,resizable=0,toolbar=0,location=0,width=' + width + ',height=' + height + ',top=' + topPos + ',left=' + leftPos);
	msgWindow.focus;
	return msgWindow;
}

function jaktskolan()
{
	window.open("/jaktskolan/jaktskolan.htm","jaktskolan","toolbar=no,location=no,menubar=no,scrollbars=no,resizeble=no,height=466,width=672");
}

function blankStatus()
{
	window.status=" ";
}

function RefreshImage(valImageId) {
	var objImage = document.images[valImageId];
	if (objImage == undefined) {
		return;
	}
	var now = new Date();
	objImage.src = objImage.src.split('?')[0] + '?x=' + now.toUTCString();
}

function loadPage(path) {
	if(path != "") {
		location.href = path;
	}
}