// ----------------------------------------------
// BASIC JavaScript FOR IPORTAL ver 4.25+ SOFTWARE  
// 1994 - 1999 Copyright by Sidus Computers Ltd
// 1999 - 2000 Copyright by Sidus Web Service Ltd
// 2000 - 2006 Copyright by e-Finland Network Ltd
// More information: webmaster@e-finland.org
// THIS FILE INCLUDE:
// - StyleSwitcher
// - SET FOT SIZE
// - DHTML tip message
// - form validation
// - keyalert
// =====================================================================
var folderPic = "http://www.e-finland.fi/iportal/pic/"; 
// =====================================================================
function alert(txt) {
	if (txt > ' ') window.alert(txt);
}
function confirm(txt) {
	if (txt > ' ') confirm(txt);
}
function source(url) {
    location="view-source:"+url;
}
function openWindow(url,name,features) {
  window.open(url,name,features);
}
function open_window(url,name,width,height,left,top) {  
    if (!width)  { width = 795;}
	if (!height) { height = 525;}
	window.open(url,name,"resizable=yes,toolbar=0,location=1,menubar=0,directories=0,scrollbars=1,status=1,width=" + width + ",height=" + height + ",left=" + left + ",top=" + top);
}
function openPopup(url, name, width, h, scroll) {
	var winl = (screen.width - width) / 2;
	var wint = (screen.height - height) / 2;
	winprops = "height="+height+",width="+width+",top="+wint+",left="+winl+",scrollbars="+scroll+",resizable=yes,toolbar=0,location=0,menubar=0,directories=0,status=0";
	win = window.open(url, name, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
function firstFocus(){ 
    if(document.forms.length>0){ 
        var oForm=document.forms[0]; 
        for(var i=0;i<oForm.length;i++){ 
            if((oForm.elements[i].type=="text")|| 
               (oForm.elements[i].type=="textarea")||   
	           (oForm.elements[i].type.toString().charAt(0)=="s")){ 
                    document.forms[0].elements[i].focus(); 
                    break; 
        	}
	    }
	}
}
function checkbox_all(idtext,nr) {
   var idAll = idtext + '_all';
   ElementAll = document.getElementById(idAll);
   for (i=1; i<=nr; ++ i) {  
       var id = idtext + i;
       Element = document.getElementById(id);  
	   if (Element){
     	  if (ElementAll.checked) {
		  	  Element.checked = true;
		  }
		  else {
		      Element.checked = false;
		  }
	   }
   }
}
function disable(id) {
	document.getElementById(id).disabled=true;
}
function enable(id) {
    document.getElementById(id).disabled=false;
}
function closeID(ID,img,type) {
  	Element = document.getElementById(ID);
	imgElement = document.getElementById(img);
	if (Element){		
	   document.getElementById(ID).style.visibility="hidden";
	   document.getElementById(ID).className = "close";
	} 
    if (img) {
	   if (type) {imgElement.src = folderPic + "close.gif"; }
	   else 	 {imgElement.src = folderPic + "toggle_plus_grey.gif"; }
    }
} 
function openID(ID,img,type) {
  	Element = document.getElementById(ID);
	imgElement = document.getElementById(img);
	if (Element){		
	   document.getElementById(ID).style.visibility="visible";
	   document.getElementById(ID).className = "open"; 
	}
    if (img) {
	   if (type) {imgElement.src = folderPic + "open.gif"; }
	   else 	 {imgElement.src = folderPic + "toggle_minus_grey.gif"; }
   }	
} 

var hmenu_text = "";
var temp_text = "";
var lock_hmenu = false;
var run_hmenu = "";
var delay_hmenu = 1000;
function hmenu_wait() {
    if (lock_hmenu == true) {
	   lock_hmenu = false;
	   window.clearInterval(run_hmenu);
    }
}
function hmenu_resume() {
 	lock_hmenu = true;
	run_hmenu = setInterval("hmenu(hmenu_defaultID)",delay_hmenu);
}
function hmenu(id) {

 // jos on alueella (1/2) keskeytä
 // jos poistuu alueelta -> jatka laskentaa
 
    if (lock_hmenu == true) {
	   lock_hmenu = false;
	   window.clearInterval(run_hmenu);
    }
    // close old
	if (hmenuID) { 
	   temp_text = hmenuID.split('_');
	   hmenu_text = temp_text[0] + '_li_' + temp_text[1];
	   document.getElementById(hmenu_text).className = false;		
   	   Element = document.getElementById(hmenuID);
   	   if (Element){	
   	   	  document.getElementById(hmenuID).className = "close";
   	  	  // document.getElementById(hmenuID).style.visibility="hidden";
       }
    }
	// open new
	Element = document.getElementById(id);
	if (Element){	
	    hmenuID = id;
	    document.getElementById(id).className = "open";	    
		// document.getElementById(id).style.visibility="visible";
		temp_text = id.split('_');
		hmenu_text = temp_text[0] + '_li_' + temp_text[1];
		if (id == hmenu_defaultID) {
			document.getElementById(hmenu_text).className = "active";
		} 
		else {
			document.getElementById(hmenu_text).className = "aktiivi";
		}	
	}
 	// lock_hmenu = true;
	// run_hmenu = setInterval("hmenu(hmenu_defaultID)",delay_hmenu);
} 

function close_openID(close,open) {
	if (close) { 
  	   Element = document.getElementById(close);
	   if (Element){	
	   	  document.getElementById(close).className = "close";
	   	  // document.getElementById(close).style.visibility="hidden";
	   }
	}
	if (open) {
  	   Element = document.getElementById(open);
	   if (Element){	
	   	  document.getElementById(open).className = "open";
	   	  // document.getElementById(open).style.visibility="visible";
	   }
	}
} 
function toggle(id,img,on,off){
  Element = document.getElementById(id);
  imgElement = document.getElementById(img);
  if (Element){
     if (Element.className == 'close'){
	    Element.className = "open";
		// Element.style.visibility = "visible";
		// Element.style.display = "block";
		if (img) {
		   if (off) {img.src = off; }
		   else { imgElement.src = folderPic + "close.gif"; }
		}
	 }
	 else{
		Element.className = "close";
		// Element.style.visibility = "hidden";
		// Element.style.display = "none";
		if (img) {
		   if (on) {img.src = on; }
		   else { imgElement.src = folderPic + "open.gif"; }
		}
	 }
   }
}

function toggle_multi(id_names,images,on,off) {
  var ids = id_names.split(';');
  var image = images.split(';');
  var img = '';
  for(var i=0;i < ids.length;i++) {
     var id = ids[i];
     if (1 < images.length) {img = images[i];}
     else if (images[0])    {img = images[0];}
     else {img = id + '_img';}
     toggle2(id,img,on,off);
  }
}
function toggle2(id,img,on,off){
  Element = document.getElementById(id);
  imgElement = document.getElementById(img);
  if (Element){
     if (Element.className == 'close'){
	    Element.className = "open";
		// Element.style.visibility = "visible";
		// Element.style.display = "block";
		if (img) {
		   if (off) {img.src = off; }
		   else { imgElement.src = folderPic + "toggle_minus_grey.gif"; }
		}
	 }
	 else{
		Element.className = "close";
		// Element.style.visibility = "hidden";
		// Element.style.display = "none";
		if (img) {
		   if (on) {img.src = on; }
		   else { imgElement.src = folderPic + "toggle_plus_grey.gif"; }
		}
	 }
   }
}
function hover(id,img,status){

	Element = document.getElementById(id);
	imgElement = document.getElementById(img);

	if (imgElement){
		if (!status) {
		   if   (Element.className == 'open') {
		       status = "minus";
		   }
		   if (Element.className == 'close') {
		   	   status = "plus";
		   }
		}
		if (status == 'on') {
		   imgElement.src = folderPic + "toggle_on_grey.gif";
		}
		else if (status == 'off') {
		   imgElement.src = folderPic + "toggle_no_grey.gif";
		}		
		else if (status == 'plus') {
		   imgElement.src = folderPic + "toggle_plus_grey.gif";
		}
		else if (status == 'minus') {
		   imgElement.src = folderPic + "toggle_minus_grey.gif";
		}
		else if (status == 'up') {
		   imgElement.src = folderPic + "toggle_up_grey.gif";
		}				
		else {}			    
	}
}

function hover2(id,img){
	imgElement = document.getElementById(id);
	if (imgElement){
	   imgElement.src = folderPic + img;
	}
}

function add_flash(id, url, w, h, b, q, pic) {
	document.write( "<object id=\"" + id + "\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\"  codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"" + w + "\" height=\"" + h + "\" align=\"middle\">\n" );
	document.write( "<param name=\"allowScriptAccess\" value=\"sameDomain\" />\n" );
	document.write( "<param name=\"movie\" value=\"" + url + "\" />\n" );
	document.write( "<param name=\"quality\" value=\"" + q + "\" />\n" );
	document.write( "<param name=\"bgcolor\" value=\"" + b + "\" />\n" );
	document.write( "<embed src=\"" + url + "\" quality=\"" + q + "\" bgcolor=\"" + b + "\" width=\"" + w + "\" height=\"" + h + "\" name=\"" + id + "\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />\n" );
	document.write( "</object>\n" );
}

// ----------------------------------------------
// RATING
// (c) e-finland.org 3/17/2004
// ----------------------------------------------
function Add_Rating(Name,Reting,Text1,Text2,Link){
	var Star_On  = folderPic + "star_on.gif";
	var Star_Off = folderPic + "star_off.gif";
	var Star_Act = folderPic + "star.gif";
	var Star_Half = folderPic + "star_half.gif";
	var output ="";
	var Reting2 = Math.round(Reting)
	for(var i=1;i<6;i++){ 
		Half = i;
		Half++;
		if (i<=Reting2) { 
		   Pic=(i>Reting)?Star_Half:Star_Act
		}
		else {
		   Pic = Star_Off;
		}
		output = output + "<a href=\"javascript:void(0);\" onClick=\"open_window('" + Link + "," + i +"','','200','200','150','150')\" onMouseover=\"Rating(" + i + ",'" + Name + "'," + Reting + ");self.status='';return true;\" onMouseout=\"Rating(0,'" + Name + "'," + Reting + ");self.status='';return true;\"><img name=\"" + Name + "-" + i + "\"  src=\"" + Pic + "\" alt=\"" + Text1 + " " + i + " " + Text2 + "\" /></a>";
	}
	document.write(output)
}
function Rating(Action, Name, Active){
	var Star_On  = folderPic + "star_on.gif";
	var Star_Off = folderPic + "star_off.gif";
	var Star_Act = folderPic + "star.gif";
	var Star_Half = folderPic + "star_half.gif";
	var Reting2 = Math.round(Active)
    for(var i=1;i<6;i++){ 
		var Image = Name+'-'+i;
		if (i<=Action) {
		   	document.getElementById(Image).src = Star_On;
		}
		else if (i<=Reting2) { 
		   document.getElementById(Image).src = (i>Active)?Star_Half:Star_Act
		}		
		else {
			document.getElementById(Image).src = Star_Off;
		}
	}
}

// ----------------------------------------------
// slideshow 
// by e-Finland Network Ltd 3/17/2004
// ----------------------------------------------

if (!delay) {var delay = 6000;}
var ImgNum = 0;
// var ImgLength = SlideImg.length - 1;
var lock = false;
var run;
var info = "";
// slideshow_auto();
function slideshow_change(direction,link_off) {
	if (document.images) {
		ImgNum = ImgNum + direction;
		if (ImgNum > ImgLength) {ImgNum = 0;}
		if (ImgNum < 0) {ImgNum = ImgLength;}
		if (!link_off) {
		   // document.slideshow.src = SlideImg[ImgNum];
		   var imgtxt = SlideImg[ImgNum].replace(/.gif/g, "") ;
		   var imgtxt = imgtxt.substring(pic_folder.length,imgtxt.length);
		   var imgurl = imgtxt;
		   var dotcom=imgurl.indexOf("_")
		   if (dotcom>=0) {
		   	  imgurl = imgurl.replace(/_/g, ".") ;
		   }
		   else {
		      imgurl = imgurl + ".fi";
		   }
		   var info = "<a href=\"http://www." + imgurl + "\" target=\"_new\"><img src=\"" + SlideImg[ImgNum] + "\" alt=\"" + imgtxt + "\"></a>";
		}
		else {
		   var info = "<img src=\"" + SlideImg[ImgNum] + "\" alt=\"" + imgtxt + "\">";
		}
		slideshow_write(info);
    }
}
function slideshow_auto(link_off) {
	if (lock == true) {
		lock = false;
		window.clearInterval(run);
	}
	else if (lock == false) {
		lock = true;
		if (link_off) {
		   run = setInterval("slideshow_change(1,1)", delay);
		}
		else {
		   run = setInterval("slideshow_change(1)", delay);
		}
   }
}
function slideshow_write(info) {
  if (!document.layers&&!document.all&&!document.getElementById) { return }
  if (document.layers){
	 document.layers.slideshow.document.write(info);
	 document.layers.slideshow.document.close();  	 
  }
  else if (document.all) { 
	 slideshow.innerHTML = info;
  }
  else if (document.getElementById) {
     document.getElementById("slideshow").innerHTML=info;
  }
}

// ----------------------------------------------
// StyleSwitcher functions written by Paul Sowden
// http://www.alistapart.com/stories/alternate/
// Some modifications by e-Finland Network Ltd 3/17/2004
// ----------------------------------------------

function setActiveStyleSheet(title,status) {
  var i, a, main;
  if ((status) && (document.forms[0].style)) {
  	 document.forms[0].style.value = title; 
  }  
  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;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}
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+"; path=/;";
  // document.cookie = name+"="+value+expires+"; domain="+domain+"; 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;
}
		
window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie('style', title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);

// ----------------------------------------------
// UpdateCookie(domain,path,name,value,date,days)

function UpdateCookie(domain,path,name,value,expires,days) {
  if (domain) {
  	 domain = "; domain="+domain;
  }
  if (path) {
  	 path = "; path="+path;
  }
  if (expires) {
    expires = "; expires="+expires;
  }
  else if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    expires = "; expires="+date.toGMTString();
  }
  else expires = "";

  document.cookie = name+"="+value+expires+domain+path+";";
}
// ----------------------------------------------
// SET FOT SIZE
// e-Finland Network Ltd 3/17/2004
// ----------------------------------------------

