var subdomains = "";
$(window).load(function(){			   
//external link to new window			   
$('body a').filter(function() { 
    return this.hostname && this.hostname !== location.hostname; 
  }).addClass('external')
  .click(function() { 
    window.open(this.href); 
    return false; 
  });
 });
 
$(document).ready(function(){
		
$('.hide').click(function() {  
    $(this).parent().next('p').toggle('slow');
	});	

$('#footer form #input').click(function(){
    if ($(this).val()=='your e-mail @'){
      $(this).val('@'); 
    }
});

$('#contact .definput').live('click', function(){ 
      $(this).val('');
      $(this).attr('class',''); 

});

$('#contact .mail').live('click', function(){ 
      $(this).val('@');
      $(this).attr('class',''); 

});
$('.newsletter').live('click', function(){  
        if($('#terms').attr('checked') == false){
        alert("Prosíme potvrďte souhlas s podmínkami.");
        return false;
        }else{
            var email = $('.email').val();   
            $.get('http://'+location.hostname+'/'+subdomains+'inc/ajax.php', {newsletter: 'newsletter', email: email}, function(vystup) {resultDialog(vystup);} );
        }
        return false; 

});

$('#contact .submit').live('click', function(){ 
    
    if($('#term').attr('checked') == false){
      alert("Prosíme potvrďte souhlas s podmínkami.");
      return false;
    }else{
      return true;
    }
  

});
$("#md_krizek, .md_overlay").click(function() {
        $('#md_content').html('');
        $(".md_overlay").hide();
        //$(".tdkrizekW").hide();
        $(".tdkrizek").show();
		$.get('http://'+location.hostname+'/'+subdomains+'inc/ajax.php', {intro: '1'});	
        var lang = $('#language').val();
        $('#flashhome').flash({src:'http://'+location.hostname+'/'+subdomains+'swf/homepage-fotky'+lang+'.swf',
                        height:393,
                        width:478, 
                        wmode: 'transparent'
                        });
        $('#flashclients').flash({src:'http://'+location.hostname+'/'+subdomains+'swf/homepage-loga.swf',
                        height:51,
                        width:897, 
                        wmode: 'transparent'
                        });			                
    });

video = 0;
$('#logomenu a').live('click', function(){ 
      showVideo('http://'+location.hostname+'/'+'swf/intro.swf', 700, 525);
      $('#flashhome').html('');
      $('#flashclients').html('');
});

$('#form').flash({src:'http://'+location.hostname+'/'+subdomains+'swf/str-contactUs.swf',
                        height:510,
                        width:510
                        });


$('#fivestarscz').live('click', function(){ 
     // showPf(550, 500);

});


});
function resultDialog(val){
    $(document).ready(function(){
        $("div#dialog #d-text").html(val);
        $("div#dialog").show().animate({opacity: 1.0},4000).hide('fast');
        //close dialog manually
        $('div#dialog span').live ('click' , function() { 
            $(this).parent().hide();
	       }); 
     });
}
function showVideo(adresa, sirka, vyska) {
$(document).ready(function(){        
    mdResize(sirka, vyska);
    if(video == 0){
    $('#md_content').flash({src:adresa,
                        height:vyska,
                        width:sirka,
                        bgcolor:'#000000'
                        });
    video = 0;
    }
    $(".md_overlay").show();
    });
}
function showPf(sirka, vyska) {
$(document).ready(function(){        
    mdResize(sirka, vyska);
    $(".md_overlay").addClass('pf');
    $(".tdkrizek").hide();
    $(".tdkrizekW").show();
    $('#md_content').html('<img src="http://'+location.hostname+'/'+'files/img/pf2011.jpg" width="'+sirka+'" height="'+vyska+'" alt="PF2011" />');
    $(".md_overlay").show();
    });
}
function mdResize(sirka, vyska) {
$(document).ready(function(){        
    if($(window).height() < vyska) {
        $("#md_window").css({"margin-left": "-"+sirka/2+"px", "margin-top": "-"+(($(window).height() / 2)-5)+"px"});
        $("#md_content").css({"width": (sirka+getScrollerWidth())+"px", "height": ($(window).height()-40)+"px", "overflow" : "auto"});
    } else {
        $("#md_window").css({"margin-left": "-"+sirka/2+"px", "margin-top": "-"+vyska/2+"px"});
        $("#md_content").css({"width": sirka+"px", "height": vyska+"px"});
    }
    
   });
}
