var isNav, isIE
if(parseInt(navigator.appVersion.charAt(0))>=4){
var isNav = (navigator.appName == "Netscape") ? true : false
var isIE  = (navigator.appName.indexOf("Microsoft") != -1) ? true : false
}


var req1 = null; 
var req2 = null;
var req3 = null; 
var req4 = null; 
var req5 = null; 
var req6 = null; 
var req7 = null; 
var req8 = null; 
var req9 = null; 
var req1 = null; 
var req12 = null; 
var req13 = null; 
var req14 = null; 
var req15 = null; 
var news_read_last = null; 

var tab_news    = new Array();
var tab_sekcja2 = [new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array()];


function i()
{
frames['auth'].location.href="http://auth2.media.com.pl/index.php?eq=5&sid=dziennik.media.com.pl&pid=/auth.php"
}


function RS()
{
tab_news    = new Array();
tab_sekcja2 = [new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array(),new Array()];
}



function n(i)
{

 if(tab_news[i] == 1)
 {
 CR('n_' + i);
 tab_news[i] = 0;
 }
 else
 {
 SR(req1,'n_'+i,'strona_6_2.php?i='+i,0);
 tab_news[i] = 1;
 }

}



function n2(i)
{
if(news_read_last>0) CR('n_'+news_read_last);

if(news_read_last!=i)
SR(req1,'n_'+i,'strona_6_2.php?i='+i,0);

if(news_read_last==i) news_read_last=0;
else
news_read_last=i;

}



function submit_enter(evt)
{

 if(isNav)
 {
 a= evt.which
 if(a==13) 
  {
 document.form_login.submit();  
 
  }
 }

if(isIE)
 {
 a=window.event.keyCode
 if(a==13) 
  {
 document.form_login.submit();    
  }
 }
}



function on_enter_search(evt)
{
 if(isNav)
  {
  a= evt.which
   if(a==13) 
   {
   search_1()
   }

   }
	     
 if(isIE)
  {
   a=window.event.keyCode
   if(a==13) 
   {
   search_1()
   }
  }
 
}

function search_1()
{
var req = mint.Request("search.php", null , OnSearch1);
    req.AddParam("search", $("search").value);
    req.Send();
} 

function search_adv()
{
var req = mint.Request("search.php", null , OnSearch2);

     req.AddParam("tryb", 'srch_adv');
     req.AddParam("p1", $("p1").value);
     req.AddParam("p2", $("p2").value);    
     req.AddParam("p3", $("p3").value);
     req.AddParam("p4", $("p4").value);
     req.AddParam("p5", $("p5").value);
     req.AddParam("p6", $("p6").value);
     req.AddParam("p7", $("p7").value);

    req.Send();
} 


function r()
{
SW(req5,"kernel","strona_14.php",1);
}



function OnSearch1()
{
//   $("sea").innerHTML = this.responseText;
parent.CR('mod_c_1');
//parent.SR(req2,'mod_c_1','strona_8.php',0)
parent.SJ(req2,'mod_c_1','strona_8.php',0,'SW(req3,"kernel","strona_14.php",1)');

}



function OnSearch2()
{
//   $("sea").innerHTML = this.responseText;
//alert(4);
CR('mod_c_1');
SJ(req2,'mod_c_1','strona_8.php',0,'SW(req3,"kernel","strona_14.php",1)');

}


function inneserwisy()
{

if (document.linklist.inne_serwisy.options[document.linklist.inne_serwisy.selectedIndex].value != "none") {targetBlank(document.linklist.inne_serwisy.options[document.linklist.inne_serwisy.selectedIndex].value) }    
}
 

function targetBlank (url) {
blankWin = window.open(url,"_blank","menubar=yes,toolbar=yes,location=yes,directories=yes,fullscreen=yes,titlebar=yes,hotkeys=yes,status=yes,scrollbars=yes,resizable=yes");
}


function test(where)
{
alert('Hello from ' + where );
}

function koszyk_reload()
{
SR(req1,"mod_c_1","koszyk_show2.php",0);
SR(req2,"mod_p_1","koszyk_maly.php",0);
}



function CR(div_1)
{
mint.fx.Fade(div_1, 0, 3, 50, null, put_null);		   

function put_null()
{
$(div_1).innerHTML = '<b></b>';
mint.fx.Fade(div_1, 100, 3, 20);
}

}


function SR(req,div_1,html_page,eval_run)
 {
   
   req = mint.Request();
   req.timeout =20000;
   var odp;   
   req.OnLoading = function() 
                   {
   mint.fx.Fade( div_1 , 0, 3, 30, null, ShowWait);		   
	           } 

   req.OnSuccess = function() 
                   {
		    mint.fx.Fade(div_1, 0, 3, 30, null, ShowContent);
	           } 


 req.OnAbort =  function() {
         alert("Serwer ma problemy z odebraniem zapytania. Spróbuj ponownie późnej.");
	 }
 req.Send(html_page) 

   function ShowContent() {
   if(eval_run==1)
   {
   eval(req.responseText)
   $(div_1).innerHTML = "";
   }
   else
   {
   $(div_1).innerHTML = odp = req.responseText ;
   }

   mint.fx.Fade(div_1, 100, 3, 30);
   }

   
   function ShowWait()
   {
   $(div_1).innerHTML = "<img src=img/wait.gif width=16 height=16 border=0>";
   mint.fx.Fade(div_1, 100, 3, 10);   
   }
   
}

function SW(req,div_1,html_page,eval_run) {
   
   req = mint.Request();
   req.timeout =20000;
   var odp;   

   req.OnSuccess = function() 
                   {
		   ShowContent()
		   } 


 req.OnAbort =  function() {
         alert("Serwer ma problemy z odebraniem zapytania. Spróbuj ponownie późnej.");
	 }
 req.Send(html_page) 

   function ShowContent() {
   if(eval_run==1)
   {
   eval(req.responseText)
   $(div_1).innerHTML = "";
   }
   else
   {
   
   $(div_1).innerHTML = odp = req.responseText ;
   }

   }
   
}

function SWJ(req,div_1,html_page,eval_run,jsRun) {
   
   req = mint.Request();
   req.timeout =20000;
   var odp;   

   req.OnSuccess = function() 
                   {
		   ShowContent()
		   } 


 req.OnAbort =  function() {
         alert("Serwer ma problemy z odebraniem zapytania. Spróbuj ponownie późnej.");
	 }
 req.Send(html_page) 

   function ShowContent() {
   if(eval_run==1)
   {
   eval(req.responseText)
   $(div_1).innerHTML = "";
   }
   else
   {
   $(div_1).innerHTML = odp = req.responseText ;
   }
   
   eval(jsRun)   

   }
   
}



function SJ(req,div_1,html_page,eval_run,jsRun) {
   
   req = mint.Request();
   req.timeout =20000;
   var odp;   
   req.OnLoading = function() 
                   {
		    mint.fx.Fade(div_1, 0, 3, 30, null, ShowWait);		   
	           } 

   req.OnSuccess = function() 
                   {
		    mint.fx.Fade(div_1, 0, 3, 30, null, ShowContent);
	           } 


 req.OnAbort =  function() {
         alert("Serwer ma problemy z odebraniem zapytania. Spróbuj ponownie późnej.");
	 }
 req.Send(html_page) 

   function ShowContent() {
   if(eval_run==1)
   {
   eval(req.responseText)
   $(div_1).innerHTML = "";
   }
   else
   {
   $(div_1).innerHTML = odp = req.responseText ;
   }

   mint.fx.Fade(div_1, 100, 3, 30,null,runJSafter);
   }
   
   function runJSafter()
   {
   eval(jsRun)
   }       
    
   
   function ShowWait()
   {
   $(div_1).innerHTML = "<img src=img/wait.gif width=16 height=16 border=0>";   
   mint.fx.Fade(div_1, 100, 3, 10);   
   }
   
}

function prod_add(id)
{
//SR(req1,'koszyk',"koszyk.php?com=prod_add&show=ilosc&id="+id,0)
SR(req2,'prod_ilosc_'+id,"koszyk.php?com=prod_add&show=ilosc&id="+id,0)

if(document.getElementById("prod_sub_"+id).innerHTML =='')
   document.getElementById("prod_sub_"+id).innerHTML = "<a href=javascript:prod_sub("+id+")><img src=\"images/nawigacja/koszyk_sub.gif\"  border=0></a>";

//SR(req2,'prod_sub_'+id,"koszyk.php?com=prod_add&show=ilosc&id="+id,0)
}


function prod_add2(id)
{
//SR(req1,'koszyk',"koszyk.php?com=prod_add&show=ilosc&id="+id,0)
SR(req2,'prod_ilosc_'+id,"koszyk.php?com=prod_add&id="+id,0)
}



function prod_sub(id)
{
SR(req2,'prod_ilosc_'+id,"koszyk.php?com=prod_sub&show=ilosc&id="+id,0)
if(document.getElementById("prod_ilosc_"+id).innerHTML==1)
document.getElementById("prod_sub_"+id).innerHTML = "";

}

window.name="okno1";
var strona1;
var strona2;
var newwindow;

