$(document).ready(
function(){

// Tabs


$('#dialog_link, ul#icons li').hover(
 function() { $(this).addClass('ui-state-hover'); }, 
 function() { $(this).removeClass('ui-state-hover'); }
);

$( "#tabs" ).tabs({ cookie: { expires: 7 } });



$( "#datum" ).datepicker();
$( "#Anreisetag" ).datepicker();
$( "#Abreisetag" ).datepicker();

$( "#Form_von" ).datepicker();
$( "#Form_bis" ).datepicker();


$("#caldatum").click(function() {
$("#datum").focus();
});

$("#anreisedat").click(function() {
$("#Anreisetag").focus();
});

$("#abreisedat").click(function() {
$("#Abreisetag").focus();
});

$("#cal_Form_von").click(function() {
$("#Form_von").focus();
});

$("#cal_Form_bis").click(function() {
$("#Form_bis").focus();
});


function remember( selector ){
$(selector).each(
  function(){
    //if this item has been cookied, restore it
    var name = $(this).attr('name');
    if( $.cookie( name ) ){
    $(this).val( $.cookie(name) );
  }
  //assign a change function to the item to cookie it
  $(this).change(
    function(){
     $.cookie(name, $(this).val(),{ path: '/' });
    }
  );
});
}
remember ('[name=arrivalDateDay]');
remember ('[name=arrivalDateMonth]');
remember ('[name=arrivalDateYear]');
remember ('[name=GetParStays]');
remember ('[name=Room0]');
remember ('[name=PersonsinRoom0]');
remember ('[name=BoardType]');
remember ('[name=Form_Suchbegriff]'); 
remember ('[name=datum]'); 





//$('#map_canvas').hide();
$('#map_canvas').css("margin-left",0);  
$('#wechsel_kopf a').toggle(function () {
          $(this).html('Karte verbergen');
          $('#map_canvas').css("margin-left",0);  
          //$('#wechsel_kopf2').show();
          //load();
        }, function () {
          $(this).html('Karte anzeigen');
          $('#map_canvas').css("margin-left",0);  
          //$('#wechsel_kopf2').hide();
        
          //GUnload();
});




$('#directions').css("margin-left",0);  

$('#wechsel_kopf2 a').toggle(function () {
                   $(this).html('Anfahrt anzeigen');
          $('#directions').css("margin-left",0);  
        }, function () {
 $(this).html('Anfahrt verbergen');
          $('#directions').css("margin-left",0);  

});






$('#kontaktform').validate();

$('#empfehlenform').validate();

var text=$('#endtransparent').val();

$('#end2').val(text);





$("a.lightbox").fancybox();
	

$("#TICframe").fancybox({
'width':700,
'height':750,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe'
}).trigger('click');





$("#SuchefreieUnter").bind("submit", function() {

$.fancybox({
'width':700,
'height':750,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe',
'href' : 'about:blank'
});
$(this).attr('target',$('#fancybox-frame').attr('name'));



});




$("#SucheUnter").bind("submit", function() {

$.fancybox({
'width':700,
'height':750,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe',
'href' : 'about:blank'
});
$(this).attr('target',$('#fancybox-frame').attr('name'));



});





});  // Ende jquery



function aendereVerpflegung() {
if (document.IBSearch3.Room0.value == "1" ) {
  document.getElementById("Verpflegung").value="2";
}
if (document.IBSearch3.Room0.value == "2" ) {
  document.getElementById("Verpflegung").value="1";
}
}


function Favorites()
{
    if ((navigator.appName == "Microsoft Internet Explorer") && 
          (parseInt(navigator.appVersion) >= 4))
    {
        var url=location.href;
        var title=document.title;
        window.external.AddFavorite(url,title);
    }
    else
    {
        var FavText = "tramin.com"; 
        if(navigator.appName == "Netscape")
        {
           FavText += " mit den Tasten STRG+D.";
        }
        FavText += " zu den Favoriten hinzufügen";
        alert(FavText);
    }
}




function sendpage()
{
mail_str = "mailto:?subject=Interessante Internetseite gefunden";
mail_str += "&body=Hallo habe eine tolle Website gefunden.";
mail_str += "%0D%0A%0D%0AHier ist die Adresse: " + location.href; 
location.href = mail_str;
}




