var xmlHttp


function search_cat2(cat,value,add_del)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
} 
var url="inc/search_adv.php"
url=url+"?cat="+cat
url=url+"&value="+value
url=url+"&add_del="+add_del
xmlHttp.onreadystatechange=stateChangedCat2
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChangedCat2() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
document.getElementById("ajax_content").innerHTML=xmlHttp.responseText 
} 
} 





function zdjecie(model,under)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
} 
var url=under+"inc/zdjecie.php"
url=url+"?model="+model
xmlHttp.onreadystatechange=stateChangedZdjecie
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChangedZdjecie() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
document.getElementById("ZdjecieHint").innerHTML=xmlHttp.responseText 
} 
} 
function closeZdjecie()
{ 
	if(navigator.appName == "Opera"){
	document.getElementById("ZdjecieHint").innerHTML="&nbsp;"
	}	
	else
	document.getElementById("ZdjecieHint").innerHTML=""
}



function GetXmlHttpObject()
{ 
var objXMLHttp=null
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
}


	function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
	}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}


function addPosition(name){
if (navigator.appName == "Microsoft Internet Explorer")
createCookie(name,document.body.scrollTop,1);
else
createCookie(name,window.pageYOffset,1);
}

   var http_request = false;
   function makePOSTRequest(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      
      http_request.onreadystatechange = alertContents;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }

   function alertContents() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            document.getElementById('myspan').innerHTML = result;            
         } else {
            alert('There was a problem with the request.');
         }
      }
   }
   
        
   
   
   
    function makePOSTRequest1(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
         	// set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      
      http_request.onreadystatechange = alertContents1;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
   }

   function alertContents1() {
      if (http_request.readyState == 4) {
         if (http_request.status == 200) {
            //alert(http_request.responseText);
            result = http_request.responseText;
            document.getElementById('ajax_content').innerHTML = result;            
         } else {
            alert('There was a problem with the request uhhh.');
         }
      }
   }
   
   
   
        function get_rejestracja(obj) {
          var poststr = "name=" + encodeURI( document.getElementById("name").value ) +
      		"&www=" + encodeURI( document.getElementById("www").value ) +		
      		"&address=" + encodeURI( document.getElementById("address").value ) +
      		"&zip=" + encodeURI( document.getElementById("zip").value ) +		
         		"&miasto=" + encodeURI( document.getElementById("miasto").value ) +
      				"&wojewodztwo=" + encodeURI( document.getElementById("wojewodztwo").value ) +
      				"&telefon=" + encodeURI( document.getElementById("telefon").value ) +
      				"&mphone=" + encodeURI( document.getElementById("mphone").value ) +
      				"&fax=" + encodeURI( document.getElementById("fax").value ) +
      				"&mail=" + encodeURI( document.getElementById("mail").value ) +
      				"&text=" + encodeURI( document.getElementById("text").value ) +
      				"&login=" + encodeURI( document.getElementById("login").value ) +
      				"&pass=" + encodeURI( document.getElementById("pass").value ) +
      				"&pass1=" + encodeURI( document.getElementById("pass1").value ) +
      				"&send=1";
    makePOSTRequest1('../inc/rejestracja.php', poststr);
   
   }
   
   
        function get_podstawowe_informacje(obj) {
          var poststr = "name=" + encodeURI( document.getElementById("name").value ) +
      		"&www=" + encodeURI( document.getElementById("www").value ) +		
         		"&miasto=" + encodeURI( document.getElementById("miasto").value ) +
         		"&address=" + encodeURI( document.getElementById("address").value ) +
      			"&zip=" + encodeURI( document.getElementById("zip").value ) +	
      				"&wojewodztwo=" + encodeURI( document.getElementById("wojewodztwo").value ) +
      				"&telefon=" + encodeURI( document.getElementById("telefon").value ) +
      				"&mphone=" + encodeURI( document.getElementById("mphone").value ) +
      				"&fax=" + encodeURI( document.getElementById("fax").value ) +
      				"&mail=" + encodeURI( document.getElementById("mail").value ) +
      				"&text=" + encodeURI( document.getElementById("text").value ) +
      				"&login=" + encodeURI( document.getElementById("login").value ) +
      				"&pass=" + encodeURI( document.getElementById("pass").value ) +
      				"&pass1=" + encodeURI( document.getElementById("pass1").value ) +
      				"&shop_id=" + encodeURI( document.getElementById("shop_id").value ) +
      				"&send=1";
    makePOSTRequest1('inc/panel_podstawowe_informacje.php', poststr);
   
   }
   
      function get_dane_kontaktowe(obj) {
          var poststr = "name=" + encodeURI( document.getElementById("name").value ) +
      		"&addres=" + encodeURI( document.getElementById("addres").value ) +		
         		"&zip=" + encodeURI( document.getElementById("zip").value ) +
      				"&city=" + encodeURI( document.getElementById("city").value ) +
      				"&shop_id=" + encodeURI( document.getElementById("shop_id").value ) +
      				"&send=1";
    makePOSTRequest1('inc/panel_dane_kontaktowe.php', poststr);
   
   }
   
         function get_dane_do_faktury(obj) {
          var poststr = "name=" + encodeURI( document.getElementById("name").value ) +
      		"&addres=" + encodeURI( document.getElementById("addres").value ) +		
         		"&zip=" + encodeURI( document.getElementById("zip").value ) +
      				"&city=" + encodeURI( document.getElementById("city").value ) +
      				"&nip=" + encodeURI( document.getElementById("nip").value ) +
      				"&shop_id=" + encodeURI( document.getElementById("shop_id").value ) +
      				"&copy=" + encodeURI( document.getElementById("copy").value ) +
      				"&send=1";
    makePOSTRequest1('inc/panel_dane_do_faktury.php', poststr);
   
   }
 
			
   
         function get_payment_delivery(obj) {
          var poststr = "p_transfer=" + encodeURI( document.getElementById("p_transfer").value ) +
      	"&p_credit_card=" + encodeURI( document.getElementById("p_credit_card").value ) +		
        "&p_cash=" + encodeURI( document.getElementById("p_cash").value ) +
		"&p_instalment=" + encodeURI( document.getElementById("p_instalment").value ) +
		"&d_post=" + encodeURI( document.getElementById("d_post").value ) +
		"&d_post_express=" + encodeURI( document.getElementById("d_post_express").value ) +
		"&d_acceptance=" + encodeURI( document.getElementById("d_acceptance").value ) +		
		"&d_courier=" + encodeURI( document.getElementById("d_courier").value ) +
		"&o_accessibility=" + encodeURI( document.getElementById("o_accessibility").value ) +
		"&o_foreginers=" + encodeURI( document.getElementById("o_foreginers").value ) +
		"&o_order_status=" + encodeURI( document.getElementById("o_order_status").value ) +
		"&send=1";
    makePOSTRequest1('inc/panel_platnosc_i_wysylka.php', poststr);
   
   }
   
    function get_opinie(obj) {
          var poststr = "podpis=" + encodeURI( document.getElementById("podpis").value ) +
      				"&mail=" + encodeURI( document.getElementById("mail").value ) +
      				"&tekst=" + encodeURI( document.getElementById("tekst").value ) +
                    "&send=1";
    makePOSTRequest('../inc/opinie.php', poststr);
   
   }
   
    function get_opinie_sklepy(obj) {
          var poststr = "user_name=" + encodeURI( document.getElementById("user_name").value ) +
      				"&user_mail=" + encodeURI( document.getElementById("user_mail").value ) +
      				"&opinion=" + encodeURI( document.getElementById("opinion").value ) +
      				"&order_num=" + encodeURI( document.getElementById("order_num").value ) +
      				"&rank=" + encodeURI( document.getElementById("rank").value ) +
      				"&shop_id=" + encodeURI( document.getElementById("shop_id").value ) +
                    "&send=1";
    makePOSTRequest('../inc/sklepy_opinie.php', poststr);
   
   }
 
       function get_opinie_produkty(obj) {
          var poststr = "user_name=" + encodeURI( document.getElementById("user_name").value ) +
      				"&user_mail=" + encodeURI( document.getElementById("user_mail").value ) +
      				"&opinion=" + encodeURI( document.getElementById("opinion").value ) +
      				"&rank=" + encodeURI( document.getElementById("rank").value ) +
      				"&name=" + encodeURI( document.getElementById("name").value ) +
                    "&send=1";
    makePOSTRequest('../inc/products_opinions.php', poststr);
   
   }
   
      function get_zapytanie_gl(obj) {
          var poststr = "name=" + encodeURI( document.getElementById("name").value ) +
      				"&mail=" + encodeURI( document.getElementById("mail").value ) +
                    "&text=" + encodeURI( document.getElementById("text").value ) +
                    "&temat=" + encodeURI( document.getElementById("temat").value ) + 
                    "&send=1";
    makePOSTRequest('../inc/zapytanie.php', poststr);
   }
   
         function get_zglos_blad(obj) {
          var poststr = "name=" + encodeURI( document.getElementById("name").value ) +
      				"&mail=" + encodeURI( document.getElementById("mail").value ) +
                    "&text=" + encodeURI( document.getElementById("text").value ) +
                    "&shop_id=" + encodeURI( document.getElementById("shop_id").value ) + 
                    "&where=" + encodeURI( document.getElementById("where").value ) + 
                    "&product_id=" + encodeURI( document.getElementById("product_id").value ) + 
                    "&send=1";
    makePOSTRequest('../inc/zglos_blad.php', poststr);
   }
   
   
   
   
   function loading(idd,comment)
   {
   document.getElementById(idd).innerHTML = '<br /><br /><div style="text-align: center; margin-top: 50px; margin-bottom: 50px;"><img src="../../img/loading.gif" alt="Loading" 	style="margin-left: auto; margin-right: auto;" /> <br /><br />'+comment+'</div><br /><br />';
   }
   
function hide(id)
{
document.getElementById(id).innerHTML = "";
}

function scrollto(top)
{
	if (navigator.appName == "Microsoft Internet Explorer")
	setTimeout('window.scrollTo(0,'+top+')',1);
	else
	window.scrollTo(0,top);
					
}


function sonda(under,ilosc,numer,top)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
} 
var url=under+"inc/sonda.php"
url=url+"?ilosc="+ilosc
url=url+"&numer="+numer
url=url+"&top="+top
if (under=="../")
url=url+"&un=1"
xmlHttp.onreadystatechange=stateChangedSonda
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChangedSonda() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
document.getElementById("SondaHint").innerHTML=xmlHttp.responseText 
} 
} 

function sonda1(under,ilosc,numer,top)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
} 
var url=under+"inc/sonda1.php"
url=url+"?ilosc="+ilosc
url=url+"&numer="+numer
url=url+"&top="+top
if (under=="../")
url=url+"&un=1"
xmlHttp.onreadystatechange=stateChangedSonda1
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChangedSonda1() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
document.getElementById("Sonda1Hint").innerHTML=xmlHttp.responseText 
} 
} 


function Chmurka(T,t){
 T.title=''
 T.parentNode.lastChild.style.display=t?'block':'none'
}



		
function set_top()
{
if (navigator.appName == "Microsoft Internet Explorer")
			var top = document.body.scrollTop;
			else
			var top = window.pageYOffset;	
return top;
}	
			