function TextSize(chgsize,rs) {
  if (!document.documentElement || !document.body) { return; }
  var newSize;
  var startSize = parseInt(ndeGetDocTextSize());
  if (!startSize) { startSize = 9; }
  if (!chgsize) { chgsize = startSize; }
  switch (chgsize)  {
  case 'incr':
    newSize = startSize + 1;
    break;
  case 'decr':
    newSize = startSize - 1;
    break;
  case 'reset':
    if (rs) { newSize = rs; } 
    else 	{ newSize = 9; }
    break;
  default:
    newSize = parseInt(readCookie('font'));
    if (!newSize){ newSize = startSize; }
	
    break;
  }
  if (newSize < 8) { newSize = 8; }
  newSize += 'pt';
  document.documentElement.style.fontSize = newSize;
  document.body.style.fontSize = newSize;
  if (document.forms[0].font) {
  	 document.forms[0].font.value = newSize; 
  }
  createCookie('font', newSize, 365); 
}

function ndeGetDocTextSize() {
  if (!document.body)  {return 0; }
  var size = 0;

  var body = document.body;
  if (body.style && body.style.fontSize)  {
   	 size = body.style.fontSize;
  }
  else if (body.currentStyle)  {
     size = body.currentStyle.fontSize;
  }
  else if (document.forms[0].font.value)  {
     size = document.forms[0].font.value;
  }
  // else if (typeof(getComputedStyle) != 'undefined')  {
  //   size = getComputedStyle(body,'').getPropertyValue('font-size');
  // }

  return size;
}

