



if(typeof(onwa)=='undefined'){onwa=Array();}


ns4 = (document.layers) ? true : false;





	
	open_in_new_win_img_heightplus = 0;
	

	

	
	open_in_new_win_img_widthplus = 0;
	

	






function onwa_c(obj_id, obj) {




	
	

	width = onwa[obj_id][2];
	height = onwa[obj_id][3];
	
	target = onwa[obj_id][1];
	if (target == "")
		target = "_blank";
	
	border = onwa[obj_id][0];
	
	
	open_in_new_win_img_widthplus_1 = onwa[obj_id][4];
	open_in_new_win_img_heightplus_1 = onwa[obj_id][5];
	
	allowscroll = onwa[obj_id][6];
	
	if (open_in_new_win_img_widthplus_1 == '')
		open_in_new_win_img_widthplus2 = open_in_new_win_img_widthplus;
	else
		open_in_new_win_img_widthplus2 = open_in_new_win_img_widthplus_1;
	
	if (open_in_new_win_img_heightplus_1 == '')
		open_in_new_win_img_heightplus2 = open_in_new_win_img_heightplus;
	else
		open_in_new_win_img_heightplus2 = open_in_new_win_img_heightplus_1;
	
	
	width = (parseInt(width) + parseInt(open_in_new_win_img_widthplus2));
	height = (parseInt(height) + parseInt(open_in_new_win_img_heightplus2));
	
	
	
	
	

	

	
	

	var isIE=document.all?1:0;
	var isOp=window.opera?1:0;	
	var isDOM=document.getElementById?1:0;
	var isMoz = isDOM && !isIE;

	
	if ((typeof(maxsize_h_for_show_img_in_new_win) == "undefined") || (maxsize_h_for_show_img_in_new_win == ""))
	{
		if (!isOp)
			maxsize_h_for_show_img_in_new_win = screen.height - 70;
		else
			maxsize_h_for_show_img_in_new_win = screen.height - 370;
	}
	else
		maxsize_h_for_show_img_in_new_win = Math.min(parseInt(maxsize_h_for_show_img_in_new_win), screen.height - 70);

	if ((typeof(maxsize_w_for_show_img_in_new_win) == "undefined") || (maxsize_w_for_show_img_in_new_win == ""))
		maxsize_w_for_show_img_in_new_win = screen.width - 40;
	else
		maxsize_w_for_show_img_in_new_win = Math.min(parseInt(maxsize_w_for_show_img_in_new_win), screen.width - 40);

		
	width_real = width;
	height_real = height;
	
	
	
	
	if (isOp)
		scrollbar_w = 24;
	else if (isIE)
		scrollbar_w = document.body.offsetWidth - document.body.scrollWidth - 2;
	else if (isMoz)
		scrollbar_w = 18;
	else
		scrollbar_w = 18;
		
	if (!allowscroll)
		showscrollbars = "no";
	else
		showscrollbars = "yes";
		
	if (!allowscroll)
	{
		w_exceeded = false;
		h_exceeded = false;
		if (height_real > maxsize_h_for_show_img_in_new_win)
		{
			height_real = maxsize_h_for_show_img_in_new_win;
			h_exceeded = true;
			width_real = width_real + scrollbar_w;
			showscrollbars = "yes";
		}
		if (width_real > maxsize_w_for_show_img_in_new_win)
		{
			width_real = maxsize_w_for_show_img_in_new_win;
			w_exceeded = true;
			
			if (showscrollbars == "no")
			{
				height_real = height_real + scrollbar_w;
				
				
				if (height_real > maxsize_h_for_show_img_in_new_win)
				{
					height_real = maxsize_h_for_show_img_in_new_win;
					h_exceeded = true;
				}
				
				showscrollbars = "yes";
			}
		}
	}
	

	if (showscrollbars == "no")
	{
		hasscroll = 0;
		
		
		
	}
	else
		hasscroll = 1;
	
	
	href2 = "width=" + width + "&height=" + height + "&bwidth=" + open_in_new_win_img_widthplus2 + "&bheight=" + open_in_new_win_img_heightplus2 + "&hasscroll=" + hasscroll;

	if (obj.href.indexOf("?") != -1)
		href = obj.href + "&" + href2;
	else
		href = obj.href + "?" + href2;
	
	
	open_window(href, target, width, height, showscrollbars);
	
	return false;
}





function open_window(href_in, target_in, width_real, height_real, showscrollbars) {

	var command = "var mywin = wi" + "nd" + "ow" + "." + "op" + "en" + "(href_in,target_in,'";
	
	if (width_real && (width_real != -1))
		command = command + "width='+width_real+',";
	if (height_real && (height_real != -1))
		command = command + "height='+height_real+',";

	if (typeof(showscrollbars) == "undefined")
		showscrollbars = 1;
		
	command = command + "toolbar=0,directories=0,menubar=0,status=0,resizable=1,location=0,scrollbars='+showscrollbars+',copyhistory=0');";
		
	eval(command);
	

	

	if ((typeof(mywin) == "undefined") || (mywin == null) || (typeof(mywin.opener) == "undefined") || (mywin.opener == null))
	{
		alert("Sul on tõenäoliselt mõni pop-up blocker tarkvara aktiivne.\nPalun lülita see välja või seadista leebemaks, et koduleht tohiks Sinu kliki peale uut akent avada!");
		return false;
	}
	
	mywin.focus();
	
	return false;

}





