var czy_debug=false;
//var on=0;


function czekajAplet(count,mix) {
    this.Log(count);
    if (document.applets["aplet"].selectMixer==null && count > 0) {
       setTimeout( function() {czekajAplet( --count,mix );}, 200 );
    }
    else if (document.applets["aplet"].selectMixer!=null) {
     document.applets["aplet"].selectMixer(ob.mix);
     document.applets["aplet"].buttonClick();
    }
    else {
       alert( 'applet failed to load' );
    }


    this.Log("poczekalem");
}

// Check if applet is active
function isAppletActive(app) {
	var active=false;

	try {
		active=app.isActive(); // IE check
	} catch(Ex){
		try {
			active=app.isActive; // Firefox check
		} catch(Ex){
			// Is there a problem?!?
		}
	}

	return active;
}

// Wait until applet is active
function WaitAppletLoaded(strapplet) {
	var app=null; // where I put applet
	app=document.getElementById(strapplet);

	if((app==null) || (typeof(app)=="undefined")) {
		// Do nothing
	} else {
		// Wait until applet is active
		while(!isAppletActive(app)){
			// Wait again
			setTimeout( function () {WaitAppletLoaded(strapplet);} , 1000);}
	}
}








function cos()
{
    document.write("lol");

}

function writeData(data)
{

    location.href="index.php?"+encodeURIComponent(data);



}





//Editor.prototype.czytaj = function(evt){
//        this.Log(evt.keyCode+"");
//    }
  function czytajCookies(nazwa){
          if (document.cookie!="") {
	    var toCookie=document.cookie.split("; ");
	        for (i=0; i<toCookie.length; i++) {
	            var nazwaCookie=toCookie[i].split("=")[0];
	            var wartoscCookie=toCookie[i].split("=")[1];
	            if (nazwaCookie==nazwa) return unescape(wartoscCookie)
	        }
	    }


              document.cookie = nazwa + "=" + "0" +"; ";


           return "0";

     }
  function zapiszCookies(nazwa,wartosc){
           var dzis = new Date();
         // this.Log(dzis.getMonth());
          if (document.cookie!="") {
	    var toCookie=document.cookie.split("; ");
	        for (i=0; i<toCookie.length; i++) {
	            var nazwaCookie=toCookie[i].split("=")[0];
	            var wartoscCookie=toCookie[i].split("=")[1];
	            if (nazwaCookie==nazwa)
                        {
                            document.cookie=nazwaCookie+"=;expires="+dzis.getMonth()-1;


                        }
	        }
	    }


              document.cookie = nazwa + "=" + wartosc +"; ";
             // this.Log("ok");

           return "ok";

     }

function setSize(rozmiar)
{
    if(rozmiar!=ob.rozmiar)
    {
        ob.rozmiar=rozmiar;
        ob.Log(rozmiar);

        ob.usunSpan();
        ob.odnosniki();
        zapiszCookies("rozmiar",rozmiar);
        ob.Log(ob.rozmiary[ob.rozmiar]);

    }
    


}

function instrukcja()
{
    if(ob.instrukcja)
    {

        jQuery("#googlemaps").hide("slide", {direction: 'right'}, 1000);
        ob.instrukcja=false;
    }
    else
    {

        jQuery("#googlemaps").show("slide", {direction: 'right'}, 1000);
        ob.instrukcja=true;
    }



}



//funkcja ktora wywolujuje aplet , przesyla cyfre zwrocona przez serwer

function dalej(cyfra)
{
	
var han=ob;



	if(ob.isPopup)
{
  han=ob.ob1ref;

}
    
    if(han.blok_klaw)
    {
         if(!han.isPopup)
        {
            $jq("#id"+han.buf).css({'background-color' : 'white'});
            $jq('#id1').focus();
        }
        han.buf=cyfra;
      //  this.Log($jq("#id"+this.buf).attr('id'));
         if(!han.isPopup)
        {
            $jq("#id"+han.buf).css({'background-color' : 'yellow'});
        }
        clearTimeout( han.t);

        if(han.buf.length==2 && han.isPopup)
        {
           han.Log("2 znaki");
           han.blok_klaw=false;
            han.koniecCzasu();
        }
        else
        {
             han.t=setTimeout(function () {
                if(han.isPopup)
              {

                     han.han1ref.buf=han.buf;

                    han.han1ref.koniecCzasu();
              }
                  else
              {
                  $jq("#id"+han.buf).css({'background-color' : 'white'});
                    han.koniecCzasu();
                 // han.wcisnij(han.elementsWithId[han.buf]);
              }
            //han.koniecCzasu();
               han.blok_klaw=false;
             // this.Log("ok");
            },2000);

            han.blok_klaw=true;

        }
        
    }
    else
    {
          han.buf="";
          han.buf=cyfra;
          han.blok_klaw=true;
          if(!han.isPopup)
          {
            $jq("#id"+han.buf).css({'background-color' : 'yellow'});
          }
          han.t=setTimeout(function () {
          han.koniecCzasu();

        },2000);

    }





}


function wylaczAplet()
{
    top.window.parent.ob.Log("------wylaczam aplet-------");
    top.window.parent.document.applets["aplet"].stopRecording();



}
function focuss(cyfra) {

dalej(cyfra);
//ob.Log("dostalem "+cyfra);
//var han=ob;
//
//if(ob.timerApletu==null)
//{
//    ob.Log("nowy timer");
//    ob.timerApletu=setTimeout(function () {
//        ob.Log("klikam w button");
//        document.applets["aplet"].stopRecording();
//    },20000);
//}
//else
//{
//    ob.Log("reset timera");
//    clearTimeout(ob.timerApletu);
//    ob.timerApletu=setTimeout(function () {
//        ob.Log("klikam w button");
//        document.applets["aplet"].stopRecording();
//    },20000);
//}
//
//
//
//
// //cyfra=cyfra.substring(1,2);
//
//ob.Log("cyfra= "+cyfra);
//clearTimeout(ob.timerRozpoznawania);
//var liczba=parseInt(cyfra);
//
//if(liczba>9 && liczba<20)
//{
//	dalej(cyfra);
//
//}
//else
//{
//	if(ob.poprzedniNumer>0)
//	{
//		dalej((ob.poprzedniNumer+liczba).toString(10));
//
//		ob.Log("zlozylem"+(ob.poprzedniNumer+liczba).toString(10));
//		ob.poprzedniNumer=-1;
//	}
//	else
//	{
//		if(liczba<20)
//		{
//			dalej(cyfra);
//			ob.poprzedniNumer=-1;
//		}
//		else
//		{
//			ob.poprzedniNumer=liczba;
//			 ob.timerApletu=setTimeout(function () {
//        			dalej(ob.poprzedniNumer.toString(10));
//				ob.poprzedniNumer=-1;
//
//    			},500);
//
//		}
//
//	}
//
//}


}
function apletZaladowany()
{
  var han =ob;
  ob.Log("Aplet Zaladowany mixer= "+ob.mix);
  if(ob.isFirefox)
  {

       ob.Log("fir");

      //  document.getElementById( "ap1" ).selectMixer(ob.mix);

        setTimeout(function () {
        ob.Log("selectmixer");
        // document.applets["aplet"].buttonClick();
        document.getElementById( "ap1" ).selectMixer(ob.mix);
      
        ob.Log("poczekalem 2 s");
     },500);


   }
   else
   {
        ob.Log("niefir");
        document.applets["aplet"].selectMixer(ob.mix);

   }



  
  //document.applets["aplet"].buttonClick();
  if(czytajCookies("wlaczonyAplet")=="1")
  {

     if(ob.isFirefox)
    {

       // ob.Log("startlistening");
       // document.getElementById( "ap1" ).startListening();


          setTimeout(function () {
                ob.Log("startlistening");
                // document.applets["aplet"].buttonClick();
               //  jQuery("#ap1").startListening();
                 document.getElementById( "ap1" ).startListening();
                ob.Log("poczekalem 2 s");
             },600);


    }
    else
    {

         document.applets["aplet"].startListening();
    }
                                    

//    ob.Log("nowy timer");
//    ob.timerApletu=setTimeout(function () {
//
//        // document.applets["aplet"].buttonClick();
//        //document.applets["aplet"].stopRecording();
//         if(ob.isFirefox)
//        {
//
//
//             setTimeout(function () {
//                ob.Log("stoprecording");
//                // document.applets["aplet"].buttonClick();
//                document.getElementById( "ap1" ).stopRecording();
//
//                ob.Log("poczekalem 2 s");
//             },600);
//
//        }
//        else
//        {
//
//             document.applets["aplet"].stopRecording();
//        }
//
//
//     },20000);

  }
  else
  {
       ob.Log("aplet nie wlaczony");
  }

      $jq("input").keydown(function(e) {

                ob.Log(e.which);
               // alert(e.which);

                    });

  //  var data = "Core Selectors Attributes Traversing Manipulation CSS Events Effects Ajax Utilities".split(" ");
       
          //  $jq("input").autocompleteArray(["Allen","Albert","Alberto","Alladin"], { minChars:2 });
   //$jq("input").autocomplete(data, {minChars:1},ob);




}
//aplet wywluje ta funkcje gdy przestaje rozpoznawac
function wylaczTimer() {
   
   ob.Log("wylaczam rozpoznawanie");
   zapiszCookies("wlaczonyAplet","0");
}


