/* SCRIPTS.JS*/

/*
if (top.location == self.location) {
	if(self.location==top.location)self.location="http://www.hacksvik.se/default.asp?url="+document.location.href
    }
*/
//----------------
function theSwap(showThis) {
for(i = 0; i < 8; i++) {
	hide('img_' + i)
}
show('img_'+showThis)
}

function theSwap2(showThis) {
for(i = 0; i < 13; i++) {
	hide('bigcolor' + i)
	hide('color' + i)
}
show('bigcolor'+showThis)
show('color'+showThis)
}

function openCopyright() {
	window.open('copyright.html','Copyright','width=400,height=600,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1');
}
function openMap() {
	window.open('karta.html','Karta','width=430,height=630,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1');
}
function openRevy() {
	window.open('revyn.asp','REVY','width=440,height=530,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1');
}

function openHacksviksbo() {
	window.open('hacksviksbo.html','Håcksviksbo','width=440,height=500,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1');
}

function openKlockaregardenBildspel() {
	window.open('bildspel.html','Klockaregården','width=300,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1');
}
//function showAd(thisAd) {
//alert(thisAd)
//window.open("annonser/annons.asp?annons="+thisAd+",'Annons','width=500,height=300,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1"'");
//}

function visaAktivitet(aktivitet) {
	var aktSrc = ""
	if (aktivitet == '') {
		alert("Ingen aktivitet hittades!\nVar vänlig kontakta oss för information\npostmaster@hacksvik.se")
		return
	}
	aktSrc = "aktiviteter_visa.asp?aktivitet="+aktivitet
	window.open(aktSrc,'Aktivitet','width=430,height=500,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1');
	}

	function visaAnnons(annons) {
	var aktSrc = ""
	if (annons == '') {
		alert("Ingen annons hittades!\nVar vänlig kontakta oss för information\npostmaster@hacksvik.se")
		return
	}
	aktSrc = "annons_visa.asp?annons="+annons
	window.open(aktSrc,'Annons','width=430,height=300,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1');
	}
	
		function visaAnnonsHelp() {
	var aktSrc = ""
	if (annons == '') {
		alert("Ingen annons hittades!\nVar vänlig kontakta oss för information\npostmaster@hacksvik.se")
		return
	}
	aktSrc = "annons_help.asp"
	window.open(aktSrc,'AnnonsHjälp','width=450,height=400,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1');
	}
// Tillfällig menufunction

function bytMenu(thisMenu) {
document.location.href=thisMenu

}	
	
function showActiveLink(thisSection) {
// Sätt Unactive
/*
document.img1.src = "images/navigation/nav_spacer.gif"
document.img2.src = "images/navigation/nav_spacer.gif"
document.img3.src = "images/navigation/nav_spacer.gif"
document.img4.src = "images/navigation/nav_spacer.gif"
document.img5.src = "images/navigation/nav_spacer.gif"
document.img6.src = "images/navigation/nav_spacer.gif"
document.img7.src = "images/navigation/nav_spacer.gif"
document.img8.src = "images/navigation/nav_spacer.gif"
document.img9.src = "images/navigation/nav_spacer.gif"
document.img10.src = "images/navigation/nav_spacer.gif"
document.img11.src = "images/navigation/nav_spacer.gif"
document.img12.src = "images/navigation/nav_spacer.gif"
document.img13.src = "images/navigation/nav_spacer.gif"
document.img14.src = "images/navigation/nav_spacer.gif"
*/
// Sätt active

/*
if(thisSection == '') {document.img1.src = "images/navigation/nav_spacer_active.gif"}
if(thisSection == "start") {document.img1.src = "images/navigation/nav_spacer_active.gif"}
if(thisSection == "historia") {document.img2.src = "images/navigation/nav_spacer_active.gif"}
if(thisSection == "kyrkan") {document.img3.src = "images/navigation/nav_spacer_active.gif"}
if(thisSection == "skola") {document.img4.src = "images/navigation/nav_spacer_active.gif"}
if(thisSection == "nyheter") {document.img5.src = "images/navigation/nav_spacer_active.gif"}
if(thisSection == "foretag") {document.img6.src = "images/navigation/nav_spacer_active.gif"}
if(thisSection == "foreningar") {document.img7.src = "images/navigation/nav_spacer_active.gif"}
if(thisSection == "aktiviteter") {document.img8.src = "images/navigation/nav_spacer_active.gif"}
if(thisSection == "sevardheter") {document.img9.src = "images/navigation/nav_spacer_active.gif"}
if(thisSection == "levabo") {document.img10.src = "images/navigation/nav_spacer_active.gif"}
if(thisSection == "jaktfiske") {document.img11.src = "images/navigation/nav_spacer_active.gif"}
if(thisSection == "gastbok") {document.img12.src = "images/navigation/nav_spacer_active.gif"}
if(thisSection == "kontakt") {document.img13.src = "images/navigation/nav_spacer_active.gif"}
if(thisSection == "oversikt") {document.img14.src = "images/navigation/nav_spacer_active.gif"}
*/
}


/*<img name="about" src="about.gif">
and then have that in a link tag <a href=...>
and then use OnMouseOver to change the image like this OnMouseOver="pic('about','about2.gif')"
then have this in the same tag: OnMouseOut="pic('about','about.gif')" */
function swapPic(img_name,img_src) {
//document[img_name].src=img_src;
}


