$(document).ready(function(){

  //$('div.fbcomment').append('<fb:comments css="http://'+window.location.host+'/_templates/default/_css/fb.css" numposts="10" width="625" publish_feed="true"></fb:comments>');
  //$('div.fblikebox').append('<fb:like-box href="http://www.facebook.com/letitrollcz" width="250" height="180" colorscheme="dark" show_faces="true" stream="false" header="false"></fb:like-box>');
  //$("#obalka").trigger('click');  
  set_vail_input('#sm_mail','Vložte svůj e-mail');
  set_search_form('HLEDAT','Hledat na White-Blue.cz');

  $(function() {						
    $('#head-slide').ulslide({
      width: 889,
      height: 230,
      duration: 400,
      autoslide: 3000,
      effect: {
        type: 'fade', // slide or fade
      },
      pager: '#slide-pager a'
    });
  });
    
  $("a[href*='/galerie/']").fancybox({
        'type'  : 'iframe',
        'width' : '760',
        'height': '600',
     	'titleShow'     : false,
     	'titlePosition'  : 'over'
  });
  
  $("a[href*='/content/media/katalogy/'],a[href$='.pdf']").fancybox({
      'type'  : 'iframe',
      'width' : '100%',
      'height': '100%',
     	'titleShow'     : true,
     	'titlePosition'  : 'over'
  });

  $("a[href$='.jpg']").fancybox({
     	'titleShow'     : true,
     	'titlePosition'  : 'over'
  });

/*
  $("li.full_naviset_actual a").addClass("selected hover").hover( function(){
    return false;
  });
  $("li.full_naviset_actual ul").show();
  $("li.full_naviset_actual a").addClass("selected hover").hover( function(){
    return false;
  });
  $("li.full_naviset_actual").parent("ul").prev('a').addClass("selected hover").hover( function(){
    return false;
  });

  $("li.full_naviset_actual").parent("ul").show(); 
*/
});


function set_search_form(t,tt){
  
  var b,f;
  
  try {
    f = document.createElement('<input type="text" class="in" value="" name="mwsearch" id="searchfield" autocomplete="off" />');
    b = document.createElement('<input type="submit" class="bt" value="' + t + '" title="' + tt + '" id="searchbutton" />');
    
  } catch (e) {
    f = document.createElement("input");
    f.setAttribute("type", "text");
    f.setAttribute("name", "mwsearch");
    f.setAttribute("value", "");
    f.setAttribute("class", "in");
    f.setAttribute("id", "searchfield");
    f.setAttribute("autocomplete", "off");
    
    b = document.createElement("input");
    b.setAttribute("class", "bt");
    b.setAttribute("type", "submit");
    b.setAttribute("value", t);
    b.setAttribute("title", tt);
    b.setAttribute("id", "searchbutton");
   
  }
  
  var p = document.getElementById('search_form');
  
 if(p && f && b){ 
    p.appendChild(f);
    p.appendChild(b);
  }
}

function _set_custom_focus(){
 var f = document.getElementById('searchfield');
 
 if(f){
   f.focus();	
 }
}

function getswf(id,param,w,h,play,loop,bg)
{
 	if (AC_FL_RunContent == 0) {
		alert('Error - script not found');
	} else {
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
			'width', w ,
			'height', h ,
			'src', param,
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', play ,
			'loop', loop ,
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'id', id ,
			'bgcolor', bg,
			'name', id ,
			'menu', 'false',
			'allowScriptAccess','sameDomain',
            'movie', param,
			'salign', ''
			); 
	}

}


//mailer - newsletter
jQuery.fn.delay = function(time,func){
	this.each(function(){
		setTimeout(func,time);
	});
	return this;
};

function __mw_jrun_post(xcatch,source,xtitle){	
			var s = document.getElementById(source);
			
			$.post(
				   xcatch,
           $(s).serialize(),
					function(data){
                  $('<div></div>')
                  		.html('<span style="font-weight:bold;font-size:16px;">' + data + '<\/span>')
                  		.dialog({
                  			title: xtitle,
                  			position: 'top',
                  			buttons: { "Ok": function() { $(this).dialog("close"); } },
                  			open: function(event, ui) {$(this).delay(2000,function(){$('*').dialog("close");}) }
              		    });

					}
			);	
}          
function set_vail_input(id,txt) {
  $(id).val(txt).focus(function() {
    if($(this).val()==txt) {
      $(this).val('');
    }
  });
}


