$(document).ready(function(){

    //$("#my-dropdown").sSelect();
    $(".newsletterBox .text").focus(function(){ $(this).val(""); });
    
    $('a.modal').click(function (e) {
      e.preventDefault();
      width = 480;
      height = 390;
      if ($(this).attr('rel'))
      {
    	  rel = $(this).attr('rel');
    	  size = rel.split(',');
    	  width = size[0];
    	  height = size[1];
      }
      $('#basic-modal-content').modal({containerCss:{width:width+'px',height:height+'px'}});
      $('#basic-modal-content iframe').attr('width',width-20+'px').attr('height',height-20+'px');
      $('#basic-modal-content iframe').attr('src', $(this).attr('href'));
      
    });
    
/*****************************************************************************/

    $("#leftBox .menu dd a").click(function(){
        $(this).next("ul").toggle("fast");
    });

/*****************************************************************************/    
    /*
    marqueeInit({
	    uniqueid: 'mycrawler',
	    style: {
		    'width': '550px',
		    'height': '50px',
		    'margin':'auto'
	    },
	    inc: 2,
	    mouse: 'pause',
	    moveatleast: 2,
	    neutral: 150,
	    savedirection: true
    });
    */
        
/*****************************************************************************/

    var width = 610;
    
    var position1 = 1;
    var count1 = 0;
    $("#slideOne .slidePanel li").each(function(i){ count1=i; });
    count1--;

    $("#slideOne .slidePanel li").click(function(){

        if ($(this).attr("id") == "slidePrev")
        {
            position1--;
            if (position1 <= 0) position1 = count1;
        }
        else if ($(this).attr("id") == "slideNext")
        {
            position1++;
            if (position1 > count1) position1 = 1;
        }
        else
        {
            var bttn = $(this).html();
            position1 = bttn;
        }
        
        moveX = (position1 - 1) * (-width);
        
        $("#slideOne .container").animate({left:moveX}, function(){
        
            $("#slideOne .slidePanel li").each(function(i){
                if (i == position1)
                    $(this).attr("class","active");
                else
                    $(this).attr("class","");
            });
        
        });

    });
    
    // ----
    
    var position2 = 1;
    var count2 = 0;
    $("#slideTwo .slidePanel li").each(function(i){ count2=i; });
    count2--;

    $("#slideTwo .slidePanel li").click(function(){

        if ($(this).attr("id") == "slidePrev")
        {
            position2--;
            if (position2 <= 0) position2 = count2;
        }
        else if ($(this).attr("id") == "slideNext")
        {
            position2++;
            if (position2 > count2) position2 = 1;
        }
        else
        {
            var bttn = $(this).html();
            position2 = bttn;
        }
        
        moveX = (position2 - 1) * (-width);
        
        $("#slideTwo .container").animate({left:moveX}, function(){
        
            $("#slideTwo .slidePanel li").each(function(i){
                if (i == position2)
                    $(this).attr("class","active");
                else
                    $(this).attr("class","");
            });
        
        });

    });
    
    // ----
    
    var position3 = 1;
    var count3 = 0;
    $("#slideThree .slidePanel li").each(function(i){ count3=i; });
    count3--;

    $("#slideThree .slidePanel li").click(function(){

        if ($(this).attr("id") == "slidePrev")
        {
            position3--;
            if (position3 <= 0) position3 = count3;
        }
        else if ($(this).attr("id") == "slideNext")
        {
            position3++;
            if (position3 > count3) position3 = 1;
        }
        else
        {
            var bttn = $(this).html();
            position3 = bttn;
        }
        
        moveX = (position3 - 1) * (-width);
        
        $("#slideThree .container").animate({left:moveX}, function(){
        
            $("#slideThree .slidePanel li").each(function(i){
                if (i == position3)
                    $(this).attr("class","active");
                else
                    $(this).attr("class","");
            });
        
        });

    });
    
    

});


function changePhoto(small, big)
{
    $('#mainPhoto').attr('href', big);
    $('#mainPhoto img').attr('src', small);
}

function fullwindow(x,y,url)
{
	okno = 'width=' + x + ',height=' + y + ',toolbar=no,left='+(screen.availWidth-x)/2+',top='+(screen.availHeight-y)/2+',status=1';
	with(window.open(url, '', okno))
	{
  		focus();
	}
	
	
	
}
