// JavaScript Document

<!--
//alert(navigator.appName);

function disable(input){
	if(navigator.appName.indexOf('Netscape') ==-1){
	if(input=="oe"){
		document.wyszukiwanie1.kodOE.disabled=true;
		document.wyszukiwanie1.kodOE.value="Disabled";
		document.wyszukiwanie1.index.disabled=false;
	}
	else if(input=="index"){
		document.wyszukiwanie1.kodOE.disabled=false;
		document.wyszukiwanie1.index.disabled=true;
		document.wyszukiwanie1.index.value="Disabled";
		}
	}
		
}
function redirect(x){

if(document.wyszukiwanie.grupa.value==0)
{
document.wyszukiwanie.podgrupa.disabled=true;
document.wyszukiwanie.podgrupa.options[0].selected=true
}
else
{
document.wyszukiwanie.podgrupa.disabled=false;
document.wyszukiwanie.podgrupa.options[0].selected=true
}

for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
	for (i=0;i<group[x].length;i++){
	temp.options[i]=new Option(group[x][i].text,group[x][i].value)
	}temp.options[0].selected=true
	
//alert(document.wyszukiwanie.grupa.value);
}

function redirect2(){

var gr;
var pod; 
gr = document.wyszukiwanie.grupa.value;
pod = document.wyszukiwanie.podgrupa.value;
}

function go(){
location=temp.options[temp.selectedIndex].value
}

function go_anchor(n){
//alert(document.getElementById(n).offsetTop);
document.getElementById("poradnik_glowny").scrollTop = document.getElementById(n).offsetTop;
}

function Reset_values(input){
	
	if(input==1){
if(document.forms[0].index)document.forms[0].index.value='';
if(document.forms[0].kodOE)document.forms[0].kodOE.value='';
document.wyszukiwanie1.index.disabled=false;
document.wyszukiwanie1.kodOE.disabled=false;
	}
	if(input==2){
if(document.forms[1].Index_zam)document.forms[1].Index_zam.value='';
if(document.forms[1].zamiennik)	document.forms[1].zamiennik[0].selected = true;
	}
	if(input==3){
if(document.forms[2].grupa)	document.forms[2].grupa[0].selected = true;

redirect(document.forms[2].grupa.options.selectedIndex);

if(document.forms[2].rocznik)	document.forms[2].rocznik[0].selected = true;
if(document.forms[2].przod_tyl)	document.forms[2].przod_tyl[0].selected = true;
	}
};



var secs
var timerID = null
var timerRunning = false
var delay = 50

function InitializeTimer()
{
// Set the length of the timer, in seconds
secs = 4
StopTheClock()
StartTheTimer()
}
function StopTheClock()
{
if(timerRunning)
clearTimeout(timerID)
timerRunning = false
}
function StartTheTimer()
{
if (secs==0)
{
openFullscreen('intro.php');
}
else
{
self.status = secs
secs = secs - 1
timerRunning = true
timerID = self.setTimeout("StartTheTimer()", delay)
}
}

function openFullscreen(page) {
var yes = 1;
var no = 0;
var menubar = no; 
var scrollbars = no; 
var locationbar = no;
var directories = no; 
var resizable = no; 
var statusbar = no; 
var toolbar = no;
	if (navigator.appName == "Microsoft Internet Explorer"){ 
	windowprops = "width=" + (screen.width-10) + ",height=" + (screen.height-30) + ",top=0,left=0,fullscreen=1";
	}
	else { // i.e. if Firefox
	windowprops = "width=" + (screen.width-5) + ",height=" + (screen.height-30) + ",top=0,left=0";
	}
windowprops += (menubar ? ",menubars" : "") +
(scrollbars ? ",scrollbars" : "") +
(locationbar ? ",location" : "") +
(directories ? ",directories" : "") +
(resizable ? ",resizable" : "") +
(statusbar ? ",status" : "") +
(toolbar ? ",toolbar" : "");
window.open(page, 'fullPopup', windowprops);
window.opener = top; // this will close opener in ie only (not Firefox)
//window.close();
}

var ktory_otwarty=2;

