// JavaScript Document

//Ladda sida o frameset
function detect()
{
framesetpage="index.html";
thispage=window.location.href;
if (thispage.indexOf('://')<0) {thispage="://"+thispage;};
prefix=thispage.substring(0,thispage.lastIndexOf('://'));
suffix=thispage.substring(thispage.lastIndexOf('://')+3,thispage.length);
// alert('the subpage is:['+prefix+']['+suffix+']');
if (parent.location.href==window.location.href) {parent.location.href=framesetpage+"?"+prefix+"&&&"+suffix};
}

<!-- FLASHCHECK -->

var fc_2 = false;
var fc_3 = false;
var fc_4 = false;
var fc_5 = false;
var fc_6 = false;
var fc_7 = false;

var fc_highestVersion = 0;

function detectFlash() { 

	var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
	var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;

	if(isIE && isWin){
		document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
		document.write('on error resume next \n');
		document.write('fc_2 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
		document.write('fc_3 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
		document.write('fc_4 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
		document.write('fc_5 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');
		document.write('fc_6 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');
		document.write('fc_7 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
		document.write('</SCR' + 'IPT\> \n');
	}
	
	if (navigator.plugins) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
			var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
			fc_2 = flashVersion == 2;
			fc_3 = flashVersion == 3;
			fc_4 = flashVersion == 4;
			fc_5 = flashVersion == 5;
			fc_6 = flashVersion == 6;
			fc_7 = flashVersion >= 7;
		}
	}

	for (var i = 2; i <= 7; i++) { 
		if (eval("fc_" + i) == true) 
			fc_highestVersion = i;
	}
	
}

detectFlash();

// -->

<!--

// -------------------------------------------------------------------------------------------------

// DETECT FLASH Variables

var fc_2 = false;
var fc_3 = false;
var fc_4 = false;
var fc_5 = false;
var fc_6 = false;
var fc_7 = false;

var fc_highestVersion = 0;

// -------------------------------------------------------------------------------------------------

// DETECT FLASH

function detectFlash() { 

	var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
	var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;

	if(isIE && isWin){
		document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
		document.write('on error resume next \n');
		document.write('fc_2 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
		document.write('fc_3 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
		document.write('fc_4 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
		document.write('fc_5 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');
		document.write('fc_6 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');
		document.write('fc_7 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
		document.write('</SCR' + 'IPT\> \n');
	}
	
	if (navigator.plugins) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
			var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
			fc_2 = flashVersion == 2;
			fc_3 = flashVersion == 3;
			fc_4 = flashVersion == 4;
			fc_5 = flashVersion == 5;
			fc_6 = flashVersion == 6;
			fc_7 = flashVersion >= 7;
		}
	}

	for (var i = 2; i <= 7; i++) { 
		if (eval("fc_" + i) == true) 
			fc_highestVersion = i;
	}
	
}

detectFlash();

// -------------------------------------------------------------------------------------------------

// EMBED FLASH

function embedFlash(i, f, w, h, c, fv) {
	var embedCode_flash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
	+ 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab"'
	+ 'width="'+w+'" height="'+h+'"'
	+ 'id="'+i+'">'
	+ '<param name="movie" value="'+f+'">'
	+ '<param name="quality" value="high">'
	+ '<param name="menu" value="false">'
	+ '<param name="bgcolor" value="'+c+'">'
	+ '<param name=flashvars value="'+fv+'">'
	+ '<param name="loop" value="false">'
	+ '<embed src="'+f+'"'
	+ 'menu="false"'
    + 'loop="false"'
	+ 'quality="high"'
	+ 'bgcolor="'+c+'"'
	+ 'width="'+w+'" height="'+h+'"'
	+ 'name="'+i+'"'
	+ 'type="application/x-shockwave-flash"'
	+ 'flashvars="'+fv+'"'
	+ 'pluginspage="http://www.macromedia.com/go/getflashplayer">'
	+ '</embed>'
	+ '</object>';
	document.write(embedCode_flash);
}

// -------------------------------------------------------------------------------------------------
// -->

// End -->

// *** Change this variable ***
// should be the URL to the cgi script
var path_to_cgi="http://www.stockholmsforetagskrogar.se/cgi-bin/tipsa.cgi";

// You dont need to change anything else
function tipsa(){
path_to_cgi += '?url=' + escape(document.location);
window.open(path_to_cgi,"Tell","toolbars=0,scrollbars=0,location=0,statusbars=0,menubars=0,resizable=0,top=0,left=0,width=290,height=300");
}

//Öppna fönster
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->

//Blockera eventuella fel
<!--
function blockError(){return true;}
window.onerror = blockError;
//-->

//Rollover
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->

// ----------------------------------------------
// Byta stilmall
// ----------------------------------------------

function setActiveStyleSheet(title, reset) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
  if (reset == 1) {
	  createCookie("SFK_Textstorlek", title, 365);
  }
}

function setStyle() {
	var style = readCookie("SFK_Textstorlek");
	if (style != null) {
		setActiveStyleSheet(style, 0);
	}
}


// ----------------------------------------------
// Cookie-funktion
// ----------------------------------------------

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = ";expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+";domain=.stockholmsforetagskrogar.se;path=/;";
  document.cookie = name+"="+value+expires+";domain=.foretagskrogar.se;path=/;";
}

// ----------------------------------------------

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}
