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(){

$('.essox-button').live('click', function(){
      var price = $('#essoxprice').val();
	  var essoxurl = $('#essoxurl').val(); 
      showEssox(price,essoxurl, 655, 430);
      
});
$('.essox-button2').live('click', function(){
      var price = $('#essoxprice2').val();
	  var essoxurl = $('#essoxurl2').val(); 
      showEssox(price,essoxurl, 655, 430);
      
});
function mdResize(sirka, vyska) {
        
    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"});
    }
    
   
}
$("#md_krizek, .md_overlay").click(function() {
        $(".md_overlay").hide();
    });
   

function showEssox(price,essoxurl, sirka, vyska) {
    
    mdResize(sirka, vyska);
   // alert('<iframe src="'+essoxurl+'" width="'+sirka+'" height="'+vyska+'" border=0 style="border:none;">');
    $('#md_content').html('<iframe src="'+essoxurl+'" width="'+sirka+'" height="'+vyska+'" scrolling=no border=0 style="border:none;"></iframe>');
                      
    $(".md_overlay").show();
   
}
});
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();
	       }); 
     });
}

