jQuery.fn.extend({
  esky_cities: function() {
  $(this).each(function(){
    //alert('sada');
    $this = $(this);
    var c1 = $this.offset();
    //var url = 'qsf_2.0/listaMiast/list1.php?Continent=EU&Country=PL';   
    var title = $this.attr('title');
		var rel_city = $this.attr('rel');
    var scrolling = ($.browser.msie) ? 'yes' : 'auto';
    var scrolling = 'no';
    var txt_close = 'Zamknij';

    $this.click(function(){
      esky_cities_remove();
      var c2 = $this.prev().offset();
			if (c2 == null) {
	  	  c2=c1;
	    }
     if (rel_city=='fromcity'){ 
      //return false;
			if (c1.top == 0) {
				p = $('#fromcity').offset(); //pozycjonowanie pod chrome
        c1=p;
      }
      $('body')
      .append(
        $('<div></div>')
          .attr('id','esky_cities')
          .css({
            'position':'absolute',
            'width':'200px',
            'background-color':'#F8F8F8',
            'top':(c1.top>1)?c1.top:c2.top+100,
            'left':(c1.left>1)?c1.left-0:c2.left+50
          })//css
          .append(
            $('<h3></h3>')
              .text(title)
              .append($('<a></a>')
                .attr('href','javascript:void(0);')               
                .text(txt_close)
                .click(esky_cities_remove)
              )
          )
					
		      .append(
		        $('<div></div>')
		          .attr('class','cityList')
							.attr('id','cityList')
		          .css({
							'font':'normal 11px Arial,sans-serif'
							})//css
							.append(
	            $('<div></div>')
	              .css({
	              'margin-bottom':'3px',
								'overflow':'hidden',
								'height':'95px',
								'width':'100%',
								'float':'left'
	              })//css
	              .append(
		            $('<table></table>')
		              .attr('cellspacing','0')
		              .attr('cellpadding','0')
		              .css({
		              'color':'#fff',
									'background':'#0096C8',
									'text-decoration':'underline',
									'width':'100%',
									'height':'100%',
									'padding-bottom':'2px'
		              })//css
		              .append(
                    $('<tr></tr>')
									    .append(
                      $('<td></td>')
										  .css({
			                'padding':'0 5px 0 5px'
			                })//css
			                .append(
                        $('<a></a>')
												.attr('class','und')
						            .attr('href','javascript:void(0);')
												.click(cities_aff)
												.text('Afryka')
						            .css({
												'text-decoration':'underline',
												'color':'#fff',
						            'padding':'4px 0px 0px 0px;'
						            })//css
					            )
					          )
					        )//1
									.append(
                    $('<tr></tr>')
                      .append(
                      $('<td></td>')
                      .css({
                      'padding':'0 5px 0 5px'
                      })//css
                      .append(
                        $('<a></a>')
                        .attr('class','und')
                        .attr('href','javascript:void(0);')
												
                        .click(cities_saf)
                        .text('Ameryka Poludniowa')
                        .css({
                        'text-decoration':'underline',
                        'color':'#fff',
                        'padding':'4px 0px 0px 0px;'
                        })//css
                      )
                    )
                  )//2
									.append(
                    $('<tr></tr>')
                      .append(
                      $('<td></td>')
                      .css({
                      'padding':'0 5px 0 5px'
                      })//css
                      .append(
                        $('<a></a>')
                        .attr('class','und')
                        .attr('href','javascript:void(0);')
                        .click(cities_naf)
                        .text('Ameryka Pólnocna')
                        .css({
                        'text-decoration':'underline',
                        'color':'#fff',
                        'padding':'4px 0px 0px 0px;'
                        })//css
                      )
                    )
                  )//3
									.append(
                    $('<tr></tr>')
                      .append(
                      $('<td></td>')
                      .css({
                      'padding':'0 5px 0 5px'
                      })//css
                      .append(
                        $('<a></a>')
                        .attr('class','und')
                        .attr('href','javascript:void(0);')
                        .click(cities_ocf)
                        .text('Australia i Oceania')
                        .css({
                        'text-decoration':'underline',
                        'color':'#fff',
                        'padding':'4px 0px 0px 0px;'
                        })//css
                      )
                    )
                  )//4
									.append(
                    $('<tr></tr>')
                      .append(
                      $('<td></td>')
                      .css({
                      'padding':'0 5px 0 5px'
                      })//css
                      .append(
                        $('<a></a>')
                        .attr('class','und')
                        .attr('href','javascript:void(0);')
                        .click(cities_asf)
                        .text('Azja')
                        .css({
                        'text-decoration':'underline',
                        'color':'#fff',
                        'padding':'4px 0px 0px 0px;'
                        })//css
                      )
                    )
                  )//5
									.append(
                    $('<tr></tr>')
                      .append(
                      $('<td></td>')
                      .css({
                      'padding':'0 5px 0 5px'
                      })//css
                      .append(
                        $('<a></a>')
                        .attr('class','und')
                        .attr('href','javascript:void(0);')
                        .click(cities_euf)
                        .text('Europa')
                        .css({
                        'text-decoration':'underline',
                        'color':'#fff',
                        'padding':'4px 0px 0px 0px;'
                        })//css
                      )
                    )
                  )//6
					      ) 
					    )
  					)
          .append(
            $('<iframe >')
              .attr('id','esky_cities_frame')
              .attr('src','qsf_2.0/listaMiast/city_fromcity.php?Continent=EU&Country=PL')
              .attr('width',200)
              .attr('height',230)
              .attr('frameborder',0)
              .attr('marginwidth',0)
              .attr('marginheight',0)
              //.attr('allowTransparency','true')
              .css({
                'border':'none',
                'width':'200px',
                //'background':'transparent',
                'background-color':'#F8F8F8',
                'overflow-x':'hidden',
								'overflow-y':'auto',
                'font-weight':'bold'
              })
          )
          .bgIframe()
      );//append
      return false;
			}//fromcity
			
			if (rel_city=='tocity'){ 
			if (c1.top == 0) {
        p = $('#tocity').offset(); //pozycjonowanie pod chrome
        c1=p;
      }      
      $('body')
      .append(
        $('<div></div>')
          .attr('id','esky_cities')
          .css({
            'position':'absolute',
            'width':'200px',
            'background-color':'#F8F8F8',
            'top':(c1.top>0)?c1.top:c2.top+100,
            'left':(c1.left>0)?c1.left-0:c2.left+50
          })//css
          .append(
            $('<h3></h3>')
              .text(title)
              .append($('<a></a>')
                .attr('href','javascript:void(0);')               
                .text(txt_close)
                .click(esky_cities_remove)
              )
          )
          
          .append(
            $('<div></div>')
              .attr('class','cityList')
              .attr('id','cityList')
              .css({
              'font':'normal 11px Arial,sans-serif'
              })//css
              .append(
              $('<div></div>')
                .css({
                'margin-bottom':'3px',
                'overflow':'hidden',
                'height':'95px',
                'width':'100%',
                'float':'left'
                })//css
                .append(
                $('<table></table>')
                  .attr('cellspacing','0')
                  .attr('cellpadding','0')
                  .css({
                  'color':'#fff',
                  'background':'#0096C8',
                  'text-decoration':'underline',
                  'width':'100%',
                  'height':'100%',
                  'padding-bottom':'2px'
                  })//css
                  .append(
                    $('<tr></tr>')
                      .append(
                      $('<td></td>')
                      .css({
                      'padding':'0 5px 0 5px'
                      })//css
                      .append(
                        $('<a></a>')
                        .attr('class','und')
                        .attr('href','javascript:void(0);')
                        .click(cities_aft)
                        .text('Afryka')
                        .css({
                        'text-decoration':'underline',
                        'color':'#fff',
                        'padding':'4px 0px 0px 0px;'
                        })//css
                      )
                    )
                  )//1
                  .append(
                    $('<tr></tr>')
                      .append(
                      $('<td></td>')
                      .css({
                      'padding':'0 5px 0 5px'
                      })//css
                      .append(
                        $('<a></a>')
                        .attr('class','und')
                        .attr('href','javascript:void(0);')
                        
                        .click(cities_sat)
                        .text('Ameryka Poludniowa')
                        .css({
                        'text-decoration':'underline',
                        'color':'#fff',
                        'padding':'4px 0px 0px 0px;'
                        })//css
                      )
                    )
                  )//2
                  .append(
                    $('<tr></tr>')
                      .append(
                      $('<td></td>')
                      .css({
                      'padding':'0 5px 0 5px'
                      })//css
                      .append(
                        $('<a></a>')
                        .attr('class','und')
                        .attr('href','javascript:void(0);')
                        .click(cities_nat)
                        .text('Ameryka Pólnocna')
                        .css({
                        'text-decoration':'underline',
                        'color':'#fff',
                        'padding':'4px 0px 0px 0px;'
                        })//css
                      )
                    )
                  )//3
                  .append(
                    $('<tr></tr>')
                      .append(
                      $('<td></td>')
                      .css({
                      'padding':'0 5px 0 5px'
                      })//css
                      .append(
                        $('<a></a>')
                        .attr('class','und')
                        .attr('href','javascript:void(0);')
                        .click(cities_oct)
                        .text('Australia i Oceania')
                        .css({
                        'text-decoration':'underline',
                        'color':'#fff',
                        'padding':'4px 0px 0px 0px;'
                        })//css
                      )
                    )
                  )//4
                  .append(
                    $('<tr></tr>')
                      .append(
                      $('<td></td>')
                      .css({
                      'padding':'0 5px 0 5px'
                      })//css
                      .append(
                        $('<a></a>')
                        .attr('class','und')
                        .attr('href','javascript:void(0);')
                        .click(cities_ast)
                        .text('Azja')
                        .css({
                        'text-decoration':'underline',
                        'color':'#fff',
                        'padding':'4px 0px 0px 0px;'
                        })//css
                      )
                    )
                  )//5
                  .append(
                    $('<tr></tr>')
                      .append(
                      $('<td></td>')
                      .css({
                      'padding':'0 5px 0 5px'
                      })//css
                      .append(
                        $('<a></a>')
                        .attr('class','und')
                        .attr('href','javascript:void(0);')
                        .click(cities_eut)
                        .text('Europa')
                        .css({
                        'text-decoration':'underline',
                        'color':'#fff',
                        'padding':'4px 0px 0px 0px;'
                        })//css
                      )
                    )
                  )//6
                ) 
              )
            )
          .append(
            $('<iframe >')
              .attr('id','esky_cities_frame')
              .attr('src','qsf_2.0/listaMiast/city_tocity.php?Continent=EU&Country=PL')
              .attr('width',200)
              .attr('height',230)
              .attr('frameborder',0)
              .attr('marginwidth',0)
              .attr('marginheight',0)
              //.attr('allowTransparency','true')
              .css({
                'border':'none',
                'width':'200px',
                //'background':'transparent',
                'background-color':'#F8F8F8',
                'overflow-x':'hidden',
                'overflow-y':'auto',
                'font-weight':'bold'
              })
          )
          .bgIframe()
      );//append
      return false;
      }//tocity
			
			if (rel_city=='hotel_city'){
			if (c1.top == 0) {
        p = $('#hotel_city').offset(); //pozycjonowanie pod chrome
        c1=p;
      }    
      $('body')
      .append(
        $('<div></div>')
          .attr('id','esky_cities')
          .css({
            'position':'absolute',
            'width':'200px',
            'background-color':'#F8F8F8',
            'top':(c1.top>0)?c1.top:c2.top+100,
            'left':(c1.left>0)?c1.left-0:c2.left+50
          })//css
          .append(
            $('<h3></h3>')
              .text(title)
              .append($('<a></a>')
                .attr('href','javascript:void(0);')               
                .text(txt_close)
                .click(esky_cities_remove)
              )
          )
          .append(
            $('<div></div>')
              .attr('class','cityList')
              .attr('id','cityList')
              .css({
              'font':'normal 11px Arial,sans-serif'
              })//css
              .append(
              $('<div></div>')
                .css({
                'margin-bottom':'3px',
                'overflow':'hidden',
                'height':'95px',
                'width':'100%',
                'float':'left'
                })//css
                .append(
                $('<table></table>')
                  .attr('cellspacing','0')
                  .attr('cellpadding','0')
                  .css({
                  'color':'#fff',
                  'background':'#0096C8',
                  'text-decoration':'underline',
                  'width':'100%',
                  'height':'100%',
                  'padding-bottom':'2px'
                  })//css
                  .append(
                    $('<tr></tr>')
                      .append(
                      $('<td></td>')
                      .css({
                      'padding':'0 5px 0 5px'
                      })//css
                      .append(
                        $('<a></a>')
                        .attr('class','und')
                        .attr('href','javascript:void(0);')
                        .click(cities_afh)
                        .text('Afryka')
                        .css({
                        'text-decoration':'underline',
                        'color':'#fff',
                        'padding':'4px 0px 0px 0px;'
                        })//css
                      )
                    )
                  )//1
                  .append(
                    $('<tr></tr>')
                      .append(
                      $('<td></td>')
                      .css({
                      'padding':'0 5px 0 5px'
                      })//css
                      .append(
                        $('<a></a>')
                        .attr('class','und')
                        .attr('href','javascript:void(0);')
                        
                        .click(cities_sah)
                        .text('Ameryka Poludniowa')
                        .css({
                        'text-decoration':'underline',
                        'color':'#fff',
                        'padding':'4px 0px 0px 0px;'
                        })//css
                      )
                    )
                  )//2
                  .append(
                    $('<tr></tr>')
                      .append(
                      $('<td></td>')
                      .css({
                      'padding':'0 5px 0 5px'
                      })//css
                      .append(
                        $('<a></a>')
                        .attr('class','und')
                        .attr('href','javascript:void(0);')
                        .click(cities_nah)
                        .text('Ameryka Pólnocna')
                        .css({
                        'text-decoration':'underline',
                        'color':'#fff',
                        'padding':'4px 0px 0px 0px;'
                        })//css
                      )
                    )
                  )//3
                  .append(
                    $('<tr></tr>')
                      .append(
                      $('<td></td>')
                      .css({
                      'padding':'0 5px 0 5px'
                      })//css
                      .append(
                        $('<a></a>')
                        .attr('class','und')
                        .attr('href','javascript:void(0);')
                        .click(cities_och)
                        .text('Australia i Oceania')
                        .css({
                        'text-decoration':'underline',
                        'color':'#fff',
                        'padding':'4px 0px 0px 0px;'
                        })//css
                      )
                    )
                  )//4
                  .append(
                    $('<tr></tr>')
                      .append(
                      $('<td></td>')
                      .css({
                      'padding':'0 5px 0 5px'
                      })//css
                      .append(
                        $('<a></a>')
                        .attr('class','und')
                        .attr('href','javascript:void(0);')
                        .click(cities_ash)
                        .text('Azja')
                        .css({
                        'text-decoration':'underline',
                        'color':'#fff',
                        'padding':'4px 0px 0px 0px;'
                        })//css
                      )
                    )
                  )//5
                  .append(
                    $('<tr></tr>')
                      .append(
                      $('<td></td>')
                      .css({
                      'padding':'0 5px 0 5px'
                      })//css
                      .append(
                        $('<a></a>')
                        .attr('class','und')
                        .attr('href','javascript:void(0);')
                        .click(cities_euh)
                        .text('Europa')
                        .css({
                        'text-decoration':'underline',
                        'color':'#fff',
                        'padding':'4px 0px 0px 0px;'
                        })//css
                      )
                    )
                  )//6
                ) 
              )
            )
          .append(
            $('<iframe >')
              .attr('id','esky_cities_frame')
              .attr('src','qsf_2.0/listaMiast/city_hotel.php?Continent=EU&Country=PL')
              .attr('width',200)
              .attr('height',230)
              .attr('frameborder',0)
              .attr('marginwidth',0)
              .attr('marginheight',0)
              //.attr('allowTransparency','true')
              .css({
                'border':'none',
                'width':'200px',
                //'background':'transparent',
                'background-color':'#F8F8F8',
                'overflow-x':'hidden',
                'overflow-y':'auto',
                'font-weight':'bold'
              })
          )
          .bgIframe()
      );//append
      return false;
      }//hotel_city
			
    }); //onclick
  }); //each
  }
});