// ----------------------------------------------
// DHTML tip message version 1.5.4 copyright Essam Gamal 2003 
//  Home Page: (http://migoicons.tripod.com)
//  Email: (migoicons@hotmail.com)
//  Updated on :7/30/2003
//  Modified by e-Finland Network Ltd 3/17/2004
// ----------------------------------------------

var TipId="tip"; 
var FiltersEnabled = 1; 

var MI_IE=MI_IE4=MI_NN4=MI_ONN=MI_NN=MI_pSub=MI_sNav=0;mig_dNav()
var Style=[],Text=[],Count=0,move=0,fl=0,isOK=1,hs,e_d,tb,w=window,PX=(MI_pSub)?"px":""
var d_r=(MI_IE&&document.compatMode=="CSS1Compat")? "document.documentElement":"document.body"
var ww=w.innerWidth
var wh=w.innerHeight
var sbw=MI_ONN? 15:0

function mig_hand(){
	if(MI_sNav){
		w.onresize=mig_re
		document.onmousemove=mig_mo
		if(MI_NN4) document.captureEvents(Event.MOUSEMOVE)
	}
}		

function mig_dNav(){
	var ua=navigator.userAgent.toLowerCase()
	MI_pSub=navigator.productSub
	MI_OPR=ua.indexOf("opera")>-1?parseInt(ua.substring(ua.indexOf("opera")+6,ua.length)):0
	MI_IE=document.all&&!MI_OPR?parseFloat(ua.substring(ua.indexOf("msie")+5,ua.length)):0
	MI_IE4=parseInt(MI_IE)==4
	MI_NN4=navigator.appName.toLowerCase()=="netscape"&&!document.getElementById
	MI_NN=MI_NN4||document.getElementById&&!document.all
	MI_ONN=MI_NN4||MI_pSub<20020823
	MI_sNav=MI_NN||MI_IE||MI_OPR>=7
}

