function CheckFrames(strURL) {
			//strURL mallia 'http://combog2/index.asp?id=8C6346B6DFC14F659463A4A821FA8CA0&data=1,URL,
			
			if (window == top) 
			{
				if (document.images)
				{
			    	if (document.layers)
					{
						var agt = navigator.userAgent.toLowerCase(); 
						if ((self.innerHeight != 0 && self.innerWidth != 0) && agt.indexOf('mozilla') != -1)
						{
							top.location.replace(strURL +'&data=1,URL,'+ window.location.href);
						}
					}	
					else
					{
						top.location.replace(strURL +'&data=1,URL,'+ window.location.href);
					}
				}	
				else
				{
					top.location.href = strURL +'&data=1,URL,'+ window.location.href;
				}	
			}
		}
		

function OpenImage(strURL) {
	window.open(strURL,'','width=450px,height=350px,status=no,location=no,toolbar=yes,resizable=yes');
}



// pajarmik  navipolku 2.0 
function CheckNavipathActions(resourceId)
{
	if (window!=top && this.name=='data_1') 
	{
			if (window.top.func_dataframe_commander)
				{
					window.top.func_dataframe_commander(resourceId)	
				}
	}
}

//Stylesheetin vaihto scriptit
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("rel").indexOf("alter")!=-1)) {
     a.disabled = true;
     
      if(a.getAttribute("title") == title) {
		
		a.disabled = false;
	  }
    }
  }
  if (reset == 1) {
	  
	  createCookie("wstyle", title, 365);
  }
}

function setStyle() {
	var style = readCookie("wstyle");
	
	if (style != null) {
		setActiveStyleSheet(style, 0);
	}
}


function popChild(url, width, height, winName) {
  var features = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=" + width + ",height=" + height;
  if (winName == "") {
  	winName = "childWin";
  }
  SmallWin = window.open(url,winName,features);
  if (window.focus) {
    SmallWin.focus();
  }
}

// ----------------------------------------------

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 = "c_" + name+"="+value+expires+";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;
}

// ----------- PRINT TOIMINNALLISUUS ---------------- //

// made by Mika Pajarinen 

var px_top = 1;
var px_left = 1;
var int_setTimeoutId = 0;


function handleDiv(path,obj,html, top, left, visib)
{
	var txt= '', style = '';

		if (document.layers)
		{
			txt= path+ 'document.layers["' + obj + '"]';
			dom = 	eval(txt);
			if (dom)
			{
				if (top!=-1)
					{
						dom.top = top;
					}	
				if (left!=-1)
					{
						dom.left = left;
					}
				if (html)	
				{
			 		dom.document.open()
					dom.document.write(html);
					dom.document.close();
				}	
				if (visib!=-1)	
				{	
					style=visib ? 'visible': 'hidden'; 
					dom.visibility= style;
				}	
				
				
				dom = null;
			}	
			
		}
		else if (document.all)
		{
				 
			 txt= path+ 'document.all.' + obj;
			 dom = 	eval(txt);

			 if (dom)
			 {
			 
			 	if (top!=-1)
					{
						dom.style.pixelTop = top;
					}	
				if (left!=-1)
					{
						dom.style.pixelLeft= left;
					}
			 	
				if (html)	
				{	
			 		dom.innerHTML= html;
				}	
				
				if (visib!=-1)	
				{	
					style=visib ? 'visible': 'hidden';
			 		dom.style.visibility= style;
				}	
				
				
				dom = null;
			 }	
		}	
		else  
		{
			 txt= path+ 'document.getElementById("' + obj + '")';
			 dom = 	eval(txt);
			
			 if (dom)
			 {
			 		
			 	if (top!=-1)
					{
						dom.style.top= top;
					}	
				if (left!=-1)
					{
						dom.style.left= left;
					}
				if (html)	
				{	
			 		dom.innerHTML= html;
				}	
				
				if (visib!=-1)	
				{	
					style=visib ? 'visible': 'hidden';
					dom.style.visibility= style;
				}	
				
				dom = null;
			}	
			 
		}	
		
}		



function setPosition()
{
		var top
		if (document.layers)
		{
			//
		}
		else if (document.all)
		{
			px_top = document.body.scrollTop + 10;				 
			px_left = document.body.clientWidth -250 -25 ;
		}	
		else  
		{
			//
		}

}

function initPrint()	
{
	setPosition();
	handleDiv('','printdv','', px_top, px_left, 1);
	int_setTimeoutId  = setTimeout('initPrint();',250);
}

function window_print()
{
	if (int_setTimeoutId)  clearTimeout(int_setTimeoutId);	
	handleDiv('','printdv','', -1, -1, 0);
	window.print();
	int_setTimeoutId  = setTimeout('initPrint();',250);
	
}

	
function preparePrints()
{
	document.write('<div  id ="printdv" class="printdvStyle">\
	<table border="1" cellpadding="0" cellspacing="0" width="250">\
		<tr><td bgcolor="black">\
		<table border="0" cellpadding="4" cellspacing="1" width="100%">\
			<tr><td bgcolor="white" style="padding-left: 4px;padding-right: 4px;">	\
				<nobr><img hspace="2" src="/layout/iines/images/arrow_back.gif"><a href="javascript:this.close();">Sulje tulostusikkuna</a><img width="50" height="5" src="/layout/iines/images/blank.gif"><img hspace="2" src="/layout/iines/images/arrow_print.gif"><a href="javascript:window_print();">Tulosta</a></nobr>\
			</td></tr>\
		</table>\
	</td></tr>\
	</table>\
	</div>');
  int_setTimeoutId = setTimeout('initPrint();',500);  
}

var objLstPopup = null;


function openPrintPopup(type, id)
{ 

	//objLstPopup =  window.open("/modules/page/printpage.asp?id=" +id + createHttpBlockPatameter(), "printpopNovo", "status=no,toolbar=no,resizable=yes,menubar=no,scrollbars=yes,location=no,width=750, height=500");
	//objLstPopup =  window.open("/modules/page/printpage.asp?id=" +id + createHttpBlockPatameter(), "printpopNovo", "status=no,toolbar=no,resizable=yes,menubar=no,scrollbars=yes,location=no,width=750, height=500");
	objLstPopup =  window.open(((type=='page')?"/modules/page/printpage.asp": ((type=='release')?"/modules/release/printrelease.asp":"/modules/news/printnews.asp")) + "?id=" +id + createHttpBlockPatameter(), "printpopNovo", "status=no,toolbar=no,resizable=yes,menubar=no,scrollbars=yes,location=no,width=750, height=500");
	objLstPopup.focus();

	
	
 
}


function drawPrintLink(type, id, txt)
{
document.write('<a href="javascript: void(0);" onclick="openPrintPopup(\''+type+'\',\''+id+'\');">'+txt+'</a>');

}

function createHttpBlockPatameter()
{
	var td = new Date(); 
	var str = '&asappi' + td.getSeconds() + '=';
	str+= td.getYear() + '_';
	str+= td.getMonth() + '_';
	str+= td.getDate() + '_';
	str+= td.getHours() + '_';
	str+= td.getMinutes() + '_';
	str+= td.getSeconds();
	td = null;
	return str;
}


// ====================================================================

function drawBacklink(txt)
{
document.write('<a href="javascript:history.back();">Takaisin</a>');

}

// ----------- PRINT TOIMINNALLISUUS ---------------- //