
var offsetfromcursorX=12
var offsetfromcursorY=10

var offsetdivfrompointerX=10
var offsetdivfrompointerY=14 

document.write('<div id="dhtmltooltip"></div>') 
document.write('<img id="dhtmlpointer" src="img/arrow2.gif">') 

var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thewidth, thecolor){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var nondefaultpos=false
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;

var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20

var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX
var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY

var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000

if (rightedge<tipobj.offsetWidth){
tipobj.style.left=curX-tipobj.offsetWidth+"px"
nondefaultpos=true
}
else if (curX<leftedge)
tipobj.style.left="5px"
else{
tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
pointerobj.style.left=curX+offsetfromcursorX+"px"
}

if (bottomedge<tipobj.offsetHeight){
tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
nondefaultpos=true
}
else{
tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
pointerobj.style.top=curY+offsetfromcursorY+"px"
}
tipobj.style.visibility="visible"
if (!nondefaultpos)
pointerobj.style.visibility="visible"
else
pointerobj.style.visibility="hidden"
}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
pointerobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}

document.onmousemove=positiontip

function disableDlaDoswiadczenie(){
 if(document.getElementById('doswiadczenie').options[document.getElementById('doswiadczenie').selectedIndex].value ==1 || document.getElementById('doswiadczenie').options[document.getElementById('doswiadczenie').selectedIndex].value ==0){
	 document.getElementById('notkaDoswiadczenie').style.disabled=true;
	 document.getElementById('notkaDoswiadczenie').style.display='none';
         
         document.getElementById('wybrane_doswiadczenie').style.disabled=true;
	 document.getElementById('wybrane_doswiadczenie').style.display='none';
         
         document.getElementById('nie_wybrane_doswiadczenie').style.disabled=false;
	 document.getElementById('nie_wybrane_doswiadczenie').style.display='block';
         
 }else{
	 document.getElementById('notkaDoswiadczenie').style.disabled=false;
	 document.getElementById('notkaDoswiadczenie').style.display='block';
         
         document.getElementById('wybrane_doswiadczenie').style.disabled=false;
	 document.getElementById('wybrane_doswiadczenie').style.display='block';
         
         document.getElementById('nie_wybrane_doswiadczenie').style.disabled=true;
	 document.getElementById('nie_wybrane_doswiadczenie').style.display='none';
 }
}

function disableDlaZagranica(){
 if(document.getElementById('kraj').options[document.getElementById('kraj').selectedIndex].value ==17){
	 document.getElementById('notkaZagranica').style.disabled=false;
	 document.getElementById('notkaZagranica').style.display='block';
 }else{
	 document.getElementById('notkaZagranica').style.disabled=true;
	 document.getElementById('notkaZagranica').style.display='none';
 }
}