function img_win_opened_callback(mywin, width, height, hasscroll) {


	var isIE=document.all?1:0;
	var isOp=window.opera?1:0;	
	var isDOM=document.getElementById?1:0;
	var isMoz = isDOM && !isIE;
	var MS = (isIE && !isOp || isMoz);

	
	
	if (!ns4 && (!((isMoz || MS) && (!hasscroll))) || isOp || isIE)	
	{
	
		
		
			db = "body";
		
			winW = MS ? mywin.document.body.clientWidth : mywin.innerWidth;
			winH = MS ? mywin.document.body.clientHeight : mywin.innerHeight;
		
			
	
			if ((winW != width) || (winH != height))
			{
				if (w_exceeded == false)
					width_diff = width - winW;
				else
					width_diff = 0;
					
				if (h_exceeded == false)
					height_diff = height - winH;
				else
					height_diff = 0;	
					
				if (hasscroll && isOp)
				{
					width_diff += 0; 
					height_diff += 0;
				}
				else if (isOp)
				{
					width_diff += 13;
					height_diff += 13;
				}
				
				
				
				
				if ((width_diff != 0) || (height_diff != 0))
				{
					try {
						mywin.resizeBy(width_diff, height_diff);
					}catch(e){}
				}
			}
				
			
			
			
			
		
	}
	else if (isMoz)
	{
		try {
			mywin.resizeBy(0, 1);
		}catch(e){}
		
		try {
			mywin.resizeBy(0, -1);
		}catch(e){}
	}


}







ie4 = (document.all) ? true : false;
MSIE55p = 0;
if (ie4)
{
	var browser = navigator.userAgent;
	
	pos = browser.indexOf("MSIE");
	if (pos != -1)
	{
		ver = browser.substr(pos + 4);
		
		
		pos_end = ver.indexOf(";");
		if (pos_end == -1)
			pos_end = ver.indexOf(")");
		ver = ver.substr(0, pos_end);
		
		
		
		if (ver.valueOf() >= 5.5)
		{
			MSIE55p = 1;
			
		}
	}
}





function select_random_img(slideshow_index) {


	var activepos_next;
	var maxlen;
	
	
	eval("maxlen = sls_a_" + slideshow_index + ".length;");
	
	
	
	
	if (maxlen == 0)
		return;
	
	do
	{
		activepos_next = Math.random() * maxlen;		
		activepos_next = Math.floor(activepos_next);
	} 
	while (activepos_next == maxlen);

	
	
	
	
	eval("img = document.slideshow_img_" + slideshow_index + "");
	setTimeout("img.src = sls_a_" + slideshow_index + "['" + activepos_next + "'].src;", 1);
	
	
	
	
	
}






oldimg_a = Array();

function get_slideshow_nextimg(slideshow_index, notrans, return_only_url) {


	var activepos = slideshow_activepos[slideshow_index];

	if (typeof(slideshow_autoresume) != "undefined")
		curr_slideshow_autoresume = slideshow_autoresume[slideshow_index];
	else
		curr_slideshow_autoresume = 0;


	
	if (activepos == -1) 
	{
		if (curr_slideshow_autoresume && (typeof(getCookieF) != "undefined"))
		{
			var activepos1 = getCookieF("slsp_" + slideshow_index);
			
			if (activepos1 == "")
				activepos = 0;
			else
				activepos = activepos1;
		}
		else
		{
			activepos = 0;
		}
	}
	
	
	var activepos_next;
	
	if (!notrans)
		activepos_next = activepos * 1 + 1;
	else
		activepos_next = activepos;
		
	
	
		
	var maxlen;
	eval("maxlen = sls_a_" + slideshow_index + ".length;");
	
	
	
	
	if (activepos_next >= maxlen)
	{
		
		activepos_next = 0;
	}
	
	
	var nextimg;
	eval("nextimg = sls_a_" + slideshow_index + "[" + activepos_next + "].src;");
	
	
	
	
	
	if (!return_only_url)
		return Array(activepos, activepos_next, nextimg);
	else
		return nextimg;

}





