// JavaScript Document
	$(function() {
            if($("#contact_form").length > 0){
                showContactForm();

                $("#contact_send").live("click",function(){
                    $.post($("#contact").attr("action"),$("#contact").serializeArray(),function(req){
                        $("#contact_form").html(req.html);
                    },"json");
                });
            }

            $("a[rel=cert-group]").fancybox({
                'transitionIn' : 'none',
                'transitionOut' : 'none',
                'titlePosition' : 'over'
            });

            var menu = $( "#accordion" ).accordion(
		{
			icons: false,
			collapsible: true,
			header: 'h3',
			active: false,
			navigation: true,
			autoHeight:false,				
			navigationFilter: function () {
				//Accordion NavigationFilter
				var locationHrefArray = location.href.split("/");
				var locationLastString = locationHrefArray[locationHrefArray.length - 1].toLowerCase();

				var sidebarHrefArray = this.href.split("/");
				var sideBarLastString = sidebarHrefArray[sidebarHrefArray.length - 1].toLowerCase();
				if(locationLastString  == sideBarLastString){
					$(this).addClass("active");
				}
				return locationLastString  == sideBarLastString;
			}
		}
		);
                    
             if($("#map").length > 0){
                $.getScript("http://maps.google.co.uk/maps?file=api&v=2&async=2&callback=placeMap&key=my_API_key"); 
             }       
             
             $('button, .ui-button').button();    
             
             $('button, .ui-button').each(function(index,element){
                 if($(element).attr("data-icon") != undefined){
                     $(element).button( "option", "icons", {primary:'ui-icon-' + $(element).attr("data-icon")} );
                 }
             
                 if($(element).attr("data-no-text") != undefined && $(element).attr("data-no-text") == "true"){
                     $(element).button( "option", "text", false );
                 }
             } );
             
             if($("textarea").length > 0){
                $("head").append("<link>");
                css = $("head").children(":last");
                css.attr({
                  rel:  "stylesheet",
                  type: "text/css",
                  href: "/public/wysiwyg/jquery.wysiwyg.css"
                });
                $("head").append("<link>");
                css = $("head").children(":last");
                css.attr({
                  rel:  "stylesheet",
                  type: "text/css",
                  href: "/public/wysiwyg/help/lib/plugins/farbtastic/css/farbtastic.css"
                });                
                
                $.getScript("/public/wysiwyg/jquery.wysiwyg.js",function(){
                    $.getScript("/public/wysiwyg/plugins/wysiwyg.i18n.js",function(){
                        $.getScript("/public/wysiwyg/i18n/lang.pl_pl.js",function(){
                             $.getScript("/public/wysiwyg/help/lib/plugins/farbtastic/farbtastic.js",function(){
                                $.getScript("/public/wysiwyg/controls/wysiwyg.colorpicker.js",function(){
                    

                    
                    
                                        $("textarea").wysiwyg(
                                                        {
                                                            initialContent: "",
                                                            rmUnusedControls: true, 
                                                            plugins: {
                                                                autoload: true,
                                                                i18n: {lang: "pl"},
                                                                rmFormat: {rmMsWordMarkup: true}
                                                            },
                                                            controls: {
                                                                bold: {visible : true},
                                                                italic: {visible : true},
                                                                underline: {visible : true},
                                                                strikeThrough: {visible : false},
                                                                justifyLeft:{visible : true},
                                                                justifyCenter:{visible : true},
                                                                justifyRight:{visible : true},
                                                                justifyFull:{visible : true},
                                                                indent:{visible : true},
                                                                outdent:{visible : true},
                                                                subscript:{visible : false},
                                                                superscript:{visible : false},
                                                                undo:{visible : true},
                                                                redo:{visible : true},
                                                                insertUnorderedList:{visible : true},
                                                                insertHorizontalRule:{visible : true},
                                                                insertOrderedList: {visible : true},
                                                                h1: {visible: true},
                                                                h2: {visible: true},
                                                                h3: {visible: true},
                                                                colorpicker: {
                                                                    groupIndex: 11,
                                                                    visible: true,
                                                                    css: {
                                                                        "color": function (cssValue, Wysiwyg) {
                                                                                var document = Wysiwyg.innerDocument(),
                                                                                                defaultTextareaColor = $(document.body).css("color");

                                                                                        if (cssValue !== defaultTextareaColor) {
                                                                                                return true;
                                                                                        }

                                                                                        return false;
                                                                                }
                                                                        },
                                                                        exec: function() {
                                                                                if ($.wysiwyg.controls.colorpicker) {
                                                                                        $.wysiwyg.controls.colorpicker.init(this);
                                                                                }
                                                                        },
                                                                        tooltip: "Colorpicker"
                                                                }
                                                        }
                                                });
               
                                });
                            });
                        })
                    })
                });
                
                

                
                
             } 
	});
                    
                    

//<![CDATA[ 
function placeMap() { 
if (GBrowserIsCompatible()) { 
var map = new GMap2(document.getElementById("map")); 
map.addControl(new GSmallMapControl()); 
var MapTypes = map.getMapTypes(); 
MapTypes[0].getName= function() { return "Mapa";} 
MapTypes[1].getName = function() { return "Satelitarna";} 
MapTypes[2].getName = function() { return "Hybrydowa";} 
map.addControl(new GMapTypeControl()); 
map.addControl(new GScaleControl()); 
map.setCenter(new GLatLng(52.41953851609767, 16.78679957985878), 14); 
var info='<div style="background-color: #fff; width: 200px; font-size: 11px; FONT-FAMILY: Verdana, Tahoma, Arial, Sans-Serif;"><B>Bosch Service - Walenciak</B><hr>ul. Modrzewiowa 4<BR>Pozna&#324;-Prze&#378;mierowo<BR>walenciak@bosch-service.pl<BR>61 814 18 66 <hr><B>GPS</B> N: 52&deg; 25&#39; 10&#34; &nbsp;E: 16&deg; 47&#39; 12&#34; </div>'; 
var point = new GLatLng(52.41953851609767, 16.78679957985878); 
var marker = new GMarker(point); 
GEvent.addListener(marker, "click", function() { 
marker.openInfoWindowHtml(info); 
}); 
map.addOverlay(marker); 
marker.openInfoWindowHtml(info); 

} 
} 

 function changeActiveElement(element)
{
    if(($(element))){
        var id = $(element).val();
        var isActive = 0;
        if($(element).attr("checked") == "checked"){
            isActive = 1;
        }

        $.post('/news/setactive/',{id: id, active: isActive},function(){
            
        },"json");
    }
}

function showContactForm()
{
    $.post("/forms/contact/",{viewparam: "1"},function(req){
        $("#contact_form").html(req);
    },"html");
}
//]]> 


