$(document).ready(function(){
  var thisURL = location.protocol+'//'+location.hostname+location.pathname;
  $('div.list_anotation:even').addClass('white_anote');
  $('div.list_anotation:odd').addClass('red_anote');
  $('.id1.pg1 div.list_anotation:first').addClass('first_anote');
  $('.id3.pg1 div.list_anotation:first').addClass('first_anote');
  $('div.first_anote a.list_anote_image_link').append('<div class="anote_shade"></div>');
  $('div.fbcomment').append('<fb:comments href="'+thisURL+'" colorscheme="dark" num_posts="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>');
  $('.id1.pg1 div.list_anotation:eq(2), .id3.pg1 div.list_anotation:eq(2), .id4.pg1 div.list_anotation:eq(2)').after('<div class="adv1"><div id="adv1"></div></div>');
  $('.mwguestlist dt:odd, .mwguestlist dd:odd').css('background-color', '#333333');
  $('a[href$=mp3-player.html]').attr('href','#').click( function() { open_player('mp3');});
  $("a[href$=.jpg],a[href$=.png],a[href$=.gif]").fancybox({
  	'titleShow'      : true,
  	'titlePosition'  : 'inside',
  	'autoScale' : false,
  	'onClosed'       : function(){$('object').css("visibility","visible")}
	}).click(function() { 
    $('object').css("visibility","hidden");
  });
  set_vail_input('#sm_mail','Vložte svůj e-mail');
  set_search_form('HLEDAT','Hledat na LetItRoll.cz');
});

function open_player(mod)
{	
	window.open('/'+mod+'-player.html','mp3_web_player', 'toolbar=0,menubar=0,location=no,directories=no,scrollbars=no,resizable=no,status=no,width=400,height=570,top=0,left=0');
	return false;
}

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,
                  			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('');
    }
  });
}

  function votenow(o){
   var obj = document.getElementById(o);
   obj.submit();
  }


