jQuery(document).ready(function() {

    var sprawdz = document.getElementById('fileFile');

    if(sprawdz) {

        $('#fileFile').uploadify(
        {
            'uploader' : '/public/scripts/jquery.uploadify/uploadify.swf',
            'script2' : '/ajax/index/upload/',
            'script' : '/public/scripts/jquery.uploadify/uploadify.php',
            'cancelImg' : '/public/scripts/jquery.uploadify/cancel.png',
            'folder' : '/public/admin/cv',
            'auto' : true,
            'multi' : false,
            'removeCompleted' : false,
            'hideButton' : true,
            'width' : 100,
            'height' : 160,
            'wmode' : 'transparent',
            'fileExt' : '*.jpg;*.jpeg',
            'fileDesc' : 'Pliki JPG (.jpg, .jpeg)',
            'onCancel' : function(event, ID, fileObj, data)
            {
                fileCVUsun();
            },
            'onComplete' : function(event, ID, fileObj, response, data)
            {
                //data.speed in kbs, response from php
                $('.file').replaceWith('<div id="file" class="file"><div id="fileInner"><span></span><img id="fileImg" src="/public/admin/cv/_' + response + '" alt="" /></div></div>');
                $('#fileCVName').val(response);
                $('#fileUsun').remove();
                //window.alert(response);
            }
        });

    }

    Cufon.replace(['.cufont'],{hover: true});


    /***STOPKA***/

    if ($("body").height() > $(window).height()) {
        $('#jQ_foot').css('position', 'static');
    } else{
        $('#jQ_foot').css('position', 'fixed');
        $('#jQ_foot').css('bottom', '0px');
    }

});

function fileCVUsun() {
    $('#file').replaceWith('<div id="file2" class="file">Dodaj zdjęcie</div>');
    $('#fileCVName').val('');
    $('#fileUsun').remove();
}

/***MAPA GOOGLE***/

function initialize() {
    var latlng = new google.maps.LatLng(50.02638, 21.979716);
    var myOptions = {
      zoom: 15,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("maps"),
            myOptions);

    var contentString =
            '<div><br /><h4>BigCom - agencja interaktywna</h4><br />'+
            'ul. Tadeusza Boya-Żeleńskiego 12,<br />' +
            '35-105 Rzeszów,<br />' +
            'telefon: +48 17 864 22 60 <br />'+
            '</div>';

    var marker = new google.maps.Marker({
      position: latlng
    });


    var infowindow = new google.maps.InfoWindow({
            content: contentString
    });

    marker.setMap(map);
    infowindow.open(map,marker);
}