function Wlacz_menu(ktore){
var slides = ['./images/menuleft_plus.gif', './images/menuleft_minus.gif'];
var zmiana=0;
if(ktory_otwarty != ktore){		
	 	for(i=0;i<200;i++){
		if(document.getElementById("layer_row"+i))document.getElementById("layer_row"+i).style.display="none";
		if(document.images["plus_"+i])document.images["plus_"+i].src = slides[0];
		}
}
	if(document.getElementById("layer_row"+ktore))
	{
		if(document.getElementById("layer_row"+ktore).style.display=="none" && zmiana==0)
		{
			document.getElementById("layer_row"+ktore).style.display="block";
			zmiana=1;	
			ktory_otwarty = ktore;
			document.images["plus_"+ktore].src = slides[1];		
		}
		if(document.getElementById("layer_row"+ktore).style.display=="block" && zmiana==0)
		{
			document.getElementById("layer_row"+ktore).style.display="none";
			zmiana=1;			
			document.images["plus_"+ktore].src = slides[0];	
		}				
	}
};

function Wlacz_menu_glowna(ktore){
	 	for(i=0;i<25;i++){
		if(document.getElementById("layer_row_glowna"+i))document.getElementById("layer_row_glowna"+i).style.display="none";
		}
		if(document.getElementById("layer_row_glowna"+ktore)){
		document.getElementById("layer_row_glowna"+ktore).style.display="block";
		}
};

function Popup_drukuj(page){
var yes = 1;
var no = 0;
var menubar = no; 
var scrollbars = no; 
var locationbar = no;
var directories = no; 
var resizable = no; 
var statusbar = no; 
var toolbar = no;

	if (navigator.appName == "Microsoft Internet Explorer"){ 
	windowprops = "width=" + 565 + ",height=" + 780 + ",top=0,left=0,fullscreen=0";
	}
	else { // i.e. if Firefox
	windowprops = "width=" + 565 + ",height=" + 780 + ",top=0,left=0,fullscreen=0";
	}
windowprops += (menubar ? ",menubars" : "") +
(scrollbars ? ",scrollbars" : "") +
(locationbar ? ",location" : "") +
(directories ? ",directories" : "") +
(resizable ? ",resizable" : "") +
(statusbar ? ",status" : "") +
(toolbar ? ",toolbar" : "");
window.open(page, 'WheelBearingKits_Printing', windowprops);
}

function error(tekst) {
        if (errfound) return;
                window.alert(tekst);
                
errfound = true;
}

function loading_page(){
document.getElementById("top_main").style.display="none";
document.getElementById("content_main").style.display="none";
document.getElementById("ladowanie").style.display="block";
}

function validate(input_lang) {
        errfound = false;
		if(input_lang=="PL") napis = "Musisz podać przynajmniej 3 znaki zestawu lub kodu OE!";
		if(input_lang=="EN") napis = "Please enter minimum 3 signs of kit or OE code!";

 		var bledy = "";
		var my_text=document.forms[0].index.value;
		var my_text2=document.forms[0].kodOE.value;
				       
		with (document.forms[0]) {
                if (my_text.length < 3 ){
					
					if(my_text2.length > 2 )bledy = "0";
					else bledy = "1";
					
				}
				else if  (my_text2.length < 3 ){
					
					if(my_text.length > 2 )bledy = "0";
					else bledy = "1";
					
				}
				
                if (bledy == "1")  error(napis); 
				else {
					 loading_page()
					}
              
        }
return !errfound;
}
function validate2(input_lang) {
        errfound = false;
		if(input_lang=="PL") napis = "Musisz podać przynajmniej 3 znaki zamiennika!";
		if(input_lang=="EN") napis = "Please enter minimum 3 signs!";

	    var bledy = "";
		var my_text=document.forms[1].Index_zam.value;
				       
		with (document.forms[1]) {
                if (my_text.length < 3 )  bledy = "1";

							//if (grupa.value == "0" && index.value == "")bledy += "3";

                if (bledy == "1")  error(napis); 
					else {
					 loading_page()
					}
          
                //if (bledy == "3")  error(napis3); 
        }
return !errfound;
}
function print_div()
{
var a = window. open('','Handbook_CX_Printing','scrollbars=yes,width=740,height=600');
a.document.open("text/html");

a.document.write('<html><head><link href="CX_style.css" rel="stylesheet" type="text/css" media="print"/></head><body style="background:#ffffff;">');
a.document.write(document.getElementById('poradnik_glowny').innerHTML);
a.document.write('</body></html>');
a.document.close();
a.print();
}