//aplet wywluje ta funkcje gdy zaczyna rozpoznawac
function wlaczTimer() {
  var han=ob;
  ob.wlaczonyAplet=true;
  zapiszCookies("wlaczonyAplet","1");
//if(ob.timerApletu==null)
//{
//    ob.Log("nowy timer");
//    ob.timerApletu=setTimeout(function () {
//        ob.Log("klikam w button");
//        document.applets["aplet"].stopRecording();
//    },20000);
//}
//else
//{
//    ob.Log("reset timera");
//    clearTimeout(ob.timerApletu);
//    ob.timerApletu=setTimeout(function () {
//        ob.Log("klikam w button");
//        document.applets["aplet"].stopRecording();
//    },20000);
//}

    
    
}



function selectedMixer(index)
{

  zapiszCookies("mixer",index);
  ob.mixer=index;


}





function Obiekt()
{









}
Obiekt.prototype.formularz=false;
Obiekt.prototype.instrukcja=false;
Obiekt.prototype.autokompleter=false;
Obiekt.prototype.autokompleter_wsk=false;
Obiekt.prototype.rozmiar=1
Obiekt.prototype.imie="cos"
Obiekt.prototype.label="";
Obiekt.prototype.onoff=0;
Obiekt.prototype.elementsWithId=new Array(1000);
Obiekt.prototype.licz=1;
Obiekt.prototype.mixer=-1;
Obiekt.prototype.klaw=true;
Obiekt.prototype.blok_klaw=false;
Obiekt.prototype.buf="";
Obiekt.prototype.t="";
Obiekt.prototype.tmp="";
Obiekt.prototype.elem;
Obiekt.prototype.wyswPrzyciski=true;
Obiekt.prototype.isOpera=false;
Obiekt.prototype.isFirefox=false;
Obiekt.prototype.isChrome=false;
Obiekt.prototype.isIE=false;
Obiekt.prototype.saSpany=false;
Obiekt.prototype.isPopup=false;
Obiekt.prototype.oknoGB=null;
Obiekt.prototype.ob1ref=null;
Obiekt.prototype.apletZaladowany=false;
Obiekt.prototype.tag="";
Obiekt.prototype.zmiana="nic";
Obiekt.prototype.id="00";
Obiekt.prototype.wlacz_img=new Image();
Obiekt.prototype.wylacz_img=new Image();
Obiekt.prototype.male_img=new Image();
Obiekt.prototype.wielkie_img=new Image();
Obiekt.prototype.timerApletu=null;//uchwyt do timera
Obiekt.prototype.timerRozpoznawania=null;//uchwyt do timera
Obiekt.prototype.poprzedniNumer=-1;//uchwyt do timera
Obiekt.prototype.wlaczonyAplet=false;
Obiekt.prototype.mix=0;
Obiekt.prototype.rozmiary =new Array("xx-small","x_small","larger");
Obiekt.prototype.napis=function (cos)
{
  //  this.Log(cos);


}
Obiekt.prototype.isImageOk=function (img)
{
    // During the onload event, IE correctly identifiesany images that
    // weren’t downloaded as not complete. Others should too. Gecko-based
    // browsers act like NS4 in that they report this incorrectly.
    if (!img.complete) {
        return false;
    }
    // However, they do have two very useful properties:naturalWidth and
    // naturalHeight. These give the true size of the image. If it failed
    // to load, either of these should be zero.
    if (typeof img.naturalWidth!= "undefined" && img.naturalWidth== 0) {
        return false;
    }
    // No other way of checking: assume it’s ok.
    return true;
}
//Call this function onLoad of body tag
Obiekt.prototype.checkImages=function(delay,licznik) {
    var zaladowane=true;
    for (var i = 0; i < document.images.length; i++) {
        if (!this.IsImageOk(document.images[i])) {
            zaladowane= false;

        }
    }
    if(zaladowane)
    {
        this.odnosniki()

    }
    else
    {
        if(licznik<1)
        {
            return false;



        }
        else
        {
           licznik=licznik-1;
           setTimeout(function(){delay,licznik},delay);
        }


    }
    return true;
}


Obiekt.prototype.Log=function(co)
{

  if( czy_debug )
        {
           if(this.isPopup)
               {
                    //alert("ok");
                    top.window.parent.console.log(co);
               }
               else
               {
                     console.log(co);
               }



        }

}



Obiekt.prototype.sprawdzPrzegladarke=function()
{
//    var browser=navigator.appName;
//    var b_version=navigator.appVersion;
//    var version=parseFloat(b_version);
//
//    if(browser=="Opera")
//    {
//        this.isOpera=true;
//        this.Log("op");
//    }
//    else
//    {
//        if (browser=="Netscape")
//        {
//            this.isFirefox=true;
//            this.Log("fir");
//        }
//        else
//        {
//            if (browser=="Microsoft Internet Explorer")
//            {
//
//                this.isIE=true;
//                this.Log("ie");
//            }
//            else
//            {
//
//                 this.Log("Neznana przegladarka");
//
//            }
//        }
//     }

    if ($jq.browser.mozilla && $jq.browser.version >= "1.8" ){
        this.isFirefox=true;
        this.Log("Przegladarka Firefox");
    }

    // Safari
    if( $jq.browser.safari ){
         this.isSafari=true;
         this.Log("Przegladarka Safari");

    }

    // Google Chrome
    if( $jq.browser.chrome){
         this.isFirefox=true;
         this.Log("fir");

    }

    // Opera
    if( $jq.browser.opera){
       
         this.isOpera=true;
         this.Log("Przegladarka Opera");

    }

    // IE6 i starsze
    if ($jq.browser.msie && $jq.browser.version <= 6 ){
         this.isIE=true;
         this.Log("Przegladarka IE starsza ");

    }

    // IE7/IE8
    if ($jq.browser.msie && $jq.browser.version > 6){
         this.isIE=true;
         this.Log("Przegladarka IE nowsza");

    }



}

Obiekt.prototype.doGetCaretPosition=function(ctrl, pos){
	var CaretPos = 0;	// IE Support
	if (document.selection) {
	ctrl.focus();
		var Sel = document.selection.createRange ();
		Sel.moveStart ('character', -ctrl.value.length);
		CaretPos = Sel.text.length;
	}
	// Firefox support
	else if (ctrl.selectionStart || ctrl.selectionStart == '0')
		CaretPos = ctrl.selectionStart;
	return (CaretPos);
}
Obiekt.prototype.setCaretPosition=function(oField, iCaretPos){

// IE Support
if (this.isIE) {

// Set focus on the element
oField.focus ();

// Create empty selection range
var oSel = document.selection.createRange ();

// Move selection start and end to 0 position
oSel.moveStart ('character', -oField.value.length);
oSel.moveEnd ('character', -oField.value.length);
// Move selection start and end to desired position
oSel.moveStart ('character', iCaretPos);
oSel.moveEnd ('character', 0);
oSel.select ();
}
else if (oField.selectionStart || oField.selectionStart == '0') {
//oField.selectionStart = 0;
//oField.selectionEnd = iCaretPos;
//oField.focus ();
  oField.focus();
  oField.setSelectionRange(iCaretPos, iCaretPos);


}
}





Obiekt.prototype.simulateKeyPress=function(){
//this.Log("d2");
 // //var evt = document.createEvent("KeyboardEvent");
 //  this.Log("d1");

 // evt.initKeyEvent("keypress", true, true, window, false, false, false, false, 0x28, 0);
   e = $jq.Event("keydown");
   e.which = 28;
   $jq("input").trigger(e);
  // event = document.createEvent("KeyboardEvent");
   //event.initKeyEvent("keypress", true, true, document.defaultView, false, false, false, false, 0x29, 0);
 //
 //  this.Log("d2");
  //var canceled = !body.dispatchEvent(event);
  //if(canceled) {
    // A handler called preventDefault
 //   this.Log("canceled");
 // } else {
    // None of the handlers called preventDefault
//    this.Log("not canceled");
 // }
}




Obiekt.prototype.init=function(){

    

    this.wlacz_img.src="VVC/images/wlacz.png";
    this.wylacz_img.src="VVC/images/wylacz.png";

    this.sprawdzPrzegladarke();





    if(czytajCookies("onoff")==1)
    {

    }
    else
    {


    }

    if(this.wyswPrzyciski)
    {
  //   $jq('body').append('<form class="przycisk"><button  onclick="ob.on_off();" type=button><IMG id="on_off" class="on_off" SRC="wlacz.png" ALT=""></button>  </form>');
     $jq('body').append('<img  id="on_off" src="wlacz.png" class="przycisk">');
     $jq('#on_off').click(function (){
     


        ob.on_off();




    });

   }


    setTimeout(function () {
                      //  han.koniecCzasu();
                       // $jq('#contact_name').focus();
                       //  this.Log("contact name focus");
                        },1000);
    
}