function displayKoszt(){
   
      var regionList = document.getElementById('kraj');
      var region = regionList[regionList.selectedIndex].value;

 
      var branzaList = document.getElementById('branza');
      var branza = branzaList[branzaList.selectedIndex].value;
      var opis_dodatkowy = document.getElementById('opis_dot2');
    

	if(opis_dodatkowy.checked==true){
      url = 'ajax_include/koszt_reklama.php?id_region=' + region + '&id_branza=' + branza;
      HTML_AJAX.replace('target', url); 
	  url2 = 'ajax_include/koszt_reklama.php?id_region=' + region + '&id_branza=' + branza + '&total=tak';
	  HTML_AJAX.replace('dest', url2); 
	  }else{
		 url2 = 'ajax_include/koszt_reklama.php?id_region=' + region + '&id_branza=' + branza + '&total2=tak2';
	     HTML_AJAX.replace('dest', url2); 
		 url = 'ajax_include/koszt_reklama.php';
         HTML_AJAX.replace('target', url);  
	  }
	 
    }

	function displayKosztEdycja(){
   
      var regionList = document.getElementById('kraj');
      var region = regionList[regionList.selectedIndex].value;

 
      var branzaList = document.getElementById('branza');
      var branza = branzaList[branzaList.selectedIndex].value;
      var opis_dodatkowy = document.getElementById('opis_dot2');
	  var id_oferta = document.getElementById('oferta_id').value;
    

	if(opis_dodatkowy.checked==true){
      url = 'ajax_include/koszt_reklama_edycja.php?id_region=' + region + '&id_branza=' + branza + '&id_oferta=' + id_oferta;
      HTML_AJAX.replace('target', url); 
	  url2 = 'ajax_include/koszt_reklama_edycja.php?id_region=' + region + '&id_branza=' + branza + '&total=tak&id_oferta=' + id_oferta;
	  HTML_AJAX.replace('dest', url2); 
	  }else{
		 url2 = 'ajax_include/koszt_reklama_edycja.php?id_region=' + region + '&id_branza=' + branza + '&total2=tak2&id_oferta=' + id_oferta;
	     HTML_AJAX.replace('dest', url2); 
		 url = 'ajax_include/koszt_reklama_edycja.php?id_oferta=' + id_oferta;
         HTML_AJAX.replace('target', url);  
	  }
	 
    }

	function displayKosztOferta(){
   
      var regionList = document.getElementById('kraj');
      var region = regionList[regionList.selectedIndex].value;

 
      var branzaList = document.getElementById('branza');
      var branza = branzaList[branzaList.selectedIndex].value;
    
      var koszt_logo = document.getElementById('id_czy_logo1');
      var koszt_video = document.getElementById('id_czy_video1');
      
      var opis_dodatkowy = document.getElementById('opis_dot2');
	  var design_mypraca = document.getElementById('id_design_mypraca');
      var design_klienta = document.getElementById('id_design_klienta');

	  var typList = document.getElementById('id_typ');
      var typ = branzaList[typList.selectedIndex].value;

	  url_total = 'ajax_include/koszt_oferta.php?id_region=' + region + '&id_branza=' + branza;
      

          //dla video
	  if(koszt_video != null){
	  if(koszt_video.checked==true){
      url = 'ajax_include/koszt_oferta.php?id_region=' + region + '&id_branza=' + branza + '&k6=video';
      HTML_AJAX.replace('targetVideo', url);

      url_total += '&k6=video';

	  }else{
         url = 'ajax_include/koszt_oferta.php?id_region=' + region + '&id_branza=' + branza + '&resVideo=tak';
         HTML_AJAX.replace('targetVideo', url);
	  }
      }
      
	  //dla logo'
	  if(koszt_logo != null){
	  if(koszt_logo.checked==true){
      url = 'ajax_include/koszt_oferta.php?id_region=' + region + '&id_branza=' + branza + '&k=logo';
      HTML_AJAX.replace('targetLogo', url);

      url_total += '&k=logo';

	  }else{
         url = 'ajax_include/koszt_oferta.php?id_region=' + region + '&id_branza=' + branza + '&resLogo=tak';
         HTML_AJAX.replace('targetLogo', url);
	  }
      }
	  //dla opis dodatkowy
	  if(opis_dodatkowy.checked==true){
      url = 'ajax_include/koszt_oferta.php?id_region=' + region + '&id_branza=' + branza + '&k2=opis_dodatkowy';
      HTML_AJAX.replace('targetOpisDodatkowy', url); 
	  
	  url_total += '&k2=opis_dodatkowy';
	  }else{
		 url = 'ajax_include/koszt_oferta.php?id_region=' + region + '&id_branza=' + branza + '&resOpisDot=tak';
         HTML_AJAX.replace('targetOpisDodatkowy', url);  
	  }
      
	  
	  //dla design mypraca
     if(design_mypraca.checked==true){
          url = 'ajax_include/koszt_oferta.php?id_region=' + region + '&id_branza=' + branza + '&k3=design_mypraca';
          HTML_AJAX.replace('targetDesign', url); 
	  
	      url_total += '&k3=design_mypraca';
	  }
      
	   //dla design klienta
     if(design_klienta.checked==true){
          url = 'ajax_include/koszt_oferta.php?id_region=' + region + '&id_branza=' + branza + '&k4=design_klienta';
          HTML_AJAX.replace('targetDesign', url); 
	  
	      url_total += '&k4=design_klienta';
	  }
	  
	  
	  if(design_klienta.checked==false && design_mypraca.checked==false){
         url = 'ajax_include/koszt_oferta.php?id_region=' + region + '&id_branza=' + branza + '&resDesign=tak';
         HTML_AJAX.replace('targetDesign', url);
	  }

      //wybór typu oferty

	  if(typ != ''){
          url = 'ajax_include/koszt_oferta.php?id_region=' + region + '&id_branza=' + branza + '&id_typ_oferta=' + typ + '&k5=typ_oferty';
          HTML_AJAX.replace('targetTypOferty', url); 
	  
	      url_total += '&k5=typ_oferty&id_typ_oferta=' + typ;
	  }else{
         url = 'ajax_include/koszt_oferta.php?id_region=' + region + '&id_branza=' + branza + '&resTypOferty=tak';
         HTML_AJAX.replace('targetTypOferty', url);
	  }

	  //dla total
	    url_total += '&kt=total';
	   HTML_AJAX.replace('dest', url_total);
	 
}


function displayKosztOfertaEdycja(){
   
      var regionList = document.getElementById('kraj');
      var region = regionList[regionList.selectedIndex].value;

 
      var branzaList = document.getElementById('branza');
      var branza = branzaList[branzaList.selectedIndex].value;
    
      var koszt_logo = document.getElementById('id_czy_logo1');
      var koszt_video = document.getElementById('id_czy_video1');
      var opis_dodatkowy = document.getElementById('opis_dot2');
	  var design_mypraca = document.getElementById('id_design_mypraca');
      var design_klienta = document.getElementById('id_design_klienta');

	  var typList = document.getElementById('id_typ');
      var typ = branzaList[typList.selectedIndex].value;
      var id_oferta = document.getElementById('oferta_id').value;

	  url_total = 'ajax_include/koszt_oferta_edycja.php?id_region=' + region + '&id_branza=' + branza + '&id_oferta=' + id_oferta;
      

	  //dla logo'
	  if(koszt_logo != null){
	  if(koszt_logo.checked==true){
      url = 'ajax_include/koszt_oferta_edycja.php?id_region=' + region + '&id_branza=' + branza + '&id_oferta=' + id_oferta + '&k=logo';
      HTML_AJAX.replace('targetLogo', url);

      url_total += '&k=logo';

	  }else{
         url = 'ajax_include/koszt_oferta_edycja.php?id_region=' + region + '&id_branza=' + branza + '&id_oferta=' + id_oferta + '&resLogo=tak';
         HTML_AJAX.replace('targetLogo', url);
	  }
      }
      
      //dla video'
	  if(koszt_video != null){
	  if(koszt_video.checked==true){
      url = 'ajax_include/koszt_oferta_edycja.php?id_region=' + region + '&id_branza=' + branza + '&id_oferta=' + id_oferta + '&k6=video';
      HTML_AJAX.replace('targetVideo', url);

      url_total += '&k6=video';

	  }else{
         url = 'ajax_include/koszt_oferta_edycja.php?id_region=' + region + '&id_branza=' + branza + '&id_oferta=' + id_oferta + '&resVideo=tak';
         HTML_AJAX.replace('targetVideo', url);
	  }
      }
      
	  //dla opis dodatkowy
	  if(opis_dodatkowy.checked==true){
      url = 'ajax_include/koszt_oferta_edycja.php?id_region=' + region + '&id_branza=' + branza + '&id_oferta=' + id_oferta + '&k2=opis_dodatkowy';
      HTML_AJAX.replace('targetOpisDodatkowy', url); 
	  
	  url_total += '&k2=opis_dodatkowy';
	  }else{
		 url = 'ajax_include/koszt_oferta_edycja.php?id_region=' + region + '&id_branza=' + branza + '&id_oferta=' + id_oferta + '&resOpisDot=tak';
         HTML_AJAX.replace('targetOpisDodatkowy', url);  
	  }
      
	  
	  //dla design mypraca
     if(design_mypraca.checked==true){
          url = 'ajax_include/koszt_oferta_edycja.php?id_region=' + region + '&id_branza=' + branza + '&id_oferta=' + id_oferta + '&k3=design_mypraca';
          HTML_AJAX.replace('targetDesign', url); 
	  
	      url_total += '&k3=design_mypraca';
	  }
      
	   //dla design klienta
     if(design_klienta.checked==true){
          url = 'ajax_include/koszt_oferta_edycja.php?id_region=' + region + '&id_branza=' + branza + '&id_oferta=' + id_oferta + '&k4=design_klienta';
          HTML_AJAX.replace('targetDesign', url); 
	  
	      url_total += '&k4=design_klienta';
	  }
	  
	  
	  if(design_klienta.checked==false && design_mypraca.checked==false){
         url = 'ajax_include/koszt_oferta_edycja.php?id_region=' + region + '&id_branza=' + branza + '&id_oferta=' + id_oferta + '&resDesign=tak';
         HTML_AJAX.replace('targetDesign', url);
	  }

      //wybór typu oferty

	  if(typ != ''){
          url = 'ajax_include/koszt_oferta_edycja.php?id_region=' + region + '&id_branza=' + branza + '&id_oferta=' + id_oferta + '&id_typ_oferta=' + typ + '&k5=typ_oferty';
          HTML_AJAX.replace('targetTypOferty', url); 
	  
	      url_total += '&k5=typ_oferty&id_typ_oferta=' + typ;
	  }else{
         url = 'ajax_include/koszt_oferta_edycja.php?id_region=' + region + '&id_branza=' + branza + '&id_oferta=' + id_oferta + '&resTypOferty=tak';
         HTML_AJAX.replace('targetTypOferty', url);
	  }

	  //dla total
	    url_total += '&kt=total';
	   HTML_AJAX.replace('dest', url_total);
	 
}
function displayKosztCv(){
      var regionList = document.getElementById('kraj');
      var region = regionList[regionList.selectedIndex].value;

 
      var branzaList = document.getElementById('branza');
      var branza = branzaList[branzaList.selectedIndex].value;
	  
	  var typList = document.getElementById('id_typ');
      var typ = branzaList[typList.selectedIndex].value;

	  url = 'ajax_include/koszt_cv_new_ref.php?id_region=' + region + '&id_branza=' + branza + '&id_typ_oferta=' + typ;
      HTML_AJAX.replace('targetKosztCV', url);
}
/*
function GetContDesMypraca(){
     
      var kontener = arr['edytor'].get_content();

	  url = 'ajax_include/designmypraca_memory.php?contdesmypraca=' + kontener;
      HTML_AJAX.replace('targetHiddenDesignMypraca', url);
}
*/
function ismaxlength(obj){
	var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
	if (obj.getAttribute && obj.value.length>mlength)
	obj.value=obj.value.substring(0,mlength)
	}
function RunMyLoader(){
      var myloading = document.getElementById('loader');
      myloading.style.display = 'block';
}
