jQuery.fn.selText = function() {
    var obj = this[0];
    if ($.browser.msie) {
        var range = obj.offsetParent.createTextRange();
        range.moveToElementText(obj);
        range.select();
    } else if ($.browser.mozilla || $.browser.opera) {
        var selection = obj.ownerDocument.defaultView.getSelection();
        var range = obj.ownerDocument.createRange();
        range.selectNodeContents(obj);
        selection.removeAllRanges();
        selection.addRange(range);
    } else if ($.browser.safari) {
        var selection = obj.ownerDocument.defaultView.getSelection();
        selection.setBaseAndExtent(obj, 0, obj, 1);
    }
    return this;
}

$(function() {

   $('body#page-hotspots div.main-content table tbody tr').bind('click', function() {
      location.href = $(this).find('td.more a').attr("href");
   });
   
   $('body#page-en-hotspots div.main-content table tbody tr').bind('click', function() {
      location.href = $(this).find('td.more a').attr("href");
   });

   if (window.location.hash == '#danke') {
      $('#page-hotspots-hotspot-wuenschen #response').fadeIn();
   }
   
    $("#pressetext").click(function() {
        $(this).selText();
    });
   
});   
   
// AddThis configuration
var addthis_config = {
   username: 'freewave',
   ui_cobrand: 'Freewave',
   ui_language: fw_lang,
   ui_header_color: "#ffffff",
   ui_header_background: "#ba1fb5",
   data_track_linkback: true,
   data_track_clickback: true,
   ui_click: true
}

var addthis_share = { 
   templates: {
      twitter: '{{title}} {{url}} via @freewave',
      mailto: '{{title}} {{url}}'
   }
}

if (typeof freewave == 'undefined') {
   var freewave = {};
}

function randomPromo() {
   var promos = ['<a title="Freewave Hotspots finden Sie übrigens auch auf öamtc.at" href="http://www.oeamtc.at/telematik/"><img class="alignnone size-full wp-image-11933" src="/wp-content/uploads/2010/03/promo_oeamtc.png" alt="ÖAMTC Promotion" width="220" height="150" /></a>',
                 '<a title="Freewave Hotspots finden Sie übrigens auch auf raumdirekt.com" href="http://www.raumdirekt.com/free-wlan-hotspots"><img class="alignnone size-full wp-image-11933" src="/wp-content/uploads/2010/03/promo_raumdirekt.png" alt="Raumdirekt Promotion" width="220" height="150" /></a>',
                 '<a title="Freewave Hotspots finden Sie übrigens auch auf austria.info" href="http://www.austria.info/at/interaktive-karte-oesterreich"><img class="alignnone size-full wp-image-11933" src="/wp-content/uploads/2010/03/promo_austriainfo.png" alt="Österreich Werbung Promotion" width="220" height="150" /></a>',
                 '<a title="Freewave Hotspots finden Sie übrigens auch auf wien.at" href="http://www.wien.gv.at/stadtplan/"><img class="alignnone size-full" src="/wp-content/uploads/2010/11/promo_wienat.png" alt="Wien.at Promotion" width="220" height="150" /></a>',
                 '<a title="Freewave Hotspots finden Sie übrigens auch hier: T-Mobile Wisepilot" href="http://www.freewave.at/blog/2011/04/01/t-mobile-wisepilot-navigation-mit-freewave-hotspots/"><img class="alignnone size-full" src="/wp-content/uploads/2011/04/promo_t-mobile_wisepilot.png" alt="T-Mobile Wisepilot Promotion" width="220" height="150" /></a>'];

   var idx = Math.floor(Math.random()*promos.length);
   document.write(promos[idx]);   
}

function randomPromo2() {
   var promos = ['<a title="Werden Sie Freewave-Fan auf Facebook" href="http://www.facebook.com/freewave.wifi"><img class="alignnone size-full wp-image-11932" src="/wp-content/uploads/2010/03/promo_facebook.png" alt="Facebook Promotion" width="220" height="150" /></a>',
                 '<a title="Folgen Sie uns auf Twitter für Standort-Updates" href="http://twitter.com/freewave"><img class="alignnone size-full wp-image-11936" src="http://www.freewave.at/wp-content/uploads/2010/03/promo_twitter.png" alt="Twitter Promotion" width="220" height="150" /></a>'];

   var idx = Math.floor(Math.random()*promos.length);
   document.write(promos[idx]);   
}