Obiekt.prototype.on_off=function (){

  this.Log("394: czy spany  ");
  //do apletu
  $jq('#on_off')[0].src=this.wylacz_img.src;

   if(this.instrukcja)jQuery("#googlemaps").hide("slide", {direction: 'right'}, 1000);

    this.instrukcja=false;

  if(!this.saSpany)
  {
     // this.Log("425");
      
      $jq(document.getElementsByTagName('on_off')[0]).css( {'src' : 'wylacz.png'});
      if(!this.apletZaladowany)
      {
             this.Log("458: przeszlo");
            $jq("body").append('<applet id="ap1" name="aplet" class="ap2" width="135" height="244" code="VoiceLabRecorder.SwingRecorder.class" archive="VVC/VoiceLabRecorder.jar"  ><PARAM NAME=recognizeType VALUE="16"></applet>');
            this.apletZaladowany=true;
            
      }
      else
      {
        document.getElementById( "ap1" ).style.visibility='visible';
      }

       
      
      this.Log("463: przeszlo");
     // document.getElementById( "ap1" ).style.width='138';
     // document.getElementById( "ap1" ).style.height='311';
     
           this.odnosniki();
           zapiszCookies("onoff","1");


        this.Log("try set focus");
        var currentDoc = document;
        var currentWin = currentDoc.defaultView;
        var cos=document.getElementById( "id1" );
       // this.performEvent("mouseover",cos,currentWin);
       // this.performEvent("mousedown",cos,currentWin);
       // this.performEvent("click",cos,currentWin);
      //  this.performEvent("mouseup",cos,currentWin);

//          han=this;
//          setTimeout(function () {
//
//            var iframe = $jq("#GB_frame")[0];
//            han.Log(iframe.id);
//            iframe.focus();
//            iframe.contentWindow.focus();
//            iframe.contentDocument.body.focus();
//            iframe.contentDocument.getElementById('moje_pole').focus();
//             han.Log("ok");
//             han.Log(iframe.contentDocument.getElementById('moje_pole').id);
//            },5000);







     $jq('#id1').focus();
         this.saSpany=true;
  }
  else
 {
    
    





    $jq('#on_off')[0].src=this.wlacz_img.src;
    document.getElementById( "ap1" ).style.visibility='hidden';

    this.Log("394: turn off");
    this.usunSpan();
    zapiszCookies("onoff","0");
    this.saSpany=false;


 }
};


Obiekt.prototype.czytaj=function (imie){
 this.Log("imie");
};
Obiekt.prototype.czytaj2=function (){
  this.Input.value=this.Input.value+'lol';
  this.Log(this.Input.value);
  // this.Log(window.frames[0].ob1);
    this.Log("z glownego");

};
Obiekt.prototype.Klik=function(element,event)
{

if (document.createEventObject){
    // dispatch for IE
    var evt = document.createEventObject();
    return element.fireEvent('on'+event,evt)
}
else{
    // dispatch for firefox + others
    var evt = document.createEvent("HTMLEvents");
    evt.initEvent(event, true, true ); // event type,bubbling,cancelable
    return !element.dispatchEvent(evt);
}

}

Obiekt.prototype.simulateClick=function(elId) {
    var evt;
    var el = document.getElementById(elId);
    if (document.createEvent){
        evt = document.createEvent("MouseEvents");
        evt.initMouseEvent("click", true, true, window,0, 0, 0, 0, 0, false, false, false, false, 0, null);
        }
    (evt)? el.dispatchEvent(evt):(el.click && el.click());
}

Obiekt.prototype.encode=function(url)
{
var dana=" ";
for(var i =0 ;i<url.length;i++)
{
    if(url[i]=="?")
    {
        return url.substring(i+1,url.length);

    }
}

return "";
}