function mig_cssf(){
	if(MI_IE>=5.5&&FiltersEnabled){fl=1
		var d=" progid:DXImageTransform.Microsoft."
		mig_layCss().filter="revealTrans()"+d+"Fade(Overlap=1.00 enabled=0)"+d+"Inset(enabled=0)"+d+"Iris(irisstyle=PLUS,motion=in enabled=0)"+d+"Iris(irisstyle=PLUS,motion=out enabled=0)"+d+"Iris(irisstyle=DIAMOND,motion=in enabled=0)"+d+"Iris(irisstyle=DIAMOND,motion=out enabled=0)"+d+"Iris(irisstyle=CROSS,motion=in enabled=0)"+d+"Iris(irisstyle=CROSS,motion=out enabled=0)"+d+"Iris(irisstyle=STAR,motion=in enabled=0)"+d+"Iris(irisstyle=STAR,motion=out enabled=0)"+d+"RadialWipe(wipestyle=CLOCK enabled=0)"+d+"RadialWipe(wipestyle=WEDGE enabled=0)"+d+"RadialWipe(wipestyle=RADIAL enabled=0)"+d+"Pixelate(MaxSquare=35,enabled=0)"+d+"Slide(slidestyle=HIDE,Bands=25 enabled=0)"+d+"Slide(slidestyle=PUSH,Bands=25 enabled=0)"+d+"Slide(slidestyle=SWAP,Bands=25 enabled=0)"+d+"Spiral(GridSizeX=16,GridSizeY=16 enabled=0)"+d+"Stretch(stretchstyle=HIDE enabled=0)"+d+"Stretch(stretchstyle=PUSH enabled=0)"+d+"Stretch(stretchstyle=SPIN enabled=0)"+d+"Wheel(spokes=16 enabled=0)"+d+"GradientWipe(GradientSize=1.00,wipestyle=0,motion=forward enabled=0)"+d+"GradientWipe(GradientSize=1.00,wipestyle=0,motion=reverse enabled=0)"+d+"GradientWipe(GradientSize=1.00,wipestyle=1,motion=forward enabled=0)"+d+"GradientWipe(GradientSize=1.00,wipestyle=1,motion=reverse enabled=0)"+d+"Zigzag(GridSizeX=8,GridSizeY=8 enabled=0)"+d+"Alpha(enabled=0)"+d+"Dropshadow(OffX=3,OffY=3,Positive=true,enabled=0)"+d+"Shadow(strength=3,direction=135,enabled=0)"
	}
}
// function tip_on(t,s){
function tip_on(text,headline){
	if(MI_sNav&&isOK){	
		
		// text
		var t=[];
		t[0]=headline;
		t[1]=text;
		
		// style
		var s=[];	
		s[0]= "#FFFFFF";			// title color
		s[1]= "#7F7F7F"; 			// title bgcolor
		s[2]= "";  					// title background
		s[3]= ""; 					// title align
		s[4]= "Verdana,Arial,Helvetica"; // title font face
		s[5]= 1; 					// title font size
		s[6]= "#282828"; 			// txt color
		s[7]= "#F0F0F0"; 			// txt bgcolor
		s[8]= ""; 					// txt background
		s[9]= ""; 					// txt align
		s[10]= "Verdana,Arial,Helvetica"; // txt font face
		s[11]= 1; 					// txt font size
		s[12]= 175; 				// width
		s[13]= ""; 					// height
		s[14]= 1; 					// border size
		s[15]= "#7F7F7F"; 			// border color
		s[16]= 2; 					// padding px (all)
		s[17]= ""; 					// transition nr (25)
		s[18]= ""; 					// Transition duration
		s[19]= ""; 					// Transparency level
		s[20]= 2; 					// shadow type
		s[21]= "#C0C0C0"; 			// shadow color
		s[22]= ""; 					// Appearance behavior
		s[23]= ""; 					// TipPositionType
		s[24]= 20; 					// Xpos
		s[25]= 10; 					// Ypo
				
		var titCol=s[0]?"color='"+s[0]+"'":""
		var titBgCol=s[1]&&!s[2]?"bgcolor='"+s[1]+"'":""
		var titBgImg=s[2]?"background='"+s[2]+"'":""
		var titTxtAli=s[3]?"align='"+s[3]+"'":""
		var txtCol=s[6]?"color='"+s[6]+"'":""
		var txtBgCol=s[7]&&!s[8]?"bgcolor='"+s[7]+"'":""
		var txtBgImg=s[8]?"background='"+s[8]+"'":""
		var txtTxtAli=s[9]?"align='"+s[9]+"'":""
		var tipHeight=s[13]? "height='"+s[13]+"'":""
		var brdCol=s[15]? "bgcolor='"+s[15]+"'":""
		
		if(!s[4])s[4]="Verdana,Arial,Helvetica" 
		if(!s[5])s[5]=1 
		if(!s[10])s[10]="Verdana,Arial,Helvetica" 
		if(!s[11])s[11]=1
		if(!s[12])s[12]=200
		if(!s[14])s[14]=0
		if(!s[16])s[16]=0
		if(!s[24])s[24]=10
		if(!s[25])s[25]=10

		if(document.onmousemove!=mig_mo||w.onresize!=mig_re) mig_hand()
		if(fl&&s[17]>-1&&s[18]>0)mig_layCss().visibility="hidden"
		var ab="";
		var ap="";
		
		hs=s[22]
		if(MI_pSub==20001108){
		if(s[14])ab="style='border:"+s[14]+"px solid"+" "+s[15]+"'";
		ap="style='padding:"+s[16]+"px "+s[16]+"px "+s[16]+"px "+s[16]+"px'"}
		var closeLink=hs==3?"<td align='right'><font size='"+s[5]+"' face='"+s[4]+"'><a href='javascript:void(0)' onclick='mig_hide(0)' style='text-decoration:none;color:"+s[0]+"'><b>x</b></a></font></td>":""
		var title=t[0]||hs==3?"<table width='100%' border='0' cellpadding='0' cellspacing='0' "+titBgCol+" "+titBgImg+"><tr><td "+titTxtAli+"><font size='"+s[5]+"' FACE='"+s[4]+"' "+titCol+"><B>"+t[0]+"</b></font></td>"+closeLink+"</tr></table>":"";
		var txt="<table "+ab+" width='"+s[12]+"' border='0' cellspacing='0' cellpadding='"+s[14]+"' "+brdCol+"><tr><td>"+title+"<table width='100%' "+tipHeight+" border='0' cellpadding='"+s[16]+"' cellspacing='0' "+txtBgCol+" "+txtBgImg+"><tr><td "+txtTxtAli+" "+ap+" valign='top'><font size='"+s[11]+"' face='"+s[10]+"' "+txtCol +">"+t[1]+"</font></td></tr></table></td></tr></table>"
		mig_wlay(txt)
		tb={trans:s[17],dur:s[18],opac:s[19],st:s[20],sc:s[21],pos:s[23],xpos:s[24],ypos:s[25]}
		if(MI_IE4)mig_layCss().width=s[12]
		e_d=mig_ed()
		Count=0
		move=1
   }
}

