
function is_defined( variable)
{
    return (typeof(window[variable]) == "undefined")?  false: true;
}

function arec_input_focus(input){

  $(input).each(function(){
    
    if($(this).attr('value') == '') $(this).attr('value', $(this).attr('title')); // set value to title attribute if value is empty

    $(this).focus(function(){
      if($(this).attr('value') == $(this).attr('title')) $(this).attr('value',''); // set value to empty if value is = title
    });

    $(this).blur(function(){
      if($(this).attr('value') == '') $(this).attr('value', $(this).attr('title')); // set value to title attribute if value is empty
    });

  });

}


function roobies_popup_register_no_register(a){
  $('#popup_register').remove();
  $('#__arec_ib_dim_screen').remove();
}

$(document).ready(function(){

  arec_input_focus('#login_form input[type=text], #login_form input[type=password], #productsearch_form input[type=text], #shopsearch_form input[type=text], #field_birthday');


  // delete arec event for new window
  $('a.popup_register').unbind('click');

  $('a.popup_register').click(function(e){
    $('#popup_register').remove();
    
    // start dim screen
    arec_ib_dim_screen_start();
    $('#__arec_ib_dim_screen').click(function(){
      $('#popup_register').remove();
    });
    
    $('body').append('<div id="popup_register" style="top: '+($(window).height()/2+$(document).scrollTop())+'px;"><a href="http://www.roobies.de/p/Neuanmeldung/" class="register"></a><a href="'+this.href+'" target="_blank" onclick="roobies_popup_register_no_register(this);" class="no_register"></a></div>');
    
    arec_cancel_event(e);
  });

  $('#map_tutorial area').each(function(){
	  $(this).tooltip({
		track: true,
	    bodyHandler: function(){ return $('#'+$(this).attr('class')).html(); },
	    extraClass: "tooltip",
	    delay: 200
	  });
  });


});