function esky_cities_remove() {
  $('#esky_cities').empty().remove();
  $(document).blur();
}
function cities_aff(){
	document.getElementById('esky_cities_frame').setAttribute('src','qsf_2.0/listaMiast/city_fromcity.php?Continent=AF');
}
function cities_saf(){
  document.getElementById('esky_cities_frame').setAttribute('src','qsf_2.0/listaMiast/city_fromcity.php?Continent=SA');
}
function cities_naf(){
  document.getElementById('esky_cities_frame').setAttribute('src','qsf_2.0/listaMiast/city_fromcity.php?Continent=NA');
}
function cities_ocf(){
  document.getElementById('esky_cities_frame').setAttribute('src','qsf_2.0/listaMiast/city_fromcity.php?Continent=OC');
}
function cities_asf(){
  document.getElementById('esky_cities_frame').setAttribute('src','qsf_2.0/listaMiast/city_fromcity.php?Continent=AS');
}
function cities_euf(){
  document.getElementById('esky_cities_frame').setAttribute('src','qsf_2.0/listaMiast/city_fromcity.php?Continent=EU');
}
///////  
function cities_aft(){
  document.getElementById('esky_cities_frame').setAttribute('src','qsf_2.0/listaMiast/city_tocity.php?Continent=AF');
}
function cities_sat(){
  document.getElementById('esky_cities_frame').setAttribute('src','qsf_2.0/listaMiast/city_tocity.php?Continent=SA');
}
function cities_nat(){
  document.getElementById('esky_cities_frame').setAttribute('src','qsf_2.0/listaMiast/city_tocity.php?Continent=NA');
}
function cities_oct(){
  document.getElementById('esky_cities_frame').setAttribute('src','qsf_2.0/listaMiast/city_tocity.php?Continent=OC');
}
function cities_ast(){
  document.getElementById('esky_cities_frame').setAttribute('src','qsf_2.0/listaMiast/city_tocity.php?Continent=AS');
}
function cities_eut(){
  document.getElementById('esky_cities_frame').setAttribute('src','qsf_2.0/listaMiast/city_tocity.php?Continent=EU');
}
///////
function cities_afh(){
  document.getElementById('esky_cities_frame').setAttribute('src','qsf_2.0/listaMiast/city_hotel.php?Continent=AF');
}
function cities_sah(){
  document.getElementById('esky_cities_frame').setAttribute('src','qsf_2.0/listaMiast/city_hotel.php?Continent=SA');
}
function cities_nah(){
  document.getElementById('esky_cities_frame').setAttribute('src','qsf_2.0/listaMiast/city_hotel.php?Continent=NA');
}
function cities_och(){
  document.getElementById('esky_cities_frame').setAttribute('src','qsf_2.0/listaMiast/city_hotel.php?Continent=OC');
}
function cities_ash(){
  document.getElementById('esky_cities_frame').setAttribute('src','qsf_2.0/listaMiast/city_hotel.php?Continent=AS');
}
function cities_euh(){
  document.getElementById('esky_cities_frame').setAttribute('src','qsf_2.0/listaMiast/city_hotel.php?Continent=EU');
}