function mig_mo(e){
	if(move){
		var X=0,Y=0,s_d=mig_scd(),w_d=mig_wd()
		var mx=MI_NN?e.pageX:MI_IE4?event.x:event.x+s_d[0]
		var my=MI_NN?e.pageY:MI_IE4?event.y:event.y+s_d[1]
		if(MI_IE4)e_d=mig_ed()
		switch(tb.pos){
		case 1:X=mx-e_d[0]-tb.xpos+6;Y=my+tb.ypos;break
		case 2:X=mx-(e_d[0]/2);Y=my+tb.ypos;break
		case 3:X=tb.xpos+s_d[0];Y=tb.ypos+s_d[1];break
		case 4:X=tb.xpos;Y=tb.ypos;break		
		default:X=mx+tb.xpos;Y=my+tb.ypos}
		if(w_d[0]+s_d[0]<e_d[0]+X+sbw)X=w_d[0]+s_d[0]-e_d[0]-sbw
		if(w_d[1]+s_d[1]<e_d[1]+Y+sbw){if(tb.pos>2)Y=w_d[1]+s_d[1]-e_d[1]-sbw;else Y=my-e_d[1]}
		if(X<s_d[0])X=s_d[0]
		with(mig_layCss()){left=X+PX;top=Y+PX}
		mig_dis()
	}
}