//------------ EXTERNAL LINKS
var tmp1 = ''
function goExternal_Tidningar() {
tmp1 = document.extLinks.extlinks_tidningar.options[document.extLinks.extlinks_tidningar.selectedIndex].value;
// koll att tmp inte är tom
if(tmp1 != 0) {
window.open(tmp1)
}
//alert(tmp1)
}


var tmp2 = ''
function goExternal_Vader() {
tmp2 = document.extLinks.extlinks_vader.options[document.extLinks.extlinks_vader.selectedIndex].value;
// koll att tmp inte är tom
if(tmp2 != 0) {
window.open(tmp2)
}
//alert(tmp2)
}

// Byalag
var tmp3 = ''
function goExternal_byalag() {


tmp3 = document.extLinks.extlinks_byalag.options[document.extLinks.extlinks_byalag.selectedIndex].value;
// koll att tmp inte är tom
if(tmp3 != 0) {
window.open(tmp3)
}

//alert(document.extLinks.extlinks_hemsidor.options[document.extLinks.extlinks_hemsidor.selectedIndex].value)
}

// Övrigt
var tmp4 = ''
function goExternal_1() {


tmp4 = document.extLinks.extlinks_1.options[document.extLinks.extlinks_1.selectedIndex].value;
// koll att tmp inte är tom
if(tmp4 != 0) {
window.open(tmp4)
}

//alert(document.extLinks.extlinks_hemsidor.options[document.extLinks.extlinks_hemsidor.selectedIndex].value)
}

// ------ slut external links
function BrowserSystemCheck() {
	var brwtype = navigator.appName
	if (brwtype=="Netscape") this.brwtype = "ns"
	else if (brwtype=="Microsoft Internet Explorer") this.brwtype = "ie"
	else this.brwtype = brwtype
	this.brwvers = navigator.appVersion
	this.brwversion = parseInt(this.brwvers)
		
	this.ns = (this.brwtype=="ns" && this.brwversion>=4)
	this.ns4 = (this.brwtype=="ns" && this.brwversion==4)
	this.ns6 = (this.brwtype=="ns" && this.brwversion==5)
	this.ie = (this.brwtype=="ie" && this.brwversion>=4)
	this.ie4 = (this.brwvers.indexOf('MSIE 4')>0)
	this.ie5 = (this.brwvers.indexOf('MSIE 5')>0)
	this.min = (this.ns||this.ie)
	
	this.winos = (this.brwvers.lastIndexOf('Win')!= -1)
	this.macos = (this.brwvers.lastIndexOf('Win') == -1)
	this.macosie = this.macos && this.ie
	this.macosns = this.macos && this.ns
	this.winosie = this.winos && this.ie
	this.winosns = this.winos && this.ns
}

var isNav, isIE, isMoz;
var collStart = "";
var collEnd = "";
var styleObj = "";

if (parseInt(navigator.appVersion) >= 4){
	if (navigator.appName == "Netscape"){
		if (parseInt(navigator.appVersion) >= 5){
			isMoz = true;
			collStart = "getElementById('";
			collEnd = "')";
			styleObj = ".style";
		}
		else{
			isNav = true;
			collStart = "layers.frame.document.layers.";
		}
	}
	else{
		isIE = true;
		collStart = "all.";
		styleObj = ".style";
	}
}

function getObject(obj){
	var theObj;
	
	if (typeof obj == "string"){
		theObj = eval("document." + collStart + obj + collEnd + styleObj);
	}
	else{		
		theObj = obj;
	}
	return theObj;
}

function shiftTo(obj, x, y){
	var theObj = getObject(obj);
	
	if (isNav){
		theObj.moveTo(x,y);
	}
	else if(isMoz){
		theObj.left = x;
		theObj.top = y;
	}
	else{
		theObj.pixelLeft = x;
		theObj.pixelTop = y;
	}
}

function shiftBy(obj, deltaX, deltaY){
	var theObj = getObject(obj);

	if (isNav){
		theObj.moveBy(deltaX, deltaY);
	}
	else if(isMoz){
		theObj.left = parseInt(theObj.left) + deltaX;
		theObj.top = parseInt(theObj.top) + deltaY;
	}
	else{
		theObj.pixelLeft += deltaX;
		theObj.pixelTop += deltaY;
	}
}

function setZIndex(obj, zOrder){
	var theObj = getObject(obj);
	
	theObj.zIndex = zOrder;
}

function setBGColor(obj, color){
	var theObj = getObject(obj);
	
	if(isNav){
		theObj.bgColor = color;
	}
	else{
		theObj.backgroundColor = color;
	}
}

function setBorderColor(obj, color){
	obj.borderColor = color;
}

function show(obj){
	var theObj = getObject(obj);
	if(isNav){
		theObj.visibility = "show";
	}
	else{
		theObj.visibility = "visible";
	}
}

function hide(obj){
	var theObj = getObject(obj);
	
	if (isNav){
		theObj.visibility = "hide";
	}
	else{
		theObj.visibility = "hidden";
	}
}

function getObjectLeft(obj){
	var theObj = getObject(obj);
	
	if (isNav){
		return theObj.left;
	}
	else{
		return theObj.pixelLeft;
	}
}

function getObjectTop(obj){
	var theObj = getObject(obj);
	
	if(isNav){
		return theObj.top;
	}
	else if(isMoz){
		return theObj.top;
	}
	else{
		return theObj.pixelTop;
	}
}