// JavaScript Document
function premiera(id) {
	if(!id) {return false;}
	var obj_post = new Object();
	obj_post['F_id'] = id;
	
	$("div#premiery500").html('<div style="height:526px;">...czekaj...</div>');
	
	//$.cookie('oferta[film]',id);
	
	$("a[id^=premiera_]").removeAttr("style");
	$("#premiera_" + id).css("background-position","0px -14px");
	
	var url = 'http://' + window.location.hostname + '/php/premiery500.php';
	$.post(url, obj_post, 
		   function(data){
			   $("div#premiery500").html(data);
			   });
	return false;
}

//=========================================================

function zwiastun(id){
	if(!id) {return false;}
	var obj_post = new Object();
	obj_post['F_id'] = id;
	$("div#premiery500").html('<div style="height:482px;">...czekaj...</div>');
	
	var url = 'http://' + window.location.hostname + '/php/zwiastuny500.php';
	$.post(url, obj_post, 
		   function(data){
			   $("div#premiery500").html(data);
			   });
	
	return false;
}

//=========================================================

function programFullTyt(height){
	$("div#programFullTyt").css('height',height);
	return false;	
}

//=========================================================

function filmTytul(height){
	$("div#filmTytul").css('height', height);
	return false;	
}

//=========================================================

function sport_pilkarz( link ){

   ww = 900
   hh = 560
   if( document.all ){
      wtop  = ",left=" + ( screen.availWidth  - ww )/2
      wleft = ",top=5"

   }
   else if( document.layers ){
      wtop  = ",screenX=" + ( screen.availWidth  - ww )/2
      wleft = ",screenY=5"
   }
   else {
      wtop  = ""
      wleft = ""
   }
   wnd = window.open( link, "pilkarz", 'scrollbars=yes,width=' + ww + ',height=' + hh + wtop + wleft )
   wnd.focus()
}

//=========================================================

function zwiastunyInne(id, can){
	if(!id) {return false;}
	if(!can) {return false;}
	var obj_post = new Object();
	obj_post['F_id'] = id;
	obj_post['F_can'] = can;
	$("div#zwiastunyInne").html('<div style="height:320px;">...czekaj...</div>');
	
	var url = 'http://' + window.location.hostname + '/php/zwiastuny_inne.php';
	
	$.post(url, obj_post, 
		   function(data){
			   $("div#zwiastunyInne").html(data);
			   });	
	
	return false;
}

//=======================================================

//=======================================================
function ajaxPreload(){

       var html="";
       var src="jsc/preloader.gif";
       var ico='<img src="' + src + '" alt="preload"/>';
       html = "<table cellspacing='0' cellpadding='0' width='100%' height='100%' border='0'><tr><td align='center' valign='middle' style='vertical-align:middle;'>" + ico + "</td></tr></table>";
       return html;

}

function ajaxError( xhr ){

       var html="";
       var src="/jsc/ajax-error.gif";
       var ico='<img src="' + src + '" alt="error"/>';
       html = "<table cellspacing='0' cellpadding='0' width='100%' height='100%' border='0'><tr><td align='center' valign='middle' style='vertical-align:middle;'>" + ico + " [" + xhr.status + "] " +
xhr.statusText + "</td></tr></table>";
       return html;

}

//=======================================================
function pokazMiniGalerie(str_ids)
{
	var url = 'http://' + window.location.hostname + '/galeria/ajax_galerii_mini';
	for(x in str_ids)
	{
		 $("#" + str_ids[x]).html(ajaxPreload());
		 $.ajax({
               async:false,
               type: 'POST',
               contentType: "application/x-www-form-urlencoded; charset=iso-8859-2",
               url:url,
               cache: false,
               data:{id:str_ids[x]},
               beforeSend: function(){$("#" + str_ids[x]).html(ajaxPreload());},//,null,
               success: function(html){$("#" + str_ids[x]).html(html);},//successResponse,
               dataType: "text",
               complete: null,
               timeout: 5000,
               error: null
       });
	function beforeSend()
		{
               $("#" + str_ids[x] + "").html( ajaxPreload() );
       	}

       function errorResponse( xhr, ajaxOptions, thrownError )
	   {
               $("#" + str_ids[x] + "").html( ajaxError( xhr ) );
       }

       function successResponse( html )
	   {
               $("#95").html("1");
       }   
	}
		

}
//======================================================