function mig_dis(){
	Count++
	if(Count==1){
	if(fl){	
		if(tb.trans==51)tb.trans=parseInt(Math.random()*50)
		var at=tb.trans>-1&&tb.trans<24&&tb.dur>0 
		var af=tb.trans>23&&tb.trans<51&&tb.dur>0
		var t=mig_lay().filters[af?tb.trans-23:0]
		for(var p=28;p<31;p++){mig_lay().filters[p].enabled=0}
		for(var s=0;s<28;s++){if(mig_lay().filters[s].status)mig_lay().filters[s].stop()}
		for(var e=1;e<3;e++){if(tb.sc&&tb.st==e){with(mig_lay().filters[28+e]){enabled=1;color=tb.sc}}}
		if(tb.opac>0&&tb.opac<100){with(mig_lay().filters[28]){enabled=1;opacity=tb.opac}}
		if(at||af){if(at)mig_lay().filters[0].transition=tb.trans;t.duration=tb.dur;t.apply()}}
		mig_layCss().visibility=MI_NN4?"show":"visible"
		if(fl&&(at||af))t.play()
		if(hs>0&&hs<4)move=0
	}
}

function mig_layCss(){return MI_NN4?mig_lay():mig_lay().style}
function mig_lay(){with(document)return MI_NN4?layers[TipId]:MI_IE4?all[TipId]:getElementById(TipId)}
function mig_wlay(txt){if(MI_NN4){with(mig_lay().document){open();write(txt);close()}}else mig_lay().innerHTML=txt}
function mig_hide(C){if(!MI_NN4||MI_NN4&&C)mig_wlay("");with(mig_layCss()){visibility=MI_NN4?"hide":"hidden";left=0;top=-800}}
function mig_scd(){return [parseInt(MI_IE?eval(d_r).scrollLeft:w.pageXOffset),parseInt(MI_IE?eval(d_r).scrollTop:w.pageYOffset)]}
function mig_re(){var w_d=mig_wd();if(MI_NN4&&(w_d[0]-ww||w_d[1]-wh))location.reload();else if(hs==3||hs==2) mig_hide(1)}
function mig_wd(){return [parseInt(MI_ONN?w.innerWidth:eval(d_r).clientWidth),parseInt(MI_ONN?w.innerHeight:eval(d_r).clientHeight)]}
function mig_ed(){return [parseInt(MI_NN4?mig_lay().clip.width:mig_lay().offsetWidth)+3,parseInt(MI_NN4?mig_lay().clip.height:mig_lay().offsetHeight)+5]}
function tip_off(){if(MI_sNav&&isOK){if(hs!=4){move=0;if(hs!=3&&hs!=2){mig_hide(1)}}}}

function mig_clay(){
	if(!mig_lay()){ 
		isOK=0  
		// alert("DHTML TIP MESSAGE VERSION 1.5 ERROR NOTICE.\n<div id=\""+TipId+"\"></div> tag missing or its ID has been altered")
	} 
	else{
		mig_hand();
		mig_cssf();
	}
}

// ----------------------------------------------
// FORM VALIDATION
// e-Finland Network Ltd 10/27/2005
// ----------------------------------------------