function drukuj_profilogram()
{
var a = window. open('','Profilogram','scrollbars=yes,width=500,height=600');
a.document.open("text/html");
a.document.write('<html><head><link href="CX_style.css" rel="stylesheet" type="text/css"/></head><body style="background:#ffffff;">');
a.document.write(document.getElementById('profilogram').innerHTML);
a.document.write('</body></html>');
a.document.close();
a.print();
}

function pelna_tabela(){

document.getElementById("content_middle").style.position="absolute";
document.getElementById("content_middle").style.background="#ffffff";
document.getElementById("content_middle").style.top="0px";
document.getElementById("content_middle").style.left="0px";
document.getElementById("content_middle").style.width="1020px";
document.getElementById("content_middle").style.height="592px";
if(document.getElementById("tabela_wynikow"))document.getElementById("tabela_wynikow").style.height= "510px";
if(document.getElementById("przyciski")){
document.getElementById("przyciski").style.position="absolute";
document.getElementById("przyciski").style.width="1020px";
document.getElementById("przyciski").style.background="#ffffff";
document.getElementById("przyciski").style.top=document.getElementById("content_middle").style.height;
document.getElementById("przyciski").style.left="0px";
}
if(document.getElementById("powieksz_button"))document.getElementById("powieksz_button").style.display="none";
if(document.getElementById("pomniejsz_button"))document.getElementById("pomniejsz_button").style.display="inline";

if(document.getElementById("zamiennik"))document.getElementById("zamiennik").style.display="none";
if(document.getElementById("grupa"))document.getElementById("grupa").style.display="none";
if(document.getElementById("podgrupa"))document.getElementById("podgrupa").style.display="none";
if(document.getElementById("rocznik"))document.getElementById("rocznik").style.display="none";
if(document.getElementById("przod_tyl"))document.getElementById("przod_tyl").style.display="none";

}
function mala_tabela(){

if(document.getElementById("content_middle")){
document.getElementById("content_middle").style.position="relative";
document.getElementById("content_middle").style.background="none";
document.getElementById("content_middle").style.top="0px";
document.getElementById("content_middle").style.left="0px";
document.getElementById("content_middle").style.width="696px";
document.getElementById("content_middle").style.height="255px";
}
//if(document.getElementById("tabela_wynikow"))document.getElementById("tabela_wynikow").style.height="198px";
if(document.getElementById("tabela_wynikow"))document.getElementById("tabela_wynikow").style.height="195px";
if(document.getElementById("przyciski")){
document.getElementById("przyciski").style.position="relative";
document.getElementById("przyciski").style.width="100%";
document.getElementById("przyciski").style.background="none";
document.getElementById("przyciski").style.top=document.getElementById("content_middle").style.height;
document.getElementById("przyciski").style.top="0px";
document.getElementById("przyciski").style.left="0px";
}
if(document.getElementById("powieksz_button"))document.getElementById("powieksz_button").style.display="inline";
if(document.getElementById("pomniejsz_button"))document.getElementById("pomniejsz_button").style.display="none";

if(document.getElementById("zamiennik"))document.getElementById("zamiennik").style.display="inline";
if(document.getElementById("grupa"))document.getElementById("grupa").style.display="inline";
if(document.getElementById("podgrupa"))document.getElementById("podgrupa").style.display="inline";
if(document.getElementById("rocznik"))document.getElementById("rocznik").style.display="inline";
if(document.getElementById("przod_tyl"))document.getElementById("przod_tyl").style.display="inline";
//if(document.getElementById("robot"))document.getElementById("robot").style.display="block";
//if(document.getElementById("robot_on"))document.getElementById("robot_on").style.display="block";
//if(document.getElementById("robot2"))document.getElementById("robot2").style.display="block";
}
function ustaw_robota(){
//alert(screen.width);
if (navigator.appName == "Microsoft Internet Explorer"){ 
padding_left=(parseInt(screen.width) - 1020)/2; 
	}
	else { // i.e. if Firefox
padding_left=(parseInt(window.innerWidth) - 1020)/2; 
	}
padding_left=20;
document.getElementById("robot").style.left=padding_left + "px";
}
function wylacz_robota(){
document.getElementById("robot").style.display="none";
document.getElementById("wylacz_robota").style.display="none";
document.getElementById("wlacz_robota").style.display="block";
}
function wlacz_robota(){
document.getElementById("robot").style.display="block";
document.getElementById("wylacz_robota").style.display="block";
document.getElementById("wlacz_robota").style.display="none";

}