// JavaScript Document
function checkcookie(){
	var allcookies = document.cookie;
	var pos = allcookies.indexOf("fiskaren");
	if( pos!=-1){
	var cookie_ID = "true";
	}else {
	document.cookie = "fiskaren=" + document.lastModified + "; max-age=" +(60*60*24);
	var cookie_ID = "false";
	};
	var sat12 = 1161467978796;
	d = new Date();
	//if(d.getTime()>=sat12){ 
	//var cookie_ID = "true";
	//};
	return cookie_ID;
	
	
};
  function eStreamPopup(strUrl) 
  { 
  	var uWidth = 800; 
	var uHeight = 470; 
	var strTitle = 'Webcast'; popupWin = window.open(strUrl, strTitle,'toolbar=no,marginwidth=0, marginheight=0,location=no,directories=no,status=no,resizable=yes,scrollbar=no,width=' + uWidth + ',height=' + uHeight); 
	popupWin.focus(); 
	}
function QueryString(key)
{
	var value = null;
	for (var i=0;i<QueryString.keys.length;i++)
	{
		if (QueryString.keys[i]==key)
		{
			value = QueryString.values[i];
			break;
		};
	};
	return value;
};
QueryString.keys = new Array();
QueryString.values = new Array();

function QueryString_Parse()
{
	var query = window.location.search.substring(1);
	var pairs = query.split("&");
	
	for (var i=0;i<pairs.length;i++)
	{
		var pos = pairs[i].indexOf('=');
		if (pos >= 0)
		{
			var argname = pairs[i].substring(0,pos);
			var value = pairs[i].substring(pos+1);
			QueryString.keys[QueryString.keys.length] = argname;
			QueryString.values[QueryString.values.length] = value;		
		};
	};

};
QueryString_Parse();

// write flash obj with query string
function placeWebTV() {
	// appearance vars, these can be customized to your liking
	var width = '930';
	var height = '623';
	var src = 'http://www.smartcom.no/yara/ny/yara.swf';
	var randomNumber= Math.floor(Math.random()*100)+""
	// queries -- type in the variables you want to send to flash here
	if(QueryString('flid')!=null){
	var queries = '?flid='+QueryString('flid')+'&cookie='+checkcookie()+'&location1='+window.location+'&randomnumber='+randomNumber;
 }else{var queries = '?cookie='+checkcookie()+'&location1='+window.location+'&randomnumber='+randomNumber;};
	// assemble flash obj
	var l1 = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+width+'" height="'+height+'">';
	var l2 = '<param name="movie" value="'+src+queries+'" />';
	var l3 = '<param name="quality" value="high" /><param name="wmode" value="opaque"/>';
	var l4 = '<embed src="'+src+queries+'" quality="high" wmode="opaque" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed>';
	var l5 = '</object>';
	
	// write all lines
	document.write(l1+l2+l3+l4+l5);
	theObjects = document.getElementsByTagName("object");
for (var i = 0; i < theObjects.length; i++) {
theObjects[i].outerHTML = theObjects[i].outerHTML;
}

};

function placeInternalWebTV() {
	// appearance vars, these can be customized to your liking
	var width = '930';
	var height = '623';
	var src = 'http://www.smartcom.no/yara/ny/yaraintern.swf';
	var randomNumber= Math.floor(Math.random()*100)+""
	// queries -- type in the variables you want to send to flash here
	if(QueryString('flid')!=null){
	var queries = '?flid='+QueryString('flid')+'&cookie='+checkcookie()+'&location1='+window.location+'&randomnumber='+randomNumber;
 }else{var queries = '?cookie='+checkcookie()+'&location1='+window.location+'&randomnumber='+randomNumber;};
	// assemble flash obj
	var l1 = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+width+'" height="'+height+'">';
	var l2 = '<param name="movie" value="'+src+queries+'" />';
	var l3 = '<param name="quality" value="high" /><param name="wmode" value="opaque"/>';
	var l4 = '<embed src="'+src+queries+'" wmode="opaque" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed>';
	var l5 = '</object>';
	
	// write all lines
	document.write(l1+l2+l3+l4+l5);
	theObjects = document.getElementsByTagName("object");
for (var i = 0; i < theObjects.length; i++) {
theObjects[i].outerHTML = theObjects[i].outerHTML;
}

};
function placeClosedWebTV() {
	// appearance vars, these can be customized to your liking
	var width = '930';
	var height = '623';
	var src = 'http://www.smartcom.no/yara/ny/yaraintern.swf';
	var randomNumber= Math.floor(Math.random()*100)+""
	// queries -- type in the variables you want to send to flash here
	if(QueryString('flid')!=null){
	var queries = '?flid='+QueryString('flid')+'&cookie='+checkcookie()+'&location1='+window.location+'&randomnumber='+randomNumber;
 }else{var queries = '?cookie='+checkcookie()+'&location1='+window.location+'&randomnumber='+randomNumber;};
	// assemble flash obj
	var l1 = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+width+'" height="'+height+'">';
	var l2 = '<param name="movie" value="'+src+queries+'" />';
	var l3 = '<param name="quality" value="high" /><param name="wmode" value="opaque"/>';
	var l4 = '<embed src="'+src+queries+'" quality="high" wmode="opaque" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed>';
	var l5 = '</object>';
	
	// write all lines
	document.write(l1+l2+l3+l4+l5);
	theObjects = document.getElementsByTagName("object");
for (var i = 0; i < theObjects.length; i++) {
theObjects[i].outerHTML = theObjects[i].outerHTML;
}

};