function formvalidation(type, entered, alertbox, datatype, min, max) {
// type -- "email","digit", 
// min --minimum value allowed
// max --maximum value allowed
// text --alertbox text
// type -- "I" == only integers
   with (entered) {
		// empty
		if (type == 'empty') {
		   if (value==null || value=="") {
		 	  if (alertbox!="") {alert(alertbox);} 
			  return false;
		   }
		   else {return true;}
		}
   		// email
		else if (type == 'email') {
		   apos=value.indexOf("@"); 
		   dotpos=value.lastIndexOf(".");
		   lastpos=value.length-1;
		   if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) {
		   	  if (alertbox) {alert(alertbox);} 
		  	  return false;
	       }
	       else {return true;}
		}
		// digit
   		else if (type == 'digit') {
		   checkvalue=parseFloat(value);
		   if (datatype) {
		   	  smalldatatype=datatype.toLowerCase();
		   	  if (smalldatatype.charAt(0)=="i") {
		   	  	 checkvalue=parseInt(value); 
			  	 if (value.indexOf(".")!=-1) {checkvalue=checkvalue+1;}
		   	  }
		   }
		   if ((parseFloat(min)==min && value.length<min) || (parseFloat(max)==max && value.length>max) || value!=checkvalue) {
		   	  if (alertbox!="") {alert(alertbox);} 
		   	  return false;
		   }
		   else {return true;}		
		}
		// normal (valuation)
   		else {
		   checkvalue=parseFloat(value);
		   if (datatype) {
		   	  smalldatatype=datatype.toLowerCase();
		   	  if (smalldatatype.charAt(0)=="i") {checkvalue=parseInt(value)};
		   }
		   if ((parseFloat(min)==min && checkvalue<min) || (parseFloat(max)==max && checkvalue>max) || value!=checkvalue) {
		   	  if (alertbox!="") {alert(alertbox);} 
		   	  return false;
		   }
		   else {return true;}
		}		
   }
}

// =====================================================================
// KEY COUNT DOWN/UP + ALERT
// =====================================================================
var KeyActive,KeyAlert,KeyText1,KeyText2,KeyTextAlert1,KeyTextAlert2,KeyTextEnd;
var CountIds,CountOp,CountMinute,CountSecond,CountMinuteEnd,CountSecondEnd,CountText,CountAlertStatus,CountCleared,CountThis;
function CountGetMinutes(data) {
	for(var i=0;i<data.length;i++) 
	if(data.substring(i,i+1)==":")  
	break;  
	return(data.substring(0,i)); 
}
function CountGetSeconds(data) {        
	for(var i=0;i<data.length;i++) 
	if(data.substring(i,i+1)==":") 
	break;  
	return(data.substring(i+1,data.length)); 
}
function CountDisplay(min,sec) {     
	var disp;       
	if(min<=9) disp=" 0";   
	else disp=" ";  
	disp+=min+":";  
	if(sec<=9) disp+="0"+sec;       
	else disp+=sec; 
	return(disp); 
}

function CountTime(op,id,time) {       

	clearTimeout(CountOp);

	// CountCleared=null;
    // if (CountIds) {
	//    for(var i=1; i<CountIds; i++){ 
	//    		 if (CountId[i] == id) {
	// 		 	clearTimeout(CountOp[i]);
	// 			CountThis = i;
	// 			CountCleared++;				
	// 		 }
	//    }
	// } 	
	// if (!CountCleared) { 	
	//    CountIds++;
	//    CountOp[CountIds] = id;	
	//    CountThis = CountIds;   
	// }
	
	if (op == 'up') {
	   if (time) {	
	   		CountMinuteEnd = 0 + CountGetMinutes(time); 
	   		CountSecondEnd = 0 + CountGetSeconds(time); 	   
	   }
	   else if (KeyActive) { 
	   		CountMinuteEnd = 0 + CountGetMinutes(KeyActive); 
	   		CountSecondEnd = 0 + CountGetSeconds(KeyActive); 	   
	   }
	   else if (document.forms[0].CountTime.value) {
	   		CountMinuteEnd = 0 + CountGetMinutes(document.forms[0].CountTime.value); 
	   		CountSecondEnd = 0 + CountGetSeconds(document.forms[0].CountTime.value); 
	   }
	   else {
	   		return null;
	   }
	   CountMinute = 0;        
	   CountSecond = 0;     
	}
	else {
	   if (time) {	
	   		CountMinute = 1 * CountGetMinutes(time); 
	   		CountSecond = 0 + CountGetSeconds(time); 	   
	   }
	   else if (KeyActive) { 
	   		CountMinute = 1 * CountGetMinutes(KeyActive); 
	   		CountSecond = 0 + CountGetSeconds(KeyActive); 	   
	   }
	   else if (document.forms[0].CountTime.value) {
	   		CountMinute = 1 * CountGetMinutes(document.forms[0].CountTime.value); 
	   		CountSecond = 0 + CountGetSeconds(document.forms[0].CountTime.value); 
	   }
	   else {
	   		return null;
	   }
	   CountMinuteEnd = 0; 
	   CountSecondEnd = 0; 
	} 
	CountTimeRepeat(op,id,CountThis);   
}
function CountTimeRepeat(op,id,CountThis) { 
	if (op == 'up') {
	    CountSecond++;        
		if(CountSecond==60) {
			CountSecond=0; CountMinute++; 
		}
	}
	else {
		CountSecond--;        
		if(CountSecond==-1) { 
			CountSecond=59; CountMinute--; 
		}       
	} 

	if ((CountMinute == CountMinuteEnd) && (CountSecond == CountSecondEnd)) {
	   	CountText = "";
		if (KeyTextEnd) {CountText = KeyTextEnd;}
		if (CountText) {
		//   alert(CountText);
		}     
		window.status = CountText;
		if (id) {
		   if (document.getElementById(id).value) {document.getElementById(id).value = CountText; } 
		   if (document.getElementById(id).innerHTML) {document.getElementById(id).innerHTML = CountText;} 
		}				
	}
	// else if ((KeyAlert) && (CountMinute < KeyAlert) && (!CountAlertStatus)) {
	if ((KeyAlert) && (CountMinute < KeyAlert) && (!CountAlertStatus)) {
		if (!KeyTextAlert1) KeyTextAlert1=''; if (!KeyTextAlert2) KeyTextAlert2=''; 
	   	CountText = KeyTextAlert1 + KeyAlert + KeyTextAlert2;
		alert(CountText);     
		window.status = CountText;
		if (id) {
		   if (document.getElementById(id).value) {document.getElementById(id).value = CountText; } 
		   if (document.getElementById(id).innerHTML) {document.getElementById(id).innerHTML = CountText;} 
		}	
		CountAlertStatus = 1;	
		// CountOp[CountThis] = setTimeout("CountTimeRepeat('"+ op +"','"+ id +"','"+ CountThis +"')",1000);
		CountOp = setTimeout("CountTimeRepeat('"+ op +"','"+ id +"','"+ CountThis +"')",1000);				
	}	
	else {
		if (!KeyText1) KeyText1=''; if (!KeyText2) KeyText2=''; 
		CountText = KeyText1 + CountDisplay(CountMinute,CountSecond) + KeyText2;
		window.status = CountText;
		if (id) {
		   if (document.getElementById(id).value) {document.getElementById(id).value = CountText; } 
		   if (document.getElementById(id).innerHTML) {document.getElementById(id).innerHTML = CountText;} 
		}				
		// CountOp[CountThis] = setTimeout("CountTimeRepeat('"+ op +"','"+ id +"','"+ CountThis +"')",1000);	
		CountOp = setTimeout("CountTimeRepeat('"+ op +"','"+ id +"','"+ CountThis +"')",1000);	
	}	
}

