//###################################	DOCUMENT.READY	##############
$(document).ready(function()
{



    var table = $('div.table');
    var logo = $('div.wizua-digital-design');
    var menu_space = $('div.menu_space');
    var bottom_space = $('div.bottom_space');
    var h1 = $('h1');
    var h2 = $('h2');
    var info = $('.info');




position_siteY();

/*
			$.featureList(
				$("#tabs li a"),
				$("#output li"), {
					start_item	:	0,
					pause_on_hover	:	1
				}
			);
*/
			
			// Alternative
			$('#tabs li a').featureList({
				output			:	'#output li',
				start_item		:	0
//				transition_interval	:	15000
			});
			

//    setTimeout(function(){table.css({opacity:0,display:"block"}).fadeTo(500,1);}, 1000 );



    $("#topnav li").prepend("<span></span>"); //Throws an empty span tag right before the a tag
    $("#topnav li").each(function() { //For each list item...
    var linkText = $(this).find("a").html(); //Find the text inside of the a tag
    $(this).find("span").show().html(linkText); //Add the text in the span tag
}); 
$("#topnav li").hover(function() {	//On hover...
$(this).find("span").stop().animate({ 
    marginTop: "-40" //Find the span tag and move it up 40 pixels
    }, 250);
} , function() { //On hover out...
$(this).find("span").stop().animate({
    marginTop: "0" //Move the span back to its original state (0px)
    }, 250);
});


    if(jQuery.browser.msie){
	position_top(menu_space,20);
	position_top(logo,0);
	position_bottom(bottom_space);
    }


    menu_space.mouseIsOver = false;

    var size = new Array("height","width");
    size = window.size();
    var scroll = new Array("X","Y");
    scroll = getScrollXY();
    var poz_s = scroll["Y"];
    var top_dist = poz_s;	
    var wysokosc = size["height"];
    
    $('div.menu_space').hoverIntent({
	sensitivity: 1, 
	interval: 10, 
	over: makeVisible, 
	timeout: 400, 
	out: makeFade
    })
    
    window.onscroll = function(){
        var size = new Array("height","width");
        size = window.size();
        var scroll = new Array("X","Y");
        scroll = getScrollXY();
        var top_dist = scroll["Y"];
    	if(top_dist>0){
	    if(!menu_space.mouseIsOver){
		menu_space.mouseIsOver=false;
		if(!menu_space.is(':animated')){
		    menu_space.fadeTo(300,0.6);
		}
	    }
	    else{
	    	menu_space.mouseIsOver=true;
		if(!menu_space.is(':animated')){
	    	    menu_space.fadeTo(300,1);
		}
	    }
	}
	else{
	    menu_space.fadeTo(300,1);
	}
	if(jQuery.browser.msie){
	    position_top(menu_space,20);
	    position_top(logo,0);
	    position_bottom(bottom_space);
	}
    }
    window.onresize = function()
    {
	position_siteY();
	var size = new Array("height","width");
    	size = window.size();
    	var scroll = new Array("X","Y");
    	scroll = getScrollXY();
    	var top_dist = scroll["Y"];
    	if(top_dist>0){
	    if(!menu_space.mouseIsOver){
		menu_space.mouseIsOver=false;
	    	if(!menu_space.is(':animated')){
		    menu_space.fadeTo(300,0.6);
		}
	    }
	    else{
		menu_space.mouseIsOver=true;
		if(!menu_space.is(':animated')){
			    menu_space.fadeTo(300,1);
			}
		    }
		}
		else{
		    menu_space.fadeTo(300,1);
		}
	    
	    if(jQuery.browser.msie)
	    {    
		position_top(menu_space,20);
		position_top(logo,0);
		position_bottom(bottom_space);
	    }
    }

function makeVisible(){
    menu_space.mouseIsOver = true;
    menu_space.fadeTo(300,1);
}
function makeFade(){
	    menu_space.mouseIsOver = false;
	    var size = new Array("height","width");
    	    size = window.size();
	    var scroll = new Array("X","Y");
	    scroll = getScrollXY();
    	    var poz_s = scroll["Y"];
	    var top_dist = poz_s;
//    	    var pasek = $('div#sun');
	    if(top_dist>0){
		menu_space.fadeTo(300,0.6);
	    }
}


var linki = document.getElementsByTagName('a');
for(i=0; i < linki.length; i++)
{
    if (linki[i].className=='klick_size')
    linki[i].onclick = klickSize;
        
}

}); // close document.ready
//######################################################

