// JavaScript Document
function zoom(url, w, h)
{
	open_window(SITE_URL+'inc/zoom.php?lang='+LANG+'&url='+url+'&w='+w+'&h='+h, 400, 400, 'WinZoom', 'scrollbars=1');
}

function zoom_realizations(id, w, h)
{
	open_window(SITE_URL+'inc/zoom_realizations.php?lang='+LANG+'&id='+id+'&w='+w+'&h='+h, 400, 400, 'WinRealizations', 'scrollbars=1');
}

function cert_pages(cert_id)
{
	open_window(SITE_URL+'inc/cert_pages.php?lang='+LANG+'&id='+cert_id, 780, 550, 'WinPages', ',scrollbars=1');
}

function win_colors(struct_id, prod_id)
{
	open_window(SITE_URL+'inc/win_colors.php?lang='+LANG+'&struct_id='+struct_id+'&prod_id='+prod_id, 580, 550, 'WinColors', ',scrollbars=1');
}

function win_pattern(id)
{
	open_window(SITE_URL+'inc/win_patterns.php?lang='+LANG+'&id='+id, 350, 400, 'WinPattern', ',scrollbars=0');
}

function on_focus_find()
{
	document.forms['form_searcher'].elements['findq'].value = '';
}

function win_calc()
{
	open_window(SITE_URL+'kalkulator', 680, 720, 'WinCalc', ',scrollbars=1');
}

function win_color_fast()
{
	open_window(SITE_URL+'kolory', 950, screen.availHeight, 'WinKolorFAST', ',scrollbars=1');
}

function print_window(c, d, e)
{
	url = SITE_URL+'print_page.php?a='+LANG;
	if(c.length > 0)
		url = url +'&c='+c;
	if(d.length > 0)
		url = url +'&d='+d;
	if(e.length > 0)
		url = url +'&e='+e;
	open_window(url, 600, screen.availHeight - 200, 'WinPrint', ',scrollbars=0');
}

function switch_tr(type, id, what)
{
	switch(type)
	{
		case 1:
		{
			bg_1 = '#e7eefa';
			bg_0 = 'transparent';
			break;
		}
		
		case 2:
		{
			bg_1 = '#e5e5e5';
			bg_0 = 'transparent';
			break;
		}
		
		case 3:	//	menu
		{
			bg_1 = '#dcdcdc';
			bg_0 = '#e9e9e9';
			break;
		}

		case 3:	//	realizacje
		{
			bg_1 = '#000000';
			bg_0 = '#b2b2b2';
			break;
		}
	}

	eval('document.getElementById(id).style.backgroundColor = bg_' + what +';');  
}

function set_border_color(type, id, what)
{
	switch(type)
	{
		case 1:		//	realizacje
		{
			bg_1 = '#000000';
			bg_0 = '#b2b2b2';
			break;
		}
	}
	
	eval('document.getElementById(id).style.borderColor = bg_' + what +';');  
}

function set_class(id, class_name)
{
	document.getElementById(id).className = class_name; 
}

var sub_menu_flag = 0;
var last_id;

function show_menu(id, submenubool, activemenubool)
{
	if(last_id != id)
	{
		last_id = id;
		hide_all();
	}
	
// 	alert(menu_bool);
// 	alert(js_bool);
	
	if(js_bool == 1 && menu_bool == 1 && activemenubool == 1)		
		document.getElementById('img_' + id).src = img_menu_2[id].src;

	if(js_bool == 1 && submenubool == 1 && menu_bool == 1)
	{
		document.getElementById('sm_' + id).style.visibility = 'visible';
//		anim_menu('sm_' + id);
	}
}

function anim_menu(id)
{
	if(document.getElementById(id).style.visibility == 'visible')
	{
		if(document.getElementById(id).style.top < (global_menu_pos[id] - 12) + 'px')
		{
			new_top = parseInt(document.getElementById(id).style.top) + 4; 
			document.getElementById(id).style.top = new_top + 'px';
			setTimeout('anim_menu("' + id + '")', 20);
		}
	}
}

function hide_menu(id, submenubool, activemenubool)
{
	if(activemenubool == 1)		
		document.getElementById('img_' + id).src = img_menu_1[id].src;
}

function hide_submenu(id)
{
	document.getElementById(id).style.top = global_start_pos['sm_' + id];
	document.getElementById(id).style.visibility = 'hidden';
	sub_menu_flag = 0;
}

function switch_menu(id, what)
{
	if(what == 1)
	{
		document.getElementById('td1_'+id).className = 'menu_1_on';
		document.getElementById('td2_'+id).className = 'menu_2_on';
		document.getElementById('sm_right_'+id).className = 'menu_3_on';
	}
	else
	{
		document.getElementById('td1_'+id).className = 'menu_1';
		document.getElementById('td2_'+id).className = 'menu_2';
		document.getElementById('sm_right_'+id).className = 'menu_3';
	} 
}

js_bool = 1;