function note(p_add_mod,p_del_mod,top,under,_p)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
} 
var url=under+"inc/notepad.php"
url=url+"?p_add_mod="+p_add_mod
url=url+"&p_del_mod="+p_del_mod
url=url+"&top="+top
url=url+"&_p="+_p
xmlHttp.onreadystatechange=stateChangedNote
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChangedNote() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
document.getElementById("note").innerHTML=xmlHttp.responseText 
} 
} 
function closeNote()
{ 
	if(navigator.appName == "Opera"){
	document.getElementById("note").innerHTML="&nbsp;"
	}	
	else
	document.getElementById("note").innerHTML=""
}


//-------------- date picker

//Written by Bogdan Blaszczak/BlaTek
//blatek@25.pl
function Calendar(E,T){
 if(!document.getElementById||!document.body.appendChild)return
 var i,j,tBody,Row,od,Do,d,dt
 function cEl(t,p,h,w){
  p.appendChild(t=document.createElement(t))
  if(h)t.innerHTML=h;if(w)t.style.width='27px'
  return t}
 function cB(x){with(cld_BlaTek){
  B=0;x==0?R--:x==1?R++:x==2?(!M?(M=11,R--):M--):(M==11?(M=0,R++):M++)}
 }
 with(cld_BlaTek){
  od=Date.UTC(R,M,1);Do=Date.UTC(R,M+1,1)}
 E=document.getElementById(E)
 while(E.childNodes.length)E.removeChild(E.firstChild)
 tBody=cEl('tbody',cEl('table',E))
 tBody.onmouseup=function(){T.focus()}
 tBody.onmousemove=function(){
  if(window.getSelection)window.getSelection().removeAllRanges()}
 Row=cEl('tr',tBody)
 cEl('td',Row,'«',1).onmousedown=function(){cB(0)}
 cEl('th',Row,cld_BlaTek.R)
 cEl('td',Row,'»',1).onmousedown=function(){cB(1)}
 Row=cEl('tr',tBody)
 cEl('td',Row,'«',1).onmousedown=function(){cB(2)}
 cEl('th',Row,cld_BlaTek.month[cld_BlaTek.M])
 cEl('td',Row,'»',1).onmousedown=function(){cB(3)}

 tBody=cEl('tbody',cEl('table',E))
 Row=cEl('tr',tBody)
 for(i=0;i<7;i++)
  with(cEl('th',Row,cld_BlaTek.day[i]))
   if(i==6)style.backgroundColor='#cc0000'

 for(i=od;i<Do;i+=86400000){
  with(new Date(i)){d=getUTCDate();dt=getUTCDay()}
  if(dt==1||i==od)Row=cEl('tr',tBody)
  if(dt!=1&&d==1)for(j=1;j<(dt?dt:7);j++)cEl('th',Row)
  dt=cEl('td',Row,d);dt.onmousedown=function(x){
   x=+this.innerHTML
   with(cld_BlaTek)
    T.value=(x<10?'0'+x:x)+'-'+((x=M+1)<10?'0'+x:x)+'-'+R
  }
  with(cld_BlaTek)
  if(d==D.getDate()&&M==D.getMonth()&&R==D.getFullYear())
   dt.style.backgroundColor='#fff'
 }
 T.onblur=function(){if(cld_BlaTek.B)E.style.display='none'}
 cld_BlaTek.B=1;E.style.display='block'
}


//global object (You can translate month&day names)
cld_BlaTek={
 day:['pn','wt','śr','cz','pt','so','n'],
 month:['styczeń','luty','marzec','kwiecień','maj','czerwiec',
 'lipiec','sierpień','wrzesień','październik','listopad','grudzień'],
 D:new Date(),M:new Date().getMonth(),R:new Date().getFullYear()
}