function wo(strona,okno,x,y)
{
config="toolbar=no,location=no,directories=no,status=no,menubar=no,width="+x+",height="+y+",scrollbars=yes,resizable=yes,left=100,top=300"
newwindow=window.open (strona,okno,config)
if (window.focus) {newwindow.focus()}
}

function SF() {
    var req = mint.Request();
                   
        req.OnSuccess = function() {
	$("mod_c_1").innerHTML = this.responseText;
	    }
	           
	    req.SendForm("form");
	}
	
	
function get_step()
{
var req = mint.Request();
req.Send("get_step.php", "step_now");
}


function DoIt()
{

get_step();

var step_now = parseInt(document.getElementById('step_now').innerHTML)+0;
var step_old = parseInt(document.getElementById('step_old').innerHTML)+0;

if(step_now!=step_old) 
{
SR(req5,'mod_p_2','steps.php',0);
document.getElementById('step_old').innerHTML = step_now;
}

clearTimeout( timer );
timer = setTimeout( "DoIt()", 1000 );

}

//timer = setTimeout( "DoIt()", 1000 );	

var selBkg = "url(./img/template_01/tab2/bg_on2.gif)";
var selLeft = "url(./img/template_01/tab2/left_on2.gif)";
var selRight = "url(./img/template_01/tab2/right_on2.gif)";

var pBkg = "url(./img/template_01/tab2/bg_off2.gif)";
var pLeft = "url(./img/template_01/tab2/left2.gif)";
var pRight = "url(./img/template_01/tab2/right2.gif)";

function selPane( id ) {

var tids = new Array("t1", "t2", "t3","t4","t5","t6","t7");
var cids = new Array("c1", "c2", "c3","c4","c5","c6","c7");


  cur_tid = "t" + id;
  cur_cid = "c" + id;

  for ( var i=0; i < tids.length; i++ ) {
    if ( cur_tid == tids[i] ) {
    
      document.getElementById(tids[i]).childNodes[0].style.backgroundImage = selLeft;
      document.getElementById(tids[i]).childNodes[1].style.backgroundImage = selBkg;
      document.getElementById(tids[i]).childNodes[1].style.color = "#932731";
      document.getElementById(tids[i]).childNodes[2].style.backgroundImage = selRight;
    } else {
      document.getElementById(tids[i]).childNodes[0].style.backgroundImage = pLeft;
      document.getElementById(tids[i]).childNodes[1].style.backgroundImage = pBkg;
      document.getElementById(tids[i]).childNodes[1].style.color = "#000000";
      document.getElementById(tids[i]).childNodes[2].style.backgroundImage = pRight;
    }
    if ( cur_cid != cids[i] ) {
      document.getElementById(cids[i]).style.display = "none";
    } else {
      document.getElementById(cids[i]).style.display = "block";
    }
  }
}


function selPane2( tid, cid , id ) {

var tids = new Array("t1", "t2", "t3","t4","t5","t6","t7");
var cids = new Array("c1", "c2", "c3","c4","c5","c6","c7");

if(id==2)
{
var tids = new Array("t1", "t2", "t3");
var cids = new Array("c1", "c2", "c3");
}

for (var i=0; i < tids.length; i++ ) {

  if ( tid == tids[i] ) {
   
   document.getElementById(tids[i]).childNodes[0].style.backgroundImage = selLeft
   document.getElementById(tids[i]).childNodes[1].style.backgroundImage = selBkg;
   document.getElementById(tids[i]).childNodes[1].style.color = "#932731";
   document.getElementById(tids[i]).childNodes[2].style.backgroundImage = selRight;
  } else {
   document.getElementById(tids[i]).childNodes[0].style.backgroundImage = pLeft;
   document.getElementById(tids[i]).childNodes[1].style.backgroundImage = pBkg;
   document.getElementById(tids[i]).childNodes[1].style.color = "#000000";
   document.getElementById(tids[i]).childNodes[2].style.backgroundImage = pRight;
  }

 
}

for (var i = 0; i < cids.length; i++) {
  if ( cids[i] == cid ) {
    document.getElementById(cids[i]).style.display = "block";
  } else {
    document.getElementById(cids[i]).style.display = "none";
  }
}

}	

var znak2;

function pokaz()
{
SW(req1,'lista_index_'+typ,"strona_12.php?z="+znak2+"&i="+typ,0)
}

var timer;
var typ;

function search_index(zn,t)
{
znak2=zn
typ=t
clearTimeout( timer );
timer = setTimeout( "pokaz()", 1000 );


}