Obiekt.prototype.performEvent=function(type,element,win){

    this.Log("mouse event    743");
    if(!this.isIE)
    {
        var clickEvent = element.ownerDocument.createEvent('MouseEvents');
        clickEvent.initMouseEvent( type, true, true, element.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
        //clickEvent.initEvent( type, true, true);
        element.dispatchEvent(clickEvent);
    }

}
// to co sie dzieje gdy w popupie wybierzemy cos z wirtualnej klawiatury
Obiekt.prototype.koniecCzasu=function()
{
    this.Log("koniec czasu");
    var enter=false;
    var backspace=false;
    jQuery("#id"+this.buf).css({'background-color' : 'white'});
    this.blok_klaw=false;
    //this.bufor="";
    // this.Log("477: isPopup= "+this.isPopup);
    // this.buf=parseInt(buf);
  //  var l=parseInt(this.buf);
    l=this.buf;

    if(l.length>parseInt(this.licz).length)
    {
       l=l.substring(l.length-2,l.length);


    }
   this.Log("KONIEC CZASU   "+l);





    //obsluga textowego pola formularza
    if(this.oknoGB==null)
        {
        //  this.Log("ok");

        }








//this.Log("linia 556");
 if(this.isPopup==true && this.autokompleter && parseInt(l)<10)
 {
   
   this.autokompleter_wsk.move(parseInt(l)-1);
   this.autokompleter_wsk.select2();
   this.autokompleter=false;
   this.Log("auto true");

 }
 else if(this.isPopup==true)
   
   //  if(this.oknoGB && this.oknoGB.ob1)
    {



   //   this.Log("572");
       var pos=this.doGetCaretPosition(this.Input);
       var pocz="";
       var koniec="";
       var znak="";
     //  this.Log("l= "+l);
       switch (l)
       {


         case '61':   //backspace
            backspace=true;
            //if(this.Text.length>0)
            //{
            //    this.Text=this.Text.substring(0,this.Text.length-1 );
            //    this.Input.value=this.Text;
          //  }

           break;



          case '60':

            if(!this.isIE)
            {
               this.Log("this.id= "+this.id);
               this.Log("this.tag= "+this.tag);

               top.window.parent.ob.elem.value=document.getElementsByTagName(this.tag)[0].value;

                top.window.parent.ob.isPopup=false;
                top.window.parent.ob.zmiana="zmiana";
                //this.Log("top.window.parent.ob.isPopup= "+top.window.parent.ob.isPopup);

                parent.parent.GB_hide();
                top.window.parent.ob.elem.focus();

                this.Log("rozpoznano 60");
                enter=true;
            }
            else
            {
               // top.window.parent.ob.elem.value=document.getElementsByTagName(this.tag)[0].value;
               /*
                top.window.parent.ob.isPopup=false;
                parent.parent.GB_hide();
                */

                this.Log("this.id= "+this.id);
               this.Log("this.tag= "+this.tag);

               top.window.parent.ob.elem.value=document.getElementsByTagName(this.tag)[0].value;

                top.window.parent.ob.isPopup=false;
                top.window.parent.ob.zmiana="zmiana";
                //this.Log("top.window.parent.ob.isPopup= "+top.window.parent.ob.isPopup);

                parent.parent.GB_hide();
               // top.window.parent.ob.elem.focus();

                this.Log("rozpoznano 60");
                enter=true;



            }
          break;



          case '1':
            znak= "1";


          break;

          case '2':
            znak= "2";

          break;


          case '3':
            znak="3";

          break;

          case '4':
            znak= "4";

          break;


          case '5':
           znak= "5";

          break;


          case '6':
            znak= "6";

          break;


          case '7':
            znak= "7";

          break;

          case '8':
            znak= "8";

          break;


          case '9':
            znak= "9";

          break;


          case '0':
            znak= "0";

          break;




          //zmiana wielkosci liter
          case '50':

            if(!ob1.isShift)//jesli male litery
            {
              this.Log("zmiana na duze");
              // jQuery('body').removeClass('klawa_mala').addClass('klawa_duza');

              //  jQuery('body').style.backgroundImage.src =this.wielkie_img.src;
                 jQuery('body').css('background','url("'+this.wielkie_img.src+'") no-repeat center top');
                ob1.isShift=true;
            }
            else
            {
                // jQuery('body').removeClass('klawa_duza').addClass('klawa_mala');
                this.Log("zmiana na male");
                // jQuery('body').style.backgroundImage.src =this.male_img.src;
                 jQuery('body').css('background','url("'+this.male_img.src+'") no-repeat center top');

                 ob1.isShift=false;
            }
           // this.Log("zmiana klawy");
          break;


          case '51':
            znak= "/";

          break;

          case '52':
            znak= " ";

          break;

          case '53':
            znak= ".";

          break;

          case '54':
            znak= ",";

          break;

          case '55':
            znak= "@";

          break;

          case '56':


          if(pos>0)
           {
               this.Log("pos = "+ pos);
             
             pos=pos-1;

               this.Log("pos = "+ pos);

           }

          // jQuery('input').event.trigger({ type : 'keypress', which : "j".charCodeAt(0) });

           // this.Text=this.Text+ "0";
        //  jQuery(this.Input).event.trigger({ type : 'keypress', which : "j".charCodeAt(0) });
           // jQuery(this.Input).trigger( "keypress", [13] );
          break;

          case '57':// strzalka w gore
              //  jQuery(this.Input).trigger( "keyup" );
                //create event var
               

              //  jQuery(this.Input).event.trigger({ type : 'keypress', which : "j".charCodeAt(0) });
              // this.Input.value="ok";
            // this.Log("scroll position = "+ jQuery(this.Input).scrollTop());
             jQuery(this.Input).scrollTop(jQuery(this.Input).scrollTop()-10);

             if(pos<=1)break;
               for(var i=pos-1;i>=0;i--)
               {

                 if(this.Text[i]/*charCodeAt(i)*/=='\n')
                 {
                       this.Log(this.Text.charCodeAt(i)+ " ok");
                       pos=i;
                       break;

                 }


               }
               

            znak="";
           // znak= "0";
           this.Log("keyup");

          break;

          case '58'://  strzalka w dol

              this.Log("pos = "+ pos);
               jQuery(this.Input).scrollTop(jQuery(this.Input).scrollTop()+10);

               if(pos<=1)break;
               var nizej=false;
               for( i=pos-1;i<this.Text.length;i++)
               {

                 if(this.Text[i]/*charCodeAt(i)*/=='\n')
                 {
                       if(nizej)
                       {
                         pos=i;
                         break;

                       }
                       else
                       {

                          nizej=true;
                       }

                      // this.Log(this.Text.charCodeAt(i)+ " ok");



                 }

                 if(i==this.Text.length-1)pos=this.Text.length;
               }
              
                 this.Log("pos = "+ pos);



            

          break;

          case '59':

          if(pos<this.Input.value.length)
              {
                pos=pos+1;

              }

          break;



       }

       ////////////doszlo
       //podzial na duze i male litery

       if(this.isShift)//jesli duze
       {


            switch (l)
            {
               case '10':
                  znak= "A";
               break;

               case '11':
                  znak= "B";
               break;

               case '12':
                   znak= "C";
               break;

               case '13':
                   znak= "D";
               break;

               case '14':
                   znak= "E";
               break;

               case '15':
                   znak= "F";
               break;

               case '16':
                   znak= "G";
               break;

               case '17':
                   znak= "H";
               break;

               case '18':
                   znak= "I";
               break;

               case '19':
                   znak= "J";
               break;

               case '20':
                   znak= "K";
               break;

               case '21':
                   znak= "L";
               break;

               case '22':
                   znak= "M";
               break;

               case '23':
                  znak= "N";
               break;

               case '24':
                   znak= "O";
               break;

               case '25':
                   znak= "P";
               break;

               case '26':
                   znak= "Q";
               break;

               case '27':
                   znak= "R";
               break;

               case '28':
                   znak= "S";
               break;

               case '30':
                  znak= "T";
               break;

               case '31':
                   znak= "U";
               break;

               case '32':
                   znak= "V";
               break;

               case '33':
                  znak= "W";
               break;

               case '34':
                   znak= "X";
               break;

               case '35':
                   znak= "Y";
               break;

               case '36':
                   znak= "Z";
               break;

               case '40':
                  znak= "\u0104";
               break;

               case '41':
                   znak= "\u0106";
               break;

               case '42':
                   znak= "\u0118";
               break;

               case '43':
                   znak= "\u0141";
               break;

               case '44':
                   znak= "\u0143";
               break;

               case '45':
                   znak= "\u00D3";
               break;

               case '46':
                   znak= "\u015a";
               break;

               case '47':
                   znak= "\u0179";
               break;

               case '48':
                   znak= "\u017b";
               break;



            }

       }
       else
       {

             switch(l)
             {
               case '10':
                  znak= "a";
               break;

               case '11':
                  znak= "b";
               break;

               case '12':
                   znak= "c";
               break;

               case '13':
                   znak= "d";
               break;

               case '14':
                  znak= "e";
               break;

               case '15':
                   znak= "f";
               break;

               case '16':
                   znak= "g";
               break;

               case '17':
                   znak= "h";
               break;

               case '18':
                   znak= "i";
               break;

               case '19':
                   znak= "j";
               break;

               case '20':
                  znak= "k";
               break;

               case '21':
                   znak= "l";
               break;

               case '22':
                   znak= "m";
               break;

               case '23':
                  znak= "n";
               break;

               case '24':
                   znak= "o";
               break;

               case '25':
                   znak= "p";
               break;

               case '26':
                   znak= "q";
               break;

               case '27':
                   znak= "r";
               break;

               case '28':
                   znak= "s";
               break;

               case '30':
                   znak= "t";
               break;

               case '31':
                   znak= "u";
               break;

               case '32':
                   znak= "v";
               break;

               case '33':
                  znak= "w";
               break;

               case '34':
                   znak= "x";
               break;

               case '35':
                   znak= "y";
               break;

               case '36':
                   znak= "z";
               break;

               case '40':
                   znak= "\u0105";
               break;

               case '41':
                   znak= "\u0107";
               break;

               case '42':
                   znak= "\u0119";
               break;

               case '43':
                   znak= "\u0142";
               break;

               case '44':
                   znak= "\u0144";
               break;

               case '45':
                   znak= "\u00F3";
               break;

               case '46':
                   znak= "\u015b";
               break;

               case '47':
                   znak= "\u017a";
               break;

               case '48':
                   znak= "\u017c";
               break;

             }

        }

    // this.Log("przeszlo");
     if(znak.length>0)
     {
        this.Log("znak = "+znak );
       this.Log(this.Input.value.substring(0,pos)+" znak "+ this.Input.value.substring(pos,this.Input.value.length));
       this.Text=this.Input.value.substring(0,pos)+znak+ this.Input.value.substring(pos,this.Input.value.length);
       pos=pos+1;
     }
      if(backspace)
     {
       // this.Log("znak = "+znak );
       // this.Log(this.Input.value.substring(0,pos)+" znak "+ this.Input.value.substring(0,this.Input.value.length));
       this.Text=this.Input.value.substring(0,pos-1)+znak+ this.Input.value.substring(pos,this.Input.value.length);
       pos=pos-1;
     }

   //  this.Log("1078");
      if(!enter)
       {
          this.Input.value=this.Text;
          top.window.parent.ob.elem.value=this.Text;
          this.setCaretPosition(this.Input,pos);
          //jQuery(this.Input).caret(pos-1,pos);
       }
       $jq(this.Input).keydown();
    }
    else
    {

   //   this.Log("1088");

    //  this.Log(l);
      if(l>=0 && l<this.licz)
        {


           // this.Log("linia 1083");
            this.elem=this.elementsWithId[l];

            this.wcisnij(this.elementsWithId[l]);

        }
        else
        {
        //  this.Log(this.blok_klaw);
          // this.Log("2222");
        }

    }
}
Obiekt.prototype.get_previoussibling= function(n)
{
//n = <author>
var x=n.previousSibling;
while (x.nodeType!=1)
{
    x=x.previousSibling;
}
return x;
}
Obiekt.prototype.zastopujApplet=function()
{
//do apletu
   if(!this.isIE)
   {
       var myApplet = document.getElementById("ap1");

       if(myApplet)
        {
         //  this.Log("ap1");
         //  myApplet.stop();

          // myApplet.zastopuj();

         }

   }
   else
   {
      // this.Log(document.ap1);
     // document.applets.ap1.stop();

   }

    if(ob.mixer!=-1)
   {
        zapiszCookies("mixer",ob.mixer);
   }

   if(ob.formularz)
   {
      ob.Log("formularz zapisuje");

      ob.Log("contact_name "+jQuery('#contact_name').val());
      ob.Log("contact_email "+jQuery('#contact_email').val());
      ob.Log("contact_subject "+jQuery('#contact_subject').val());
      ob.Log("contact_text "+jQuery('#contact_text').val());

      zapiszCookies("contact_name",jQuery('#contact_name').val());
      zapiszCookies("contact_email",jQuery('#contact_email').val());
      zapiszCookies("contact_subject",jQuery('#contact_subject').val());
      zapiszCookies("contact_text",jQuery('#contact_text').val());


   }



}
Obiekt.prototype.wcisnij=function(cos)
{
var currentDoc = document;
var currentWin = currentDoc.defaultView;
//var off= jQuery(document.applets["aplet"]).offset();
////this.Log("off= "+off.top);



this.Log("tag name = "+cos.tagName);


if(!this.isIE)
{
     var gbOptions = {
                    gbWidth: 825,//525
                    gbHeight: 420,
                    gbTop: 120
                  }
}
else
{
    var gbOptions = {
                    gbWidth: 825,
                    gbHeight: 430,
                    gbTop: 120
                  }




}

if(this.isPopup)
// if(this.oknoGB && this.oknoGB.ob1)
   {

       // this.Log("popup666");
      //  this.Log(this.oknoGB.ob1.isPopup);
       // this.Text=this.Text+ 666;
        //this.Input.value=this.Text;
   }
   else
   {

// this.Log("ok");
//  var cos=this.elementsWithId[(evt.keyCode-49)];
        try{
        cos.focus();


        }catch(e){
           // this.Log(czytajCookies("onoff"));

        }
        if(cos.tagName=="IMG")
        {
           this.Log("wciskam img");
           jQuery(cos).click();
        }

        if(cos.tagName=="A")
        {
            this.Log("id: "+cos.id/*jQuery(cos).attr('id')*/);
           
           if(cos.id=="lbPrevLink" || cos.id=="lbNextLink" || cos.id=="lbCloseLink")
           {
               this.Log("lbPrevLink lbNextLink");
               jQuery(cos).click();
           }
           else
           {


               document.location.href=cos.href;
               // this.Log(cos.getAttribute("href"));
                if(!this.isIE)
                {
                    if(cos.getAttribute("href")[0]!="#")
                    {
                        //  this.zastopujApplet();
                    }
                    else
                    {

                        //  this.Log("#");
                    }
                }
                else
                {

                     if(cos.getAttribute("href",2).charAt(0)!="#")
                    {
                         // this.zastopujApplet();
                    }
                    else
                    {

                      //    this.Log("#");
                    }

                }
           }
        }
        if(cos.tagName=="BUTTON")
        {
       //     this.Log(cos.tagName);
           //cos.onclick();




            if(!this.isIE)
            {
                this.performEvent("mouseover",cos,currentWin);
                this.performEvent("mousedown",cos,currentWin);
                this.performEvent("click",cos,currentWin);
                this.performEvent("mouseup",cos,currentWin);
         //   this.Log("ok");
            }
            else
            {
                cos.click();


            }

           // document.location.href=cos.href;
        }


        if(cos.tagName=="INPUT")
         {


         cos.blur();

          //this.zastopujApplet();
          //this.klaw=false;
          //cos.setAttribute('value','tekst');
          switch(cos.getAttribute("type"))
           {
               case "button" :

               break;

               case "checkbox" :

                if(!this.isIE)
                {
                    this.performEvent("mouseover",cos,currentWin);
                    this.performEvent("mousedown",cos,currentWin);
                    this.performEvent("click",cos,currentWin);
                    this.performEvent("mouseup",cos,currentWin);
                this.Log("ok");
                }
                else
                {
                    cos.click();


                }


               break;
               case "text":
                   if(cos.previousElementSibling==null)
                    {
                       // this.Log("zle");

                    }
              //wyswietlanie formularza glosowego
                this.performEvent("mouseover",cos,currentWin);
                this.performEvent("mousedown",cos,currentWin);
                this.performEvent("click",cos,currentWin);
                this.performEvent("mouseup",cos,currentWin);
               //  cos.focus();
                 jQuery(cos).focus();
              // this.isPopup=true;
            

             // this.oknoGB=true;
             //      greybox2(gbOptions,"E-Formularz", 'VVC/popup.php');

              // }
              // var theframes = document.getElementsByTagName('iframe');
              //  for(var i = 0; i < theframes.length; i++)
             //   {
                  //  theframes[i].setAttribute("allowTransparency","true");
              //  }

              // this.oknoGB=GB_showCenter('Formularz', 'http://localhost/NoiseBusters/popup.php',300,500);
              //  ob.isPopup=true;

              //  var myIframe = document.getElementById('GB_frame');

               break;
               case "password":
              // this.isPopup=true;

                jQuery(cos).focus();

              // GB_showCenter('Formularz', 'http://localhost/NoiseBusters/popup.php',300,500);

             //   this.oknoGB=true;
              //     greybox2(gbOptions,"E-Formularz", 'VVC/popup.php');

              // }

              // this.oknoGB=GB_showCenter('Formularz', 'http://localhost/NoiseBusters/popup.php',300,500);
              //  ob.isPopup=true;

              //  var myIframe = document.getElementById('GB_frame');

               break;


               default :

               // this.Log(cos.getAttribute("type"));
               break;



           }



         }


         if(cos.tagName=="TEXTAREA")
         {

              jQuery(cos).focus();
              //  t cos.click();his.isPopup=true;
               //this.oknoGB=this.mojeOkno(jQuery(cos.parentNode).prev().children().text(), '/naszaprzestrzen/popup.php',390,500);


            //  this.Log("wywoluje greyboxa");
           //  this.oknoGB=true;
             //      greybox2(gbOptions,"E-Formularz", 'VVC/popup.php');

              // }

              // this.oknoGB=GB_showCenter('Formularz', 'http://localhost/NoiseBusters/popup.php',300,500);
            //    ob.isPopup=true;

             //   var myIframe = document.getElementById('GB_frame');
//              setTimeout(function () {
//
//                        var iframe = jQuery("#GB_frame")[0];
//                        han.Log(iframe.id);
//                        iframe.focus();
//                        iframe.contentWindow.focus();
//                        iframe.contentDocument.body.focus();
//                        iframe.contentDocument.getElementById('moje_pole').focus();
//                         han.Log("ok");
//                         han.Log(iframe.contentDocument.getElementById('moje_pole').id);
//                        },1000);


         }




      if(cos.tagName=="OBJECT")
        {
           //
           // this.Log("object");
               //this.performEvent("mouseover",cos,currentWin);
                //this.performEvent("mousedown",cos,currentWin);
               // this.performEvent("click",cos,currentWin);
               // this.performEvent("mouseup",cos,currentWin);
            //cos.Play();
           document.getElementById('dewplayera').Play();
          //  this.Log("ok");

        }



        if(cos.tagName=="SELECT")
        {
           // this.Log("object");
               // this.performEvent("mouseover",cos,currentWin);

                this.performEvent("mousedown",cos,currentWin);
               // this.performEvent("click",cos,currentWin);
               // this.performEvent("mouseup",cos,currentWin);

            //    this.Log("select");

        }


   }

}

Obiekt.prototype.odczytKlaw=function(evt){
//this.Log("klawa666");
//var keyCode =window.Event.keyCode;// evt.which | evt.keyCode;


if(!this.isIE)
    {


        //if( String.fromCharCode(evt.keyCode)=="P")
       // {

      //  }
      // if(evt.keyCode==VK_LEFT)
      //     {

       //        this.Log("left arrow");
//
      //     }
//

        if(!this.klaw)
            {
               this.blokuj();
               return ;
            }

        if( evt.altKey==true)
        {
          //  this.Log("ctrl");
            //this.blokuj();


        }
        if(evt.keyCode==27)
         {
          $jq("#id"+this.buf).css({'background-color' : 'white'});
          clearTimeout( this.t);
           this.buf="";
         }
       // this.Log(evt.keyCode);
        if(evt.keyCode>47 && evt.keyCode<59 && evt.altKey==true && !evt.shiftKey)//&& evt.altKey==true)
           {
             this.Log("zmiana= "+this.zmiana);
             this.Log("id= "+this.id);
            if(this.isPopup)
                {
                 // this.Log("ok");
                }

               var han=this;
                if(this.blok_klaw)
                {
                    $jq("#id"+this.buf).css({'background-color' : 'white'});
                    this.buf=this.buf+(evt.keyCode-48);
                    this.Log($jq("#id"+this.buf).attr('id'));
                    $jq("#id"+this.buf).css({'background-color' : 'yellow'});
                    clearTimeout( this.t);
                    if(this.isPopup && this.buf.length==2)
                    {
                        this.blok_klaw=false;
                        han.koniecCzasu();
                    }
                    else
                    {
                        this.t=setTimeout(function () {
                        han.koniecCzasu();
                        // this.Log("ok");
                        },1000);
                    }
                    
                   // this.t=setTimeout(function () {
                  //  this.koniecCzasu();
                  //  },1000);
                  //  this.t=setTimeout("this.timeout()",2000);
                    
                }
                else
                {
                      this.buf="";
                      this.buf=this.buf+(evt.keyCode-48);
                      this.blok_klaw=true;
                      // this.Log($jq("#id"+this.buf).attr('id'));
                      this.Log("#id"+this.buf);
                       this.Log($jq("#id"+this.buf).attr('id'));
                      $jq("#id"+this.buf).css({'background-color' : 'yellow'});
                     this.t=setTimeout(function () {
                    han.koniecCzasu();
                  //  this.Log("ok");
                    },1000);
                   // this.t=setTimeout(this.koniecCzasu ,1000);
                     //this.t=setTimeout("this.Log('dupa')",2000);

                }




           }

         if(evt.keyCode==67 && evt.altKey==true)
             {

                // this.Log(document.cookie);
                this.Log(this.bufor);
                //this.koniecCzasu();
               // this.Log("ok");
                //this.klaw=false;
               $jq('select').mousedown();
               // .mousedown()
                //window.frames[1].focus();

             //   this.Log(window.frames[nameOrNumberOfFrame]);
                //noweOkno = window.open("http://www.google.pl", 'lol', 'menubar=no, toolbar=no, location=no, scrollbars=no, resizable=no, status=no, width=200, height=100');
             }
           //  this.Log("d");
            if(evt.keyCode==68  ) //d
             {
                this.Log("d= ");

               
                jQuery("#googlemaps").hide();
                jQuery("#googlemaps").show("slide", {direction: 'right'}, 1000);
              //  this.zastopujApplet();
               //  $jq(':input')[0].focus();


             }
   }
   else
   {
       if (!evt) evt = window.event;

       var znak= String.fromCharCode(evt.keyCode);

        if(evt.keyCode==27)
         {
          $jq("#id"+this.buf).css({'background-color' : 'white'});
          clearTimeout( this.t);
           this.buf="";
         }


       if(evt.keyCode>47 && evt.keyCode<59 && evt.altKey==true && !evt.shiftKey)
           {


              // this.Log(znak);
               var han=this;
                if(this.blok_klaw)
                {
                    $jq("#id"+this.buf).css({'background-color' : 'white'});
                    //this.buf=this.buf+(evt.keyCode-48);
                     this.buf=this.buf+String.fromCharCode(evt.keyCode);
                    clearTimeout( this.t);
                     $jq("#id"+this.buf).css({'background-color' : 'yellow'});
                     this.t=setTimeout(function () {
                    han.koniecCzasu();
                   
                    },1000);
                   // this.t=setTimeout(function () {
                  //  this.koniecCzasu();
                  //  },1000);
                  //  this.t=setTimeout("this.timeout()",2000);
                    this.blok_klaw=true;
                }
                else
                {
                      this.buf="";
                     // this.buf=this.buf+(evt.keyCode-48);
                     this.buf=this.buf+String.fromCharCode(evt.keyCode);
                     this.blok_klaw=true;
                     $jq("#id"+this.buf).css({'background-color' : 'yellow'});
                     this.t=setTimeout(function () {
                    han.koniecCzasu();
                    this.Log("ok");
                    },1000);
                   // this.t=setTimeout(this.koniecCzasu ,1000);
                     //this.t=setTimeout("this.Log('dupa')",2000);

                }




           }

            if(evt.keyCode==68  ) //d
             {


                 this.Log("d");
                  this.Log("d= ");


                jQuery("#googlemaps").hide();
                jQuery("#googlemaps").show("slide", {direction: 'right'}, 1000);
               // this.zastopujApplet();

             }

         

   }

};

Obiekt.prototype.mojeOkno = function(caption, url, /* optional */ height, width, callback_fn) {
    var options = {
        caption: caption,
        center_win:true,
        height: height || 500,
        width: width || 500,
        fullscreen: false,
        center:   true,
        overlay_click_close: true,
        show_loading: false,
        callback_fn: callback_fn

    }
    var win = new GB_Window(options);
     win.show(url);

    return win;
}

Obiekt.prototype.blokuj= function(event){
 event.preventDefault();
           event.stopPropagation();

}

Obiekt.prototype.dodajSpan= function(odnosnik,displej,gdzie)
{
    this.Log("dodaje span "+this.licz+"tag name: "+odnosnik.tagName+"id: "+odnosnik.id+"typ: "+gdzie);

    var el;
    var o,o_p ;
    var s ;
    var o_offset;
    var s_offset ;


    if(gdzie=="w_img_a" )
    {


       this.elementsWithId[this.licz]= displej ;
       gdzie="w_img" ;

    }
    else
    {

       this.elementsWithId[this.licz]= odnosnik  ;
    }
    
    //
    span= document.createElement("span");
    if(gdzie=="w" )
    {
      span.style.cssText = "font-family: arial,sans-serif;font-size: "+this.rozmiary[this.rozmiar-1]+"  ! important;\n\
        line-height: 100% ! important; border: 1px solid rgb(127, 157, 185) ! important;\n\
         -moz-border-radius: 2px 2px 2px 2px ! important;\n\
         padding: 0px 2px ! important; margin-left: 0px;\n\
        max-width: 100px; max-height: 100px ! important; overflow: none ! important;\n\
        float: none ! important; display: inline; position: relative;\n\
        margin-top: -13px; color: rgb(0, 0, 0) ! important;\n\
        ; top: -6px;background-color: rgb(255,255,255);\n\
        visibility: visible;\n\
        z-index : 2;display:inline-block;";




//      span.style.cssText = "font-family:arial, sans-serif;\n\
//        font-size:xx-small; line-height:130%;\n\
//        border-width:1px; border-style:solid;\n\
//        -moz-border-radius:2px;padding:0px 2px 0px 2px;\n\
//        position: relative;max-width:15px;\n\
//        max-height:10px;overflow:visible;float:none;visibility:visible";

    //vertical-align:center
    //span.style.display = displej;
    }
    else
    {
        if(gdzie=="w_img" || gdzie=="w_inp")
        {
             span.style.cssText = "font-weight: bold,font-family: arial,sans-serif;font-size: "+this.rozmiary[this.rozmiar-1]+"  ! important;\n\
            line-height: 100% ! important; border: 1px solid rgb(127, 157, 185) ! important;\n\
             -moz-border-radius: 2px 2px 2px 2px ! important;\n\
             padding: 2px 2px 2px 2px ! important; margin-left: 0px;\n\
            max-width: 100px; max-height: 100px ! important; overflow: none ! important;\n\
            float: none ! important; display: inline; position: absolute;\n\
            margin-top: -13px; color: rgb(0, 0, 0) ! important;\n\
            ; top: -6px;background-color: rgb(255,255,255);\n\
            visibility: visible;\n\
            z-index : 2;display:inline-block;\n\
        font-weight : bold;";


        }
        else
        {
            span.style.cssText = "font-weight:bold,font-family:arial, sans-serif;\n\
            font-size:"+this.rozmiary[this.rozmiar-1]+" ; line-height:100%;\n\
            border-width:1px; border-style:solid;\n\
            -moz-border-radius:2px;padding:0px 2px 0px 2px;\n\
            margin-left:5px; max-width:100px;background-color: rgb(255,255,255);\n\
            max-height:100px; color: rgb(0, 0, 0);overflow:visible;float:none;\n\
            z-index : 1;\n\
                font-weight : bold;";

        }

    }
    if(!this.isIE)
   {
    span.textContent = this.licz+"";
    }
    else

    {
       this.Log("dodaje spany numer "+ this.licz + "gdzie = "+ gdzie);

      span.innerText = this.licz+"";
    }

    span.id= this.licz;
    span.setAttribute('id','id'+this.licz);
    this.licz=this.licz+1;

    if(gdzie=="obok")
    {
       if(odnosnik.nextSibling!=null)
         {
             odnosnik.parentNode.insertBefore(span,odnosnik.nextSibling);
         }
         else
         {
            odnosnik.parentNode.appendChild(span);
         }
    }
    else
    {
        if(gdzie=="w")
            {

              if(!this.isIE && !this.isOpera)
              {
                 el=odnosnik.parentNode.appendChild(span);
                 o = $jq(odnosnik);
                 o_p=o.position();
                 s = $jq(el);
                 o_offset = o.offset();
                 s_offset = s.offset();

                  o_p=o.position();




                  this.Log(o_p.top+o.height()-s.height());


                   if(o.height()>0)
                   {
                       $jq(el).css( {'top' : o_p.top+o.height()/2-s.height()+'px'});

                   }
                   else
                   {
                         $jq(el).css( {'top' : o_p.top+s.height()/2+'px'});
                   }

                   $jq(el).css( {'left' : o_p.left+s.width()+'px'});


                /*
                el=odnosnik.parentNode.appendChild(span);
                 o = $jq(odnosnik);
                 s = $jq(el);
                 o_offset = o.offset();
                 s_offset = s.offset();
               this.Log(o_offset.left);
            
                 $jq(el).css( {'margin-left' : o_offset.left-s_offset.left+o.width()-s.width()-3+'px'});
                 $jq(el).css( {'margin-left' : o_offset.left-s_offset.left+o.width()-s.width()-3+'px'});


               $jq(odnosnik).focus(function (){
                 $jq(el).css( {'visibility' : 'hidden'});


                });
                $jq(odnosnik).blur(function (){
                 $jq(el).css( {'visibility' : 'visible'});
                });


                */
              }

              if(this.isOpera)
              {
                 el=odnosnik.parentNode.appendChild(span);
                 o = $jq(odnosnik);
                 s = $jq(el);
                 o_offset = o.offset();
                 s_offset = s.offset();
               // this.Log(o_offset.left-s_offset.left+o.width());
               // this.Log($jq(el).attr('id'));
              // this.Log(o_offset.left);
             //  $jq("#id"+this.buf).css({'background-color':rgb(255, 0, 255)});

                 $jq(el).css( {'margin-left' : 3+ o_offset.left-s_offset.left+o.width()-s.width()-3+'px'});
               // this.Log("o_offset.left"+o_offset.left+" o_offset.top "+o_offset.top+" s_offset.left"+s_offset.left+" s_offset.top "+s_offset.top );
                $jq(odnosnik).focus(function (){
                 $jq(el).css( {'visibility' : 'hidden'});


                });
                $jq(odnosnik).blur(function (){
                 $jq(el).css( {'visibility' : 'visible'});
                });

              }
              if(this.isIE)
              {
                 el=odnosnik.parentNode.appendChild(span);
                 o = $jq(odnosnik);
                 s = $jq(el);
                 o_offset = o.offset();
                 s_offset = s.offset();
               // this.Log(o_offset.left-s_offset.left+o.width());
               // this.Log($jq(el).attr('id'));
              // this.Log(o_offset.left);
             //  $jq("#id"+this.buf).css({'background-color':rgb(255, 0, 255)});
                  $jq(el).css('zIndex', 1000);
                // $jq(el).css( {'z-index' : 20});
                 $jq(el).css( {'margin-left' : 5+ o_offset.left-s_offset.left+o.width()-s.width()-3+'px'});
                 $jq(el).css( {'margin-top' : 2+'px'});

               // this.Log("o_offset.left"+o_offset.left+" o_offset.top "+o_offset.top+" s_offset.left"+s_offset.left+" s_offset.top "+s_offset.top );
                $jq(odnosnik).focus(function (){
                 $jq(el).css( {'visibility' : 'hidden'});


                });
                $jq(odnosnik).blur(function (){
                 $jq(el).css( {'visibility' : 'visible'});
                });


              }


              //  odnosnik.appendChild(span);
            }
            else
            {
                 if(gdzie=="w_img" || gdzie=="w_inp")
                 {
                      if(!this.isIE && !this.isOpera)
                      {


                        el=odnosnik.parentNode.appendChild(span);
                         o = $jq(odnosnik);
                         o_p=o.position();
                         s = $jq(el);
                         o_offset = o.offset();
                         s_offset = s.offset();

                          o_p=o.position();
                           if(o.height()>0)
                           {
                               $jq(el).css( {'top' : o_p.top+s.height()+'px'});

                           }
                           else
                           {
                                 $jq(el).css( {'top' : o_p.top+s.height()+'px'});
                           }
                           
                           $jq(el).css( {'left' : o_p.left+o.width()-s.width()+'px'});


                           if( gdzie=="w_inp")
                           {
                                 $jq(odnosnik).focus(function (){
                                 $jq(el).css( {'visibility' : 'hidden'});


                                });
                                $jq(odnosnik).blur(function (){
                                 $jq(el).css( {'visibility' : 'visible'});
                                });



                           }


                       //  $jq(el).css( {'margin-left' : o_offset.left-s_offset.left+o.width()-s.width()-3+'px'});
                       // this.Log("o_offset.left"+o_offset.left+" o_offset.top "+o_offset.top+" s_offset.left"+s_offset.left+" s_offset.top "+s_offset.top );

                      }

                      if(this.isOpera)
                      {
                          var s_wys,s_szer,o_wys,o_szer,left_tmp;



                          this.Log("dodaje span numer  "+ this.licz);
                             el=odnosnik.parentNode.appendChild(span);
                             o = $jq(odnosnik);
                             o_p=o.position

                             s = $jq(el);
                             o_offset = o.offset();
                             s_offset = s.offset();

                            o_p=o.position();
                              this.Log("do");
                            s_wys=document.defaultView.getComputedStyle(el,null).getPropertyValue("height");
                         //   s_szer=document.defaultView.getComputedStyle(el,null).getPropertyValue("width");
                            o_wys=document.defaultView.getComputedStyle(odnosnik,null).getPropertyValue("height");
                            o_szer=document.defaultView.getComputedStyle(odnosnik,null).getPropertyValue("width");
                         //  this.Log("index of= "+s_wys.indexOf('px'));
                          // s_wys=s_wys.substring(0,s_wys.indexOf('px'));
                         //   s_szer=s_szer.substring(0,s_szer.indexOf('p'));
                          //  o_wys=o_wys.substring(0,o_wys.indexOf('p'));
                          //  o_szer=o_szer.substring(0,o_szer.indexOf('p'));

//                            if (window.getComputedStyle) {
//                            var stijl = document.defaultView.getComputedStyle(odnosnik, '');
//                            // var stijl = window.getComputedStyle(arrSlices[10], '');
//                            var backpos = stijl.getPropertyValue('background-position');
//                            alert(backpos);
//                            } else if (odnosnik.currentStyle) {
//                            var backposx = odnosnik.currentStyle.backgroundPositionX;
//                            var backposy = odnosnik.currentStyle.backgroundPositionY;
//                            alert ('posx = ' + backposx + ' & posy = ' + backposy);
//                            } else {
//                            alert('Your browser does not support this shit!');
//                            }





                         //  this.Log("inaczej wyliczone = "+document.defaultView.getComputedStyle(el,"").getPropertyValue("width") );

                           this.Log("o_p.top= "+o_p.top);
                           this.Log("o_p.left= "+o_p.left);
                           //this.Log("s.height()= "+s.height());
                           //this.Log("s.width()= "+s.width());
                           //this.Log("o.width()= "+o.width());
                          // this.Log("o.height()= "+o.height());
                           this.Log("s_wys= "+s_wys);
                         //  this.Log("s_szer= "+s.szer);
                           this.Log("o_wys= "+o_wys);
                           this.Log("o_szer= "+o_szer);
                           left_tmp=parseInt(o_p.top)+parseInt(s_wys);
                           if(s_wys>0)
                           {
                               $jq(el).css( {'top' : left_tmp+'px'});

                           }
                           else
                           {
                                 $jq(el).css( {'top' : left_tmp+'px'});
                           }

                          left_tmp=parseInt(o_p.left)+parseInt(o_szer)-parseInt(s_wys);
                           $jq(el).css( {'left' : left_tmp+'px'});


                           if( gdzie=="w_inp")
                           {
                                 $jq(odnosnik).focus(function (){
                                 $jq(el).css( {'visibility' : 'hidden'});


                                });
                                $jq(odnosnik).blur(function (){
                                 $jq(el).css( {'visibility' : 'visible'});
                                });



                           }



//                         el=odnosnik.parentNode.appendChild(span);
//                         o = $jq(odnosnik);
//                         s = $jq(el);
//                         o_offset = o.offset();
//                         s_offset = s.offset();
//
//                       //  $jq(el).css( {'margin-left' : 3+ o_offset.left-s_offset.left+o.width()-s.width()-3+'px'});
//                             o_p=o.position();
//                           if(o.height()>0)
//                           {
//                               $jq(el).css( {'top' : o_p.top+o.height()-s.height()+'px'});
//
//                           }
//                           else
//                           {
//                                 $jq(el).css( {'top' : o_p.top+s.height()+'px'});
//                           }
//
//                           $jq(el).css( {'left' : o_p.left+s.width()+'px'});

                      }
                      if(this.isIE)
                      {

                        el=odnosnik.parentNode.appendChild(span);

                         o = $jq(odnosnik);
                         o_p=o.position();

                         s = $jq(el);

                         o_offset = o.offset();
                         s_offset = s.offset();


                          o_p=o.position();

                          var myStyle = odnosnik.currentStyle.width;
                         //  o_szer=document.defaultView.getComputedStyle(odnosnik,null).getPropertyValue("width");
                          if(gdzie=="w_inp")
                          {

                              this.Log("o.offset= "+o.id);
                              this.Log("o_offset.left= "+o_offset.left);
                              this.Log("o_offset.right= "+o_offset.right);
                              this.Log("o_p.left= "+o_p.left);
                              this.Log("o_p.right= "+o_p.right);
                              this.Log("o.width= "+o.innerWidth());

                          }

                          
                           if(o.height()>0)
                           {
                               $jq(el).css( {'top' : o_p.top+s.height()+'px'});

                           }
                           else
                           {
                                 $jq(el).css( {'top' : o_p.top+s.height()+'px'});
                           }

                         //  $jq(el).css( {'left' : o_p.left+o.width()-s.width()+'px'});
                           

                           //innerWidth() - magiczna funkcja 
                           if( gdzie=="w_inp")
                           {
                               $jq(el).css( {'left' : o_p.left+o.innerWidth()-s.width()+'px'});

                                 $jq(odnosnik).focus(function (){
                                 $jq(el).css( {'visibility' : 'hidden'});


                                });
                                $jq(odnosnik).blur(function (){
                                 $jq(el).css( {'visibility' : 'visible'});
                                });



                           }
                           else
                           {
                               $jq(el).css( {'left' : o_p.left+o.width()-s.width()+'px'});


                           }


                      }

                 }
                 else
                 {
                    odnosnik.appendChild(span);
                 }


            }



    }


    if(this.licz==18)
    {


    }


}


Obiekt.prototype.usunSpan=  function()
{
    
    this.Log(this.licz+" ");
    var i,d;
    for(i=1;i<this.licz;i++)
    {
        d = document.getElementById('id'+ i );
        if(d)
        {
            d.parentNode.removeChild( d );
        }
        else
        {
          this.Log(i+" nie istnieje");
        }

    }
    this.licz=1;

}




//analizuje elementy w strukturze DOM





Obiekt.prototype.odnosniki=  function()
{
this.Log("analizuje odnosniki");
var span,l,m;
var i,j,im_ind,odnosniki = document.getElementsByTagName('a');

var czy_img=false;

//dla 'a''
for(i=0;i<odnosniki.length;i++)
{
//if (odnosniki[i].className.match(/(^|\s)popup(\s|$jq)/))
 this.Log("klasa a:"+jQuery(odnosniki[i]).parent().attr("class"));
    if(jQuery(odnosniki[i]).parent().attr("class")=="jg_displaynone")
   {
        this.Log("pomijam");
        continue;
     }
        if(jQuery(odnosniki[i]).attr("id")=="jg_goon")
            {
                    
                   this.Log("jq_goon");
                   jQuery(odnosniki[i]).change(function(){


                    this.Log("zmiana img");
                    });
            }


    if(odnosniki[i].href!="")
    {

         m = odnosniki[i].children;
       // this.Log(m.length);
         czy_img=false;
        for (j=0; j<m.length; j++)
        {
          if(m.item(j).tagName=="IMG")
           {

             this.Log("fotka wymiary "+jQuery(m.item(j)).width()+" "+jQuery(m.item(j)).height());
             //this.dodajSpan(odnosniki[i],"relative","w");
            // this.Log($jq(m.item(j)).parent());


            if(jQuery(m.item(j)).width()<=16 && jQuery(m.item(j)).height()<=16)
            {
              
            }
            else
            {
              im_ind=j;
              czy_img=true;

            }

          
              break;


           }


        }


        if(czy_img)
        {
           // this.Log("rel 666= "+ jQuery(odnosniki[i]).attr("rel"));

          //  this.Log("tagname 11= " +m.item(im_ind).tagName);



            if(jQuery(odnosniki[i]).attr("rel")!="")
            {
               this.dodajSpan(m.item(im_ind),"inline","w_img");

            }
            else
            {


                this.dodajSpan(m.item(im_ind),odnosniki[i],"w_img_a");
            }


            
           
             
           //  this.dodajSpan(odnosniki[i],"inline","w");
        }
        else
        {
              this.dodajSpan(odnosniki[i],"inline","nie");///bylo "nie"


        }

    }
}

//dla input
odnosniki = document.getElementsByTagName('input');
// this.Log("znalazlem inputow "+odnosniki.length);
for(i=0;i<odnosniki.length;i++)
{

//    if(odnosniki[i].className)
//this.Log("ok");
//   this.Log(odnosniki[i].getAttribute("tagName"));
  
    if(odnosniki[i].getAttribute("type")=="text" )
    {
       
       //this.dodajSpan(odnosniki[i],"relative","w");
       this.dodajSpan(odnosniki[i],"relative","w_inp")
    }
    else
    {
        if(odnosniki[i].getAttribute("type")=="password" )
        {

           this.dodajSpan(odnosniki[i],"relative","w_inp");
        }
        else
        {
           if(odnosniki[i].getAttribute("type")=="checkbox")
               {
                   this.dodajSpan(odnosniki[i],"relative","obok");
               }


        }
   }
}

//dla buttonow

odnosniki = document.getElementsByTagName('button');
//  this.Log("znalazlem buttonow "+odnosniki.length);
for(i=0;i<odnosniki.length;i++)
{
      m = odnosniki[i].children;
      //  this.Log(m.length);
         czy_img=false;
        for (j=0; j<m.length; j++)
        {
          if(m.item(j).tagName=="IMG")
           {

             this.Log(m.item(j).id);
             //this.dodajSpan(odnosniki[i],"relative","w");
             im_ind=j;
              czy_img=true;
              break;


           }


        }


        if(czy_img)
        {

              this.dodajSpan(m.item(im_ind),odnosniki[i],"w_img");
        }
        else
        {
              this.dodajSpan(odnosniki[i],"inline","obok");

        }

}




//dla obiectow

odnosniki = document.getElementsByTagName('object');
//  this.Log("znalazlem buttonow "+odnosniki.length);
for(i=0;i<odnosniki.length;i++)
{
   this.dodajSpan(odnosniki[i],"relative","obok");
}


//dla textarea

odnosniki = document.getElementsByTagName('textarea');
  this.Log("znalazlem textarea "+odnosniki.length);


for(i=0;i<odnosniki.length;i++)
{
   this.dodajSpan(odnosniki[i],"relative","w_inp");
   this.Log("zgytgytgytgytg");
}

//dla select'a

odnosniki = document.getElementsByTagName('select');
//  this.Log("znalazlem buttonow "+odnosniki.length);
for(i=0;i<odnosniki.length;i++)
{
  this.dodajSpan(odnosniki[i],"relative","obok");

}

// return tab;




};

/*
* odbiera zmienna odpowiedzialna za
*
*
*
*/
Obiekt.prototype.readData=function()
{

 var han=this;
// var data=decodeURIComponent(window.opener.location.search.substring(1,window.opener.location.search.length));
//var cos=this.encode(location.href);
// if(cos.length>0)

    if(document.getElementById('emailForm'))
    {

      jQuery('#contact_name').val(czytajCookies("contact_name")!=0?czytajCookies("contact_name"):"");
      jQuery('#contact_email').val(czytajCookies("contact_email")!=0?czytajCookies("contact_email"):"");
      jQuery('#contact_subject').val(czytajCookies("contact_subject")!=0?czytajCookies("contact_subject"):"");
      jQuery('#contact_text').val(czytajCookies("contact_text")!=0?czytajCookies("contact_text"):"");
      

    this.Log("emailForm ");
    this.formularz=true;
    }


    if(czytajCookies("rozmiar")!=0)
    {
      this.rozmiar=  czytajCookies("rozmiar");
    }



    if(czytajCookies("onoff")==1)
    {





       this.mix= czytajCookies("mixer");
       this.Log("mixer= "+this.mix);
        this.saSpany=true;
       
         
        setTimeout( function() {han.odnosniki();}, 500 );
         
        //setTimeout( function() { han.checkImages(50,100);}, 50 );

        this.Log("ok");
        $jq("body").append('<applet id="ap1" name="aplet" class="ap2" width="135" height="244" code="VoiceLabRecorder.SwingRecorder.class" archive="VVC/VoiceLabRecorder.jar"  ></applet>');
        this.apletZaladowany=true;
        $jq('#on_off')[0].src=this.wylacz_img.src;
        
      // this.Log("ok1");

      // this.Log("ok2");
       //wybranie mixera
      if(this.mix>=0)
        {



          this.mixer=this.mix;

//           if(this.isFirefox)
//           {
//               var myApplet = document.getElementById("ap1");
//
//               if(myApplet)
//                {
//                   this.Log("ap1");
//                   myApplet.selectMixer(mix);
//
//                  // myApplet.zastopuj();
//
//                 }
//
//           }

            if(this.isIE)
           {
             //  this.Log(document.ap1);
             //
             //
             //czekajAplet(20,mix);
             // document.applets.ap1.selectMixer(mix);
//              setTimeout( function() {document.applets["aplet"].selectMixer(this.mix);
//                                    //han.Log("przed button click");
//                                    document.applets["aplet"].buttonClick();
//
//                                    }, 2000 );
           }
           else
           {
             //  this.Log(document.ap1);
              //document.ap1.selectMixer(mix);

                //if (document.applets &amp;&amp; document.applets[0]){
               // return document.applets[0];
               // }else{
                // replace "pttapplet" by the id of your applet.
               // return document.pttapplet;
                //}
             // performAppletCode(10);
              //WaitAppletLoaded("aplet");
             // alert(document.applets[0].isActive());

            // czekajAplet(20,mix);
          //   if(document.applets["aplet"].selectMixe==null)alert("null");
           
              //document.applets["aplet"].buttonClick();
              //document.applets["aplet"].buttonClick();

           }
          

        }
        else
        {
           this.mixer=-1;



        }


          setTimeout(function () {
         $jq('#id1').focus();
          },2000);

    }
    else
    {
       this.saSpany=false;
       
       $jq('#on_off')[0].src=this.wlacz_img.src;
    }

     jQuery("body").append('<iframe id="googlemaps" width="207" height="247" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="VVC/images/instrukcja207x247.png">&#160;</iframe>');
     jQuery("#googlemaps").css({
                            'position' : 'fixed',
                            'margin-top' : '5px',
                            'margin-left' : '15px',
                            'top' : '45px',
                            'right' : '145px'

           });


       jQuery("#googlemaps").hide();





//$jq("#contact_name input").autocompleteArray(["Allen","Albert","Alberto","Alladin"]);


}