function slideshow_swapimage(slideshow_index, elapsed_trans_time, notrans) {

	
	
	var trans_time = slideshow_trans_timers[slideshow_index];
	var curr_slideshow_autoresume;
	
		
	
	var ns4 = (document.layers) ? true : false;
	var isIE=document.all?1:0;
	var isOp=window.opera?1:0;	
	var isDOM=document.getElementById?1:0;
	var isMoz = isDOM && !isIE;
	
	


	var res = get_slideshow_nextimg(slideshow_index, notrans, false);
	var activepos = res[0];
	var activepos_next = res[1];
	var nextimg = res[2];

	
	if (activepos_next == activepos)			
		return;	
	
	
	
	
	
	
	var activepos_for_cookie;
	
	if (0 || ns4 || isOp || (trans_time == 0) || (!(isIE || isMoz)) || notrans)
	{
		
	
		
		
		
		
		
		
		var oldimg;
		
		if (typeof(oldimg_a[slideshow_index]) != "undefined")
			oldimg = oldimg_a[slideshow_index];
		else
			oldimg = null;
		
		
		var oldimg_prev = oldimg;
		
		
		
		
		var img;
		if (oldimg_prev == null)
		{
			
		} 
		else if (!isMoz)
		{			
			eval("img = document.slideshow_img_" + slideshow_index + "");

			oldimg = img.src;
			
			img.src = nextimg;
		}
		else
		{
			img = document.getElementById("slideshow_img_" + slideshow_index + "");
			
			oldimg = img.src;
			
			img.src = nextimg;
			
		}
			
		
		
		
		
		oldimg_a[slideshow_index] = oldimg;
		
		slideshow_activepos[slideshow_index] = activepos_next;
		activepos_for_cookie = activepos_next;
	}
	else	
	{
		var img;
		var div;
	
		if (isIE)
		{
			img = document.all["slideshow_img_" + slideshow_index + ""];
			div = document.all["slideshow_div_" + slideshow_index + ""];
		}
		else if (isMoz)
		{
			
		
			img = document.getElementById("slideshow_img_" + slideshow_index + "");
			div = document.getElementById("slideshow_div_" + slideshow_index + "");
		}
			
		
		
		
			var oldimg;
		
			if (typeof(oldimg_a[slideshow_index]) != "undefined")
				oldimg = oldimg_a[slideshow_index];
			else
				oldimg = null;
				
				
		
			var oldimg_prev = oldimg;
		
		
			eval("oldimg = sls_a_" + slideshow_index + "[" + activepos + "].src;");
			
						
			
						
			
			
			
			
			{
				
				if (isIE)
				{
					img.style.filter = "blendTrans(duration=" + trans_time + ");";
					img.filters.blendTrans.apply();
					img.src = oldimg;
					img.filters.blendTrans.play();
					
					
					
					
					
					div.style.backgroundRepeat = "no-repeat";
					div.style.width = div.width;
					div.style.height = div.height;
					div.style.backgroundImage = 'url(' + nextimg + ')';
					
					
					activepos_for_cookie = activepos;
				}
				else	
				{				
					
					
					img.style.MozOpacity = 0.99;
					img.src = oldimg;
					setTimeout("moz_trans(" + slideshow_index + ");", 1);		
					
					
					div.style.backgroundRepeat = "no-repeat";
					div.style.width = div.width;
					div.style.height = div.height;
					
					if (div.style.backgroundImage == "")
						div.style.MozOpacity = 0.3;
						
					div.style.backgroundImage = 'url(' + nextimg + ')';	
					
					img.style.MozOpacity = 0.98;
					img.src = oldimg;
					setTimeout("moz_trans(" + slideshow_index + ");", 1);		
					
					div.style.MozOpacity = 1;			
					
					
					activepos_for_cookie = activepos_next;	
				}
			}
			
		
		
		
		oldimg_a[slideshow_index] = oldimg;
		
		slideshow_activepos[slideshow_index] = activepos_next;
		
		
	}	
	
	
	if (typeof(setCookieF) != "undefined")
	{
		
		var cookies = activepos_for_cookie.toString();
		
		
		
		setCookieF("slsp_" + slideshow_index, cookies);
	}
	
}
	



	
function moz_trans(slideshow_index) {

	var img = document.getElementById("slideshow_img_" + slideshow_index + "");
	
	var opac = img.style.MozOpacity;
	opac -= 0.1;
	img.style.MozOpacity = opac;
	
	if (opac > 0)
	{
		var  trans_time = slideshow_trans_timers[slideshow_index];
		setTimeout("moz_trans(" + slideshow_index + ");", 100 * trans_time);
	}
}	
	



	
if (typeof(preload_imgs_a) == "undefined")	
	preload_imgs_a = Array();	
	
function preload(img_url) {

	
	var pos = preload_imgs_a.length;
	preload_imgs_a[pos]=new Image();
	setTimeout('preload_imgs_a['+pos+'].src = "' + img_url + '";', 1 + pos);

}	





function unborder_flash() {

	var theObjects = document.getElementsByTagName("object"); 
	
	for (var i = 0; i < theObjects.length; i++) 
	{ 
		theObjects[i].outerHTML = theObjects[i].outerHTML; 
	}
}
	



	
	