function S(a,s,d)
{

var ta=a.split(','); 


 if(tab_sekcja2[s][d] == 1)
 {
 
 $("tr"+s+d).innerHTML = '<img src="img/template_01/tr2.gif" align="absmiddle" border="0" hspace="5">';
 $("tr_end"+s+d).innerHTML = '';


     tab_sekcja2[s][d] = 0;
     
     for(indeks in ta) if(ta[indeks]+0 > 0) 
     {
     CR('n_'+ta[indeks]+"_"+s);
     tab_news[ta[indeks]+"_"+s]=0;
     }

 }
 else
 {

$("tr"+s+d).innerHTML = '<img src="img/template_01/tr1.gif" align="absmiddle" border="0" hspace="5">';
$("tr_end"+s+d).innerHTML = '<img src="img/template_01/tr1.gif" align="right" border="0" hspace="20">';



 tab_sekcja2[s][d] = 1;
 for(indeks in ta) if(ta[indeks]+0 > 0)
 {

 SR(req1,'n_'+ta[indeks]+"_"+s,'strona_6_2.php?i='+ta[indeks],0);

 tab_news[ta[indeks]+"_"+s]=1;
 }
 
 
 }



}

function S2(a,s,d)
{

 var ta=a.split(','); 

 if(tab_sekcja2[s][d] == 1)
 {
 
 $("tr"+s+d).innerHTML = '<img src="img/template_01/tr2.gif" align="absmiddle" border="0" hspace="5">';
 $("tr_end"+s+d).innerHTML = '';

     tab_sekcja2[s][d] = 0;
     
     for(indeks in ta) if(ta[indeks]+0 > 0) 
     {

  if(isObject(document.getElementById('n_'+ta[indeks]+"_"+s+'_s')))
  {
  CR('n_'+ta[indeks]+"_"+s+'_s');
  tab_news[ta[indeks]+"_"+s+'_s']=0;
  }
      
     }

 }
 else
 {

$("tr"+s+d).innerHTML = '<img src="img/template_01/tr1.gif" align="absmiddle" border="0" hspace="5">';
$("tr_end"+s+d).innerHTML = '<img src="img/template_01/tr1.gif" align="right" border="0" hspace="20">';



 tab_sekcja2[s][d] = 1;
 for(indeks in ta) if(ta[indeks]+0 > 0)
 {

 if(isObject(document.getElementById('n_'+ta[indeks]+"_"+s+'_s')))
 {
 SR(req1,'n_'+ta[indeks]+"_"+s+'_s','strona_6_2.php?i='+ta[indeks],0);
 tab_news[ta[indeks]+"_"+s+'_s']=1;
 }
 
 }
 
}
}


function S3(a,s,d)
{

 var ta=a.split(','); 

 if(tab_sekcja2[s][d] == 1)
 {
 
 $("tr"+s+d).innerHTML = '<img src="img/template_01/tr2.gif" align="absmiddle" border="0" hspace="5">';
 $("tr_end"+s+d).innerHTML = '';

     tab_sekcja2[s][d] = 0;
     
     for(indeks in ta)  
     {
     CR('n_'+ta[indeks]);
     tab_news[ta[indeks]]=0;
     }

 }
 else
 {

 $("tr"+s+d).innerHTML = '<img src="img/template_01/tr1.gif" align="absmiddle" border="0" hspace="5">';
 $("tr_end"+s+d).innerHTML = '<img src="img/template_01/tr1.gif" align="right" border="0" hspace="20">';

 tab_sekcja2[s][d] = 1;

 for(indeks in ta) 
 {
 SR(req1,'n_'+ta[indeks],'strona_6_2.php?i='+ta[indeks],0);
 tab_news[ta[indeks]]=1;
 }
 
}
}



function isObject(a)
{
return (typeof a == 'object' && !!a);
}

function isU(a)
{
return typeof a == 'undefined';
}

function JS_1()
{
SJ(req1,'mod_c_1','strona_4_2.php',0,'SW(req2,"kernel","strona_14.php",1)')
}

function JS_2()
{
SJ(req1,'mod_c_1','strona_4_3.php',0,'SW(req2,"kernel","strona_14.php?son=1",1)')
}

function JS_3(i)
{
//SR(req1,'mod_c_1','strona_8.php?p='+i,0)
SJ(req1,'mod_c_1','strona_8.php?p='+i,0,'SW(req2,"kernel","strona_14.php",1)')
}

function JS_4(i)
{
RS();
SJ(req1,'mod_c_1','strony/strona_4.php?d='+i,0,'SW(req2,"kernel","strona_14.php",1)');
}

function JS_5(i,b,z)
{
SJ(req1,'mod_c_1',"strona_5.php?i="+i+"&b="+b+"&z="+z,0,'SW(req2,"kernel","strona_14.php",1)');
}



