function GetFilename(url)
{
   if (url)
   {
      var m = url.toString().match(/.*\/(.+?)\./);
      if (m && m.length > 1)
      {
         return m[1];
      }
   }
   return "";
}

function downloadme(x){
    myTempWindow = window.open(x,"Save");
    myTempWindow.document.execCommand("SaveAs",null,x);
    myTempWindow.close();
}



jQuery(document).ready(function() {
 	jQuery(function() {
        $("table.stripe tr:nth-child(odd)").addClass("odd");
      });



	jQuery("#loginbutt").click(function () {
      jQuery("#loginform").slideToggle("slow");
    });

   // Notice the use of the each method to gain access to each element individually
   jQuery('a.inzerat').each(function()
   {
      // Create image content using websnapr thumbnail service
      var content = '<img src="/uploads/pdf/inzeraty/';
      content += GetFilename($(this).attr('href'));
      content += '.gif" alt="Loading thumbnail..." />';

      // Setup the tooltip with the content
      jQuery(this).qtip(
      {
         content: content,

         position: {
            corner: {
               tooltip: 'bottomMiddle',
               target: 'topMiddle'
            },
            adjust: { x:0,y: -20}
         },
         style: {
         	width: 320,
         	title: { 'z-index': '9999999999999999999999999999999999999999' },
            tip: true, // Give it a speech bubble tip with automatic corner detection
            name: 'light'
         }
      });
   });

	jQuery("h3.hideparagraf").hidethem();



});

jQuery.fn.hidethem = function() {
	return this.each(function() {
		$(this).addClass("click").nextAll("p,ul").hide();
		$(this).bind('click', function()
		{
  			$(this).nextUntil("h3,div").slideToggle();
		});


	});

    /*return this.each(function() {
        this.style.color = 'red';
    });*/
};

