var isNav

if (parseInt(navigator.appVersion) >= 4) {
	if(navigator.appName == "Netscape") {
		isNav = true;
	}
}

if (isNav) {
	alert('This site only works in Internet Explorer!');
	
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown = function (evt){
	if (evt.which == 3) {
		alert('This material is copyrighted!!');
		return false;
		}
	}
} else {
	document.onmousedown=click
}




function click() {
	if (event.button==2) {
		alert('This material is copyrighted!!');
		return false;
	}
}


function showImg(strSrc, strId){
	var strBeskr = aBeskr[strId];
	var intPris = aPris[strId];

	document.all['order'].style.display = 'none';
	document.all['bigImage'].style.display = '';
	document.all['Desc'].style.display = '';
	document.all['showbild'].src = strSrc;document.all['showbild'].id = strId;
	document.all['beskrivning'].innerHTML = strBeskr;
	document.all['pris'].innerHTML = intPris + ' kr';
	document.all['addnew'].style.display = '';
	
	if (document.all['sum'].value > 0) {
		document.all['content'].style.display = '';
		document.all['contentsum'].style.display = '';
		document.all['bestall'].style.display = '';
	}

}

function addnew(strId) {
	strId = parseInt(strId);

	var strText = aText[strId];
	var intSum = aPris[strId];
	var intAntal = document.all['antalObject'].value;
	var strSize = document.all['sizeObject'].value;
	
	if ((isNaN(intAntal)) || (intAntal == '')){
		intAntal = 1;
	}
	
	document.all['content'].style.display = '';
	document.all['contentsum'].style.display = '';
	document.all['bestall'].style.display = '';
	
	document.all['content'].innerHTML = document.all['content'].innerHTML + strText + '<br>Size: ' + strSize + '<br>'+ 'Quantity: ' + intAntal + '<br><br>';
	
	intSum = parseInt(document.all['sum'].value) + parseInt(intSum) * parseInt(intAntal);
	
	document.all['sum'].value = intSum;
	document.all['contentsum'].innerHTML = 'Sum: ' + intSum + ' kr';
	
	document.all['bigImage'].style.display = 'none';
	document.all['Desc'].style.display = 'none';

	document.all['addnew'].style.display = 'none';
}

function getOrder(){

	var strOrder = document.all['content'].innerHTML
	var strSum = document.all['contentsum'].innerHTML
	
	document.all['yourorder'].innerHTML = strOrder + strSum;
	
	document.all['order'].style.display = '';
	document.all['bigImage'].style.display = 'none';
	document.all['Desc'].style.display = 'none';

	document.all['addnew'].style.display = 'none';
	document.all['content'].style.display = 'none';
	document.all['contentsum'].style.display = 'none';
	document.all['bestall'].style.display = 'none';
	

}

function resetDoc(){

document.all['content'].innerHTML = '<b>Your order:</b><br><br>'
document.all['content'].style.display = 'none';
document.all['contentsum'].style.display = 'none';
document.all['bestall'].style.display = 'none';
document.all['sum'].value = '0';

}

function checkOrder(){


	if (document.frmSend.realname.value == ""){
		alert('Please enter your name!');
					
		document.frmSend.realname.select();
		document.frmSend.realname.focus();
		return false;
	}

	if (document.frmSend.email.value == ""){
		alert('Please enter your emailaddress!');
					
		document.frmSend.email.select();
		document.frmSend.email.focus();
		return false;
		
	} else {

		if (kollaEmail(document.frmSend.email) == false) {
			
			document.frmSend.email.select();
			document.frmSend.email.focus();
			return false;
		}		
	}
	
	if (document.frmSend.Meddelande.value == ""){
		alert('Please enter your address!');
					
		document.frmSend.Meddelande.select();
		document.frmSend.Meddelande.focus();
		return false;
	}

	document.frmSend.Meddelande.value = document.all['yourorder'].innerText + '\n\n' + document.frmSend.Meddelande.value;
}


function checkGB(){


	if (document.frmGuestbook.realname.value == ""){
		alert('Please enter your name!');
					
		document.frmGuestbook.realname.select();
		document.frmGuestbook.realname.focus();
		return false;
	}

	if (document.frmGuestbook.username.value == ""){
		alert('Please enter your emailaddress!');
					
		document.frmGuestbook.username.select();
		document.frmGuestbook.username.focus();
		return false;
		
	} else {

		if (kollaEmail(document.frmGuestbook.username) == false) {
			
			document.frmGuestbook.username.select();
			document.frmGuestbook.username.focus();
			return false;
		}		
	}
	
	if (document.frmGuestbook.comments.value == ""){
		alert('Please enter some text!');
					
		document.frmGuestbook.comments.select();
		document.frmGuestbook.comments.focus();
		return false;
	}
}


function lib_bwcheck(){ 
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie7=(this.ver.indexOf("MSIE 7")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6||this.ie7
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie7 || this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
var bw=new lib_bwcheck()


var numScrollPages = 1 
var transitionOut = 1;    
var transitionIn = 2;          
var slideAcceleration = 0.2;  
var transitionOnload = 1       

var px = bw.ns4||window.opera?"":"px";

if(document.layers){ 
	scrX= innerWidth; scrY= innerHeight;
	onresize= function(){if(scrX!= innerWidth || scrY!= innerHeight){history.go(0)} }
}


function scrollerobj(obj,nest){
	nest = (!nest)?"":'document.'+nest+'.'
	this.elm = bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):document.getElementById(obj)
	this.css = bw.ns4?this.elm:this.elm.style
	this.doc = bw.ns4?this.elm.document:document
	this.obj = obj+'scrollerobj'; eval(this.obj+'=this')
	this.x = (bw.ns4||bw.opera5)?this.css.left:this.elm.offsetLeft
	this.y = (bw.ns4||bw.opera5)?this.css.top:this.elm.offsetTop
	this.w = (bw.ie4||bw.ie5||bw.ie6||bw.ie7||bw.ns6)?this.elm.offsetWidth:bw.ns4?this.elm.clip.width:bw.opera5?this.css.pixelWidth:0
	this.h = (bw.ie4||bw.ie5||bw.ie6||bw.ie7||bw.ns6)?this.elm.offsetHeight:bw.ns4?this.elm.clip.height:bw.opera5?this.css.pixelHeight:0
}


scrollerobj.prototype.moveTo = function(x,y){
	if(x!=null){this.x=x; this.css.left=x+px}
	if(y!=null){this.y=y; this.css.top=y+px}
}
scrollerobj.prototype.moveBy = function(x,y){this.moveTo(this.x+x,this.y+y)}
scrollerobj.prototype.hideIt = function(){this.css.visibility='hidden'}
scrollerobj.prototype.showIt = function(){this.css.visibility='visible'}


var scrollTimer = null;
function scroll(step){
	clearTimeout(scrollTimer);
	if ( !busy && (step<0&&activePage.y+activePage.h>scroller1.h || step>0&&activePage.y<0) ){
		activePage.moveBy(0,step);
		scrollTimer = setTimeout('scroll('+step+')',40);
	}
}
function stopScroll(){
	clearTimeout(scrollTimer);
}


var activePage = null;
var busy = 0;
function activate(num){
	if (activePage!=pages[num] && !busy){
		busy = 1;
		if (transitionOut==0 || !bw.opacity){ activePage.hideIt(); activateContinue(num); }
		else if (transitionOut==1) activePage.blend('hidden', 'activateContinue('+num+')');
	}
}
function activateContinue(num){
	busy = 1;
	activePage = pages[num];
	activePage.moveTo(0,0);
	if (transitionIn==0 || !bw.opacity){ activePage.showIt(); busy=0; }
	else if (transitionIn==1) activePage.blend('visible', 'busy=0');
	else if (transitionIn==2) activePage.slide(0, slideAcceleration, 40, 'busy=0');

}



scrollerobj.prototype.slide = function(target, acceleration, time, fn){
	this.slideFn= fn?fn:null;
	this.moveTo(0,scroller1.h);
	if (bw.ie4&&!bw.mac) this.css.filter = 'alpha(opacity=100)';
	if (bw.ns6) this.css.MozOpacity = 1;
	this.showIt();
	this.doSlide(target, acceleration, time);
}
scrollerobj.prototype.doSlide = function(target, acceleration, time){
	this.step = Math.round(this.y*acceleration);
	if (this.step<1) this.step = 1;
	if (this.step>this.y) this.step = this.y;
	this.moveBy(0, -this.step);
	if (this.y>0) this.slideTim = setTimeout(this.obj+'.doSlide('+target+','+acceleration+','+time+')', time);
	else {	
		eval(this.slideFn);
		this.slideFn = null;
	}
}



scrollerobj.prototype.blend= function(vis, fn){
	if (bw.ie5||bw.ie6||bw.ie7 && !bw.mac) {
		if (vis=='visible') this.css.filter= 'blendTrans(duration=0.9)';
		else this.css.filter= 'blendTrans(duration=0.6)';
		this.elm.onfilterchange = function(){ eval(fn); };
		this.elm.filters.blendTrans.apply();
		this.css.visibility= vis;
		this.elm.filters.blendTrans.play();
	}
	else if (bw.ns6 || bw.ie&&!bw.mac){
		this.css.visibility= 'visible';
		vis=='visible' ? this.fadeTo(100, 7, 40, fn) : this.fadeTo(0, 9, 40, fn);
	}
	else {
		this.css.visibility= vis;
		eval(fn);
	}
};

scrollerobj.prototype.op= 100;
scrollerobj.prototype.opacityTim= null;
scrollerobj.prototype.setOpacity= function(num){
	this.css.filter= 'alpha(opacity='+num+')';
	this.css.MozOpacity= num/100;
	this.op= num;
}
scrollerobj.prototype.fadeTo= function(target, step, time, fn){
	clearTimeout(this.opacityTim);
	this.opacityFn= fn?fn:null;
	this.op = target==100 ? 0 : 100;
	this.fade(target, step, time);
}
scrollerobj.prototype.fade= function(target, step, time){
	if (Math.abs(target-this.op)>step){
		target>this.op? this.setOpacity(this.op+step):this.setOpacity(this.op-step);
		this.opacityTim= setTimeout(this.obj+'.fade('+target+','+step+','+time+')', time);
	}
	else {
		this.setOpacity(target);
		eval(this.opacityFn);
		this.opacityFn= null;
	}
}


var pageslidefadeLoaded = 0;
function initPageSlideFade(){
	scroller1 = new scrollerobj('divScroller1');
	
	pages = new Array();
	for (var i=0; i<numScrollPages; i++){
		pages[i] = new scrollerobj('dynPage'+i, 'divScroller1');
		pages[i].moveTo(0,0);
	}
	bw.opacity = ( bw.ie && !bw.ie4 && navigator.userAgent.indexOf('Windows')>-1 ) || bw.ns6
	if (bw.ie5||bw.ie6||bw.ie7 && !bw.mac) pages[0].css.filter= 'blendTrans(duration=0.6)'; // Preloads the windows filters.
	
	if (transitionOnload) activateContinue(0);
	else{
		activePage = pages[0];
		activePage.showIt();
	}

	if (bw.ie) for(var i=0;i<document.links.length;i++) document.links[i].onfocus=document.links[i].blur;
	pageslidefadeLoaded = 1;
	

}

function getMenu(strId) {
	
	switch (strId) {
	
	   case 'club' :
			document.imgClub.src		= 'images/menu_club_aktiv.gif';
			//document.imgEvent.src		= 'images/menu_event.gif';
			document.imgGallery.src		= 'images/menu_gallery.gif';
			document.imgGuestbook.src	= 'images/menu_guestbook.gif';
			document.imgLinks.src		= 'images/menu_links.gif';
			document.imgClubshop.src		= 'images/menu_clubshop.gif';
			document.imgEmail.src		= 'images/menu_email.gif';
			document.imgHome.src		= 'images/menu_home.gif';
			document.imgMembers.src		= 'images/menu_members.gif';
			break;
	   case 'event' :
			document.imgClub.src		= 'images/menu_club.gif';
			//document.imgEvent.src		= 'images/menu_event_aktiv.gif';
			document.imgGallery.src		= 'images/menu_gallery.gif';
			document.imgGuestbook.src	= 'images/menu_guestbook.gif';
			document.imgLinks.src		= 'images/menu_links.gif';
			document.imgClubshop.src		= 'images/menu_clubshop.gif';
			document.imgEmail.src		= 'images/menu_email.gif';
			document.imgHome.src		= 'images/menu_home.gif';
			document.imgMembers.src		= 'images/menu_members.gif';
			break;
	   case 'gallery' :
			document.imgClub.src		= 'images/menu_club.gif';
			//document.imgEvent.src		= 'images/menu_event.gif';
			document.imgGallery.src		= 'images/menu_gallery_aktiv.gif';
			document.imgGuestbook.src	= 'images/menu_guestbook.gif';
			document.imgLinks.src		= 'images/menu_links.gif';
			document.imgClubshop.src		= 'images/menu_clubshop.gif';
			document.imgEmail.src		= 'images/menu_email.gif';
			document.imgHome.src		= 'images/menu_home.gif';
			document.imgMembers.src		= 'images/menu_members.gif';
			break;	  
	   case 'guestbook' :
			document.imgClub.src		= 'images/menu_club.gif';
			//document.imgEvent.src		= 'images/menu_event.gif';
			document.imgGallery.src		= 'images/menu_gallery.gif';
			document.imgGuestbook.src	= 'images/menu_guestbook_aktiv.gif';
			document.imgLinks.src		= 'images/menu_links.gif';
			document.imgClubshop.src		= 'images/menu_clubshop.gif';
			document.imgEmail.src		= 'images/menu_email.gif';
			document.imgHome.src		= 'images/menu_home.gif';
			document.imgMembers.src		= 'images/menu_members.gif';
			break;	  		
	   case 'links' :
			document.imgClub.src		= 'images/menu_club.gif';
			//document.imgEvent.src		= 'images/menu_event.gif';
			document.imgGallery.src		= 'images/menu_gallery.gif';
			document.imgGuestbook.src	= 'images/menu_guestbook.gif';
			document.imgLinks.src		= 'images/menu_links_aktiv.gif';
			document.imgClubshop.src		= 'images/menu_clubshop.gif';
			document.imgEmail.src		= 'images/menu_email.gif';
			document.imgHome.src		= 'images/menu_home.gif';
			document.imgMembers.src		= 'images/menu_members.gif';
			break;	  				
	   case 'clubshop' :
			document.imgClub.src		= 'images/menu_club.gif';
			//document.imgEvent.src		= 'images/menu_event.gif';
			document.imgGallery.src		= 'images/menu_gallery.gif';
			document.imgGuestbook.src	= 'images/menu_guestbook.gif';
			document.imgLinks.src		= 'images/menu_links.gif';
			document.imgClubshop.src		= 'images/menu_clubshop_aktiv.gif';
			document.imgEmail.src		= 'images/menu_email.gif';
			document.imgHome.src		= 'images/menu_home.gif';
			document.imgMembers.src		= 'images/menu_members.gif';
			break;	  				
	   case 'email' :
			document.imgClub.src		= 'images/menu_club.gif';
			//document.imgEvent.src		= 'images/menu_event.gif';
			document.imgGallery.src		= 'images/menu_gallery.gif';
			document.imgGuestbook.src	= 'images/menu_guestbook.gif';
			document.imgLinks.src		= 'images/menu_links.gif';
			document.imgClubshop.src		= 'images/menu_clubshop.gif';
			document.imgEmail.src		= 'images/menu_email_aktiv.gif';
			document.imgHome.src		= 'images/menu_home.gif';
			document.imgMembers.src		= 'images/menu_members.gif';
			break;	  				
	   case 'home' :
			document.imgClub.src		= 'images/menu_club_aktiv.gif';
			//document.imgEvent.src		= 'images/menu_event_aktiv.gif';
			document.imgGallery.src		= 'images/menu_gallery_aktiv.gif';
			document.imgGuestbook.src	= 'images/menu_guestbook_aktiv.gif';
			document.imgLinks.src		= 'images/menu_links_aktiv.gif';
			document.imgClubshop.src		= 'images/menu_clubshop_aktiv.gif';
			document.imgEmail.src		= 'images/menu_email_aktiv.gif';
			document.imgHome.src		= 'images/menu_home_aktiv.gif';
			document.imgMembers.src		= 'images/menu_members_aktiv.gif';
			break;	  				

	   case 'members' :
			document.imgClub.src		= 'images/menu_club.gif';
			//document.imgEvent.src		= 'images/menu_event.gif';
			document.imgGallery.src		= 'images/menu_gallery.gif';
			document.imgGuestbook.src	= 'images/menu_guestbook.gif';
			document.imgLinks.src		= 'images/menu_links.gif';
			document.imgClubshop.src		= 'images/menu_clubshop.gif';
			document.imgEmail.src		= 'images/menu_email.gif';
			document.imgHome.src		= 'images/menu_home.gif';
			document.imgMembers.src		= 'images/menu_members_aktiv.gif';
			break;	  				
		
		default :
			document.imgClub.src		= 'images/menu_club_aktiv.gif';
			//document.imgEvent.src		= 'images/menu_event_aktiv.gif';
			document.imgGallery.src		= 'images/menu_gallery_aktiv.gif';
			document.imgGuestbook.src	= 'images/menu_guestbook_aktiv.gif';
			document.imgLinks.src		= 'images/menu_links_aktiv.gif';
			document.imgClubshop.src		= 'images/menu_clubshop_aktiv.gif';
			document.imgEmail.src		= 'images/menu_email_aktiv.gif';
			document.imgHome.src		= 'images/menu_home_aktiv.gif';
			document.imgMembers.src		= 'images/menu_members_aktiv.gif';
	  
	  }

}


function checkSubmit(){

	if (document.frmSend.subject.value == ""){
		alert('Please enter som text for the subject!');
					
		document.frmSend.subject.select();
		document.frmSend.subject.focus();
		return false;
	}

	if (document.frmSend.realname.value == ""){
		alert('Please enter your name!');
					
		document.frmSend.realname.select();
		document.frmSend.realname.focus();
		return false;
	}

	if (document.frmSend.email.value == ""){
		alert('Please enter your emailaddress!');
					
		document.frmSend.email.select();
		document.frmSend.email.focus();
		return false;
		
	} else {

		if (kollaEmail(document.frmSend.email) == false) {
			
			document.frmSend.email.select();
			document.frmSend.email.focus();
			return false;
		}		
	}
	
	if (document.frmSend.Meddelande.value == ""){
		alert('Please enter some text!');
					
		document.frmSend.Meddelande.select();
		document.frmSend.Meddelande.focus();
		return false;
	}

}


 function kollaEmail(email)
	{ 
	
		b = email.value.substring(0,1)
		
		if (b == '@')
		{
			alert("Invalid emailaddress!")
			return false;
		}
		
		if ((email.value.indexOf("@") == -1) || (email.value.indexOf(".") == -1))
		{
			alert("Invalid emailaddress!")
			return false;
		}
		
		c = email.value.indexOf("@")
		d = email.value.indexOf(".");
		e = email.value.substring(c,d);
		
		if (e.length < 2)
		{
			alert("Invalid emailaddress!")
			return false;
		}
				
		b = email.value.indexOf(".")
		var emaildots = email.value.substring(b,email.value.length);
		
		if (emaildots.length <2)
		{
			alert("Invalid emailaddress!")
			return false;
		}	
}


function showImage(sImg, intWidth, intHeight, intTop) {
	var sNewImg = sImg;
	document.images.imgLarge.src = sNewImg;
	document.images.imgLarge.height = intHeight;
	document.images.imgLarge.width = intWidth;

	document.all.dvImageDisplay.style.visibility = "visible";
	document.all.dvImageDisplay.style.top = intTop;

}

function hideImage() {
	document.images.imgLarge.src = "../images/blank.gif";
	document.all.dvImageDisplay.style.visibility = "hidden";
}


