jQuery(document).ready(function($){

 
    init_fancybox();
	
});

function alakot(opts) {
    //jQuery.each(imageList, function(i, val) {
    //  opts.itemArray.push(val);
    //		    });
    alert(1);
}

function init_fancybox_user() {
//    if((navigator.appName != "Microsoft Internet Explorer") || (navigator.appVersion.toLowerCase().indexOf('msie 6') == -1)) {
        $("a.window").fancybox({
            'absoluteSizeWidth':  true,
            'absoluteSizeHeight': true,
            'overlayShow':	true,
            'frameWidth': 700,
            'frameHeight': 500
        });
        
         $("a.postcard_window").fancybox({
            'absoluteSizeWidth':  true,
            'absoluteSizeHeight': true,
            'overlayShow':	true,
            'frameWidth': 700,
            'frameHeight': 500
        });

        

       $("a.window_send_to_friend").fancybox({
            'absoluteSizeWidth':  true,
            'absoluteSizeHeight': true,
            'overlayShow':	true,
            'frameWidth': 706,
            'frameHeight': 500
        });

       $("a.window_comment").fancybox({
            'absoluteSizeWidth':  true,
            'absoluteSizeHeight': true,
            'overlayShow':	true,
            'frameWidth': 706,
            'frameHeight': 500
        });

       $("a.window_contact_form").fancybox({
            'absoluteSizeWidth':  true,
            'absoluteSizeHeight': true,
            'overlayShow':	true,
            'frameWidth': 706,
            'frameHeight': 500
        });

		$("a.voice_window").fancybox({
            'overlayShow':	true,
            'frameWidth': 400,
            'frameHeight': 80
        });

        $("a.window_personalisation").fancybox({
            'absoluteSizeWidth':  true,
            'absoluteSizeHeight': true,
            'overlayShow':	true,
            'frameWidth': 700,
            'frameHeight': 400
        });

        $("#login_window").fancybox({
            'overlayShow':	true,
            'frameWidth': 460,
            'frameHeight': 230
        });

        $("a.register_window").fancybox({  
			'absoluteSizeWidth':  true,
            'absoluteSizeHeight': true,
            'overlayShow':	true,
            'frameWidth': 540,
            'frameHeight': 560
        });

//    }
    
}  



function init_fancybox()
{
//    if((navigator.appName != "Microsoft Internet Explorer") || (navigator.appVersion.toLowerCase().indexOf('msie 6') == -1)) {
         $("a.window").fancybox({
            'overlayShow':	true,
            'frameWidth': 700,
            'frameHeight': 500
        });

        $("a.postcard_window").fancybox({
            'absoluteSizeWidth':  true,
            'absoluteSizeHeight': true,
            'overlayShow':	true,
            'frameWidth': 700,
            'frameHeight': 500
        });

      $("a.window_contact_form").fancybox({
            'absoluteSizeWidth':  true,
            'absoluteSizeHeight': true,
            'overlayShow':	true,
            'frameWidth': 706,
            'frameHeight': 500
        });

       $("a.window_send_to_friend").fancybox({
            'absoluteSizeWidth':  true,
            'absoluteSizeHeight': true,
            'overlayShow':	true,
            'frameWidth': 706,
            'frameHeight': 500
        });

       $("a.window_comment").fancybox({
            'absoluteSizeWidth':  true,
            'absoluteSizeHeight': true,
            'overlayShow':	true,
            'frameWidth': 706,
            'frameHeight': 500
        });

        $("a.newsletter_window").fancybox({
            'absoluteSizeWidth':  true,
            'absoluteSizeHeight': true,
            'overlayShow':	true,
            'frameWidth': 700,
            'frameHeight': 430
        });

        $("a.newsletter").fancybox({
            'overlayShow':	true,
            'frameWidth': 460,
            'frameHeight': 230
        });

        $("a.window_print").fancybox({
            'absoluteSizeWidth':  true,//dodabe do fancy boxa, jeśli jest true to okno ma zawswze podany rozmiar!
            'absoluteSizeHeight': false,// oddzielnie dla szerokości i wysokości
            'overlayShow':	true,            
            'frameWidth': 780,
            'frameHeight': 600
        });

        $("a.event_link").fancybox({
            'overlayShow':	true,
			'absoluteSizeWidth':  true,
            'absoluteSizeHeight': true,
            'frameWidth': 300,
            'frameHeight': 400
        });
    
        $("#profile_window").fancybox({
            'absoluteSizeWidth':  true,
            'absoluteSizeHeight': true,
            'overlayShow':	true,
            'frameWidth': 540,
            'frameHeight': 570
        });

        $("#profile_window2").fancybox({
            'absoluteSizeWidth':  true,
            'absoluteSizeHeight': true,
            'overlayShow':	true,
            'frameWidth': 540,
            'frameHeight': 570
        });
    
        $("a.gallery").fancybox({
            //'overlayShow':	true,
            //'absoluteSizeWidth':  true,//dodabe do fancy boxa, jeśli jest true to okno ma zawswze podany rozmiar!
            //'absoluteSizeHeight': true,// oddzielnie dla szerokości i wysokości         
			'absoluteSizeWidth':  true,
            'absoluteSizeHeight': true,
            'overlayShow':	true,
            'frameWidth': 920,
            'frameHeight': 648
        });

        $("a.video-gallery").fancybox({
            //'overlayShow':	true,
            //'itemLoadCallback2': 'alakot',
            //'zoomSpeedIn': 0,
            //'zoomSpeedOut': 0, 
			'absoluteSizeWidth':  true,
            'absoluteSizeHeight': true,
            'frameWidth': 510,
            'frameHeight': 510
        });
        
        $("a.image-gallery").fancybox({
            //'absoluteSizeWidth':  true,//dodabe do fancy boxa, jeśli jest true to okno ma zawswze podany rozmiar!
            //'absoluteSizeHeight': true,// oddzielnie dla szerokości i wysokości     
			'absoluteSizeWidth':  true,
            'absoluteSizeHeight': true,
            'overlayShow':	true,
            'frameWidth': 920,
            'frameHeight': 648
        });
//    }

}


var min=40;
var max=250;
function increaseFontSize(object) {
    $(object).each(function() {
        var s = ((this.style.fontSize) ? parseInt(this.style.fontSize.replace("px","").replace("%","")) : 100);
        if(s<max) s *= 1.2;
        this.style.fontSize = s+"%"
    });
}

function decreaseFontSize(object) {
    $(object).each(function() {
        var s = ((this.style.fontSize) ? parseInt(this.style.fontSize.replace("px","").replace("%","")) : 100);
        if(s>min) s /= 1.2;
        this.style.fontSize = s+"%"
    });
}


/*
 * Image preview script
 * powered by jQuery (http://www.jquery.com)
 *
 * written by Alen Grakalic (http://cssglobe.com)
 *
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */

this.imagePreview = function(){
	/* CONFIG */

		xOffset = 10;
		yOffset = 30;

		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result

	/* END CONFIG */
	$("a.preview").hover(function(e){
		$("body").append("<p id='preview'><img src='"+ this.getAttribute('longdesc') +"' alt='Image preview' />"+ this.getAttribute('alt') +"</p>");
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("slow");
    },
	function(){
		$("#preview").remove();
    });
	$("a.preview").mousemove(function(e){
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});
};


// starting the script on page load
$(document).ready(function(){
	imagePreview();
});



