﻿

<!--
var swfmenu = 'false';
function escapeUri(str) {
  str = str.replace(/=/g, '%3d'); 
  str = str.replace(/&/g, '%26');
  str = str.replace(/"/g, '%22'); //"
  return str;
}
function test() {
  alert('test');
}
function getQuerryStringByName(name){
  url = new string(window.location);
  var xx=string(document.location.search);
  str_tmp = url.split("?");
  
  if( str_tmp.length < 2 ) return "";
  querry = str_tmp[1];
  
  if (xx.match(/%20\w+=/)) // haszcz
  { 
    element = querry.split(escape("&"));
  }
  else // bez haszcza
  {
    element = querry.split("&");
  }  
  i=0;
  while(i<element.length){
      e = element[i];
      _item =  e.split("=");
      if(_item[0] == name){
        return _item[1];
      }
      i++;
  }
  return "";
}
function pokaz(obj){
      
        var cl = $(obj).parent().parent().attr("class");
        if(cl == 'active'){ 
            $(obj).parent().parent().attr("class","");
        }
        else{
        $(obj).parent().parent().attr("class","active");
        }
}
function pokaz2(obj){
        obj = obj.parentnode.getElementsByTagname("div");
        obj =obj[0];
        if( obj.classname == "dane") {
            obj.classname="daneWidoczne";
       }
        else if ( obj.classname == "daneWidoczne") 
        {
            obj.classname="dane"; 
        }
}


function poradnikRozwin(){
    $("div.rozwin").removeClass("aktywne");
    $("div.rozwin").addClass("nieaktywne");
    $("div.zwin").removeClass("nieaktywne");
    $("div.zwin").addClass("aktywne");
    $("p.p_poradnik").show();

}
function poradnikZwin(){
    $("div.rozwin").removeClass("nieaktywne");
    $("div.rozwin").addClass("aktywne");
    $("div.zwin").removeClass("aktywne");
    $("div.zwin").addClass("nieaktywne");
    $("p.p_poradnik").hide();
}


function otworzCeche(obj) {
var title = $(obj).parent().parent().attr('title');
  if($(obj).parent().parent().hasClass("cechaOpen")){
    $("div.cecha[title="+title+"]").removeClass("cechaOpen").addClass("cechaClose");
  } else {
    $("div.cecha[title="+title+"]").removeClass("cechaClose").addClass("cechaOpen");
  }
}
function otworzWszystkieCechy() {
    $(".cecha").removeClass("cechaClose").addClass("cechaOpen");
}
function zwinWszystkieCechy() {
    $(".cecha").removeClass("cechaOpen").addClass("cechaClose");
}
function pokazStrone(st){
    $(".strona").hide();
    $("#strona"+st).show();
}
function findPos(obj) {
    var curleft = curtop = 0;
    if (obj.offsetparent) {
        curleft = obj.offsetleft
        curtop = obj.offsettop
        while (obj = obj.offsetparent) {
            curleft += obj.offsetleft
            curtop += obj.offsettop
        }
    }
    return [curleft,curtop];
}
$(document).ready(function(){
    $("#artykulWroc").click(function() {
        history.back();
    });
    $("#s2f").click(s2f_send);
    $("#qstFormSbm").click(qstFormSend);
});
function qstFormSend() {
    $("input[name^=qst]").attr("style", "background-color: none;");
    $("textarea[name^=qst]").attr("style", "background-color: none;");
    advAJAX.submit(
        document.getElementById("qstForm"), {
            url: "/site/question",
            onSuccess : function( obj ){ send_result( obj.responseText,'qst' ); }
        }
    );    
}
function s2f_send(){
    $("input[name^=s2f]").attr("style", "background-color: none;");
    $("textarea[name^=s2f]").attr("style", "background-color: none;");
    advAJAX.submit(
        document.getElementById("form_s2f"), {
            url: "/site/s2fajax",
            onSuccess : function( obj ){ send_result( obj.responseText,'s2f' ); }
        }
    );
}
function send_result( responsetext,prefix ){
    var result;
    eval( "result = " + responsetext );
    if( typeof(result.err) != "undefined" ){
        for( i in result.err.fields ){
            eval('$("#' + result.err.fields[i] +'").attr("style", "background-color:red;");');
        }
        $( '#' + prefix + 'komunikat' ).html('Proszę poprawić pola zaznaczone czerwonym tłem.');
        $( '#' + prefix + 'komunikat' ).attr("style", 'color:red;');
    }else{
        if( result.sent != undefined ){
            switch( result.sent ){
                case 'OK':
                    $( '#' + prefix + 'komunikat' ).html('Wiadomość została wysłana.');
                    $( '#' + prefix + 'komunikat' ).attr("style", 'color:green;');
                    $( 'input[name^=' + prefix + ']').val(''); 
                    $( 'textarea.clearAfter').val('');
                    break;
                case 'err': default:
                    $( '#' + prefix + 'komunikat' ).html('Nie udało się wysłać, spróbuj później');
                    $( '#' + prefix + 'komunikat' ).attr("style", 'color:red;');
                    break;
            }
        }
    }
/*
komunikaty:
 result.sent = ok <- wysłane, bez problemów
 result.sent = err <- dane ok, błędy przy wysyłce -> spróbuj później czy coś...
 err.fields <- tablica niepoprawnie wypełnionych pól
wszystko to widać w firebug'u.
*/
}
//-->