// =====================================================================
// window, new, resize, move
// =====================================================================

var Lev=100;
var Kor=100;
var LevMargin = 1;
var KorMargin = 1;
var LevMax = 800;
var KorMax = 600;
var LevSpeed = 50;
var KorSpeed = 50;
var resizeWindowTime=1;
var resizeWindowStatus = 0;

function popWindow(url,anchor,name,w,h,tool,loc,dir,status,menu,scroll,resize,his) {
   
	// url = text.replace(/’/g, "&#39;") ;
	// url = text.replace(/'/g, "&#146;") ;

	if (name == 0)   {name = null;}
	if (w == 0)  	{w = null;}
	if (h == 0)  	{h = null;}
	
	if (!name)  {name = "_blank";}
	if (!w)  	{w = LevMax;}
	if (!h)  	{h = KorMax;}
	if (tool)   {tool = "yes";}   else {tool = "no";}
	if (loc)    {loc = "yes";} 	  else {loc = "no";}
	if (dir) 	{dir = "yes";} 	  else {dir = "no";}
    if (status) {status = "yes";} else {status = "no";}
	if (menu) 	{menu = "yes";}   else {menu = "no";}
	if (scroll) {scroll = "yes";} else {scroll = "no";}
    if (resize) {resize = "yes";} else {resize = "no";}
	if (his) 	{his = "yes";}    else {his = "no";}
	if (tool) 	{tool = "yes";}   else {tool = "no";}
		
	var pop = window.open(url,name,"toolbar="+tool+", location="+loc+", directories="+dir+", status="+status+", menubar="+menu+", scrollbars="+scroll+", resizable="+resize+", copyhistory="+his+", width="+w+", height="+h);

	if(!pop ) { //popup blockers should not cause errors 
		window.location = url;
	}

	if (anchor) {pop.location.hash = anchor}; // goto in the url-page to <name="anchor">
}	

function moveWindow(l,k){
	window.moveTo(l,k);
	LevMargin = l;
	KorMargin = k;
}

function resizeWindow(op,l,k){
	if (l) {Lev = l;}
	if (k) {Kor = k;}
	if (op){	
		window.resizeTo(Lev,Kor);
		Kor += KorSpeed;
		if (Kor >= KorMax) {
			// Kor -= KorMargin*2;
			Kor = KorMax;
			window.resizeTo(Lev,Kor);
			resizeWindowStatus = 1;
		}
		else { 
			setTimeout("resizeWindow(1)",resizeWindowTime);
		}
	}
	else {
		window.resizeTo(Lev,Kor);
		Lev += LevSpeed;
		if (Lev >= LevMax){
			Lev = LevMax;
			Lev -= LevMargin*2;
			setTimeout("resizeWindow(1)",resizeWindowTime);
		}
		else {
			setTimeout("resizeWindow(0)",resizeWindowTime);
		}
	}
}  

if (window.opera) {
	LevMax = screen.availWidth;
	KorMax = screen.availHeight - 70;  
}	
else if (document.all) { // Explorer
	LevMax = screen.availWidth;
	KorMax = screen.availHeight;    
} 
else { 				// rest
	LevMax = screen.availWidth;
	KorMax = screen.availHeight;   
}

