function indexdetect(){
	defaultrgtpage="main.html";
	if (location.search) {subpage=location.search.substring(1)}
	else {subpage=defaultrgtpage}
	if (subpage.indexOf('&&&')>=0) {
		prefix=subpage.substring(0,subpage.indexOf('&&&'))+"://";
		suffix=subpage.substring(subpage.indexOf('&&&')+3,subpage.length);
		subpage=prefix+suffix;
	}
}

function detect(){
	framesetpage="http://www.fia.se/index.html";
	thispage=window.location.href;
	if (thispage.indexOf('://')<0) {thispage="://"+thispage;};
	subprefix=thispage.substring(0,thispage.lastIndexOf('://'));
	subsuffix=thispage.substring(thispage.lastIndexOf('://')+3,thispage.length);
	if (parent.location.href==window.location.href) {parent.location.href=framesetpage+"?"+subprefix+"&&&"+subsuffix};
}

function scrollp(text,speed,bothHeight){
	scrollp.init=function(){
		document.write('<div id="scrollp" style="position:relative;width:100%;height:100%;overflow:hidden;border:0;margin:-5px;">');
		document.write('<div id="box" style="position:absolute;color:white;white-space:nowrap;"><table border="0" cellpadding="0" cellspacing="0"><tr><td style="white-space:nowrap;" id="1st"></td></tr><tr><td style="white-space:nowrap;" id="2nd"></td></tr></table></div>');
		document.write('</div>');
		document.getElementById("1st").innerHTML=text; document.getElementById("2nd").innerHTML=text;
		scrollpYpos=0-bothHeight;
		document.getElementById("box").style.left=parseInt(10);
	}
	scrollp.scroll=function(){
		scrollpYpos+=speed;
		if(scrollpYpos>0){ scrollpYpos-=bothHeight/2 }
		document.getElementById("box").style.top=parseInt(scrollpYpos);
	}
}

function updated(){
	var mod = new Date(document.lastModified);
	var months = new Array("januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december");
	var year = mod.getYear();
	if (year < 100){ year += 2000 }
	if (year < 1000){ year += 1900 }
	document.write("Sidan uppdaterad " + mod.getDate() + " " + months[mod.getMonth()] + " " + year);
}

function gfxpop(url){
	var loader=new Image();
	var top=parseInt(screen.height/2-50);
	var left=parseInt(screen.width/2-50);

	var loadwindow=window.open("","","scrollbars=no,resizable=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,width=100,height=100,top="+top+",left="+left);
	with(loadwindow.document){
		open();
		write("<html><head><title>Laddar...</title></head><body marginwidth=0 marginheight=0 leftmargin=0 topmargin=0 rightmargin=0 style=\"overflow:hidden;background-color:black;color:white;\">");
		write("Laddar...");
		write("</body></html>");
		close();
	}
	loader.onload=function(){
		var top=parseInt(screen.height/2-this.height/2);
		var left=parseInt(screen.width/2-this.width/2);
		loadwindow.close();
	gfxwindow=window.open("","","scrollbars=no,resizable=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,width="+this.width+",height="+this.height+",top="+top+",left="+left);
		with(gfxwindow.document){
			open();
			write("<html><head><title>FIA</title></head><body marginwidth=0 marginheight=0 leftmargin=0 topmargin=0 rightmargin=0 style=\"overflow:hidden;\">");
			write("<img id='gfx' src=\""+url+"\">");
			write("</body></html>");
			close();
		}

	}
	loader.src=url;

	onmousemove=function(){ gfxwindow.close(); }
}