
function setDefaultFunctions() {

	jQuery(document).ready(function(){
	
		// jQuery("#specialmenu").hide();
		checkHeadSearch();
		insertGuestHouseId();
		//tooltip();
		
        jQuery("ul.roller").ytplaylist({addThumbs:true, autoPlay: false, holderId: 'ytvideo'});
        var scrollObj = jQuery(".ytvideo-teaser .viewroller");        
        jQuery(scrollObj).tinyscrollbar();
        
        // Fire LightBox Event
        lightBoxRel = jQuery(".cnt_lighbox_rel");
        lightBoxRel.unbind();
        if(lightBoxRel.length > 0) {
          lightBoxRel.bind("click", function() {
            lightBox = jQuery(".costum_lightbox");
            lightBox.trigger("click"); 
          }) ;
        }

		if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) 
		{
			jQuery('#header UL #specialmenu').bind('mouseover', function(e) {
				jQuery('#header UL #specialmenu UL.scrolldown').show();
			});		
			
			jQuery('#header UL #specialmenu').bind('mouseout', function(e) {
				jQuery('#header UL #specialmenu UL.scrolldown').hide();
			});	
		} else {
			jQuery('#header UL #specialmenu').bind('mouseover', function(e) {
				jQuery('#header UL #specialmenu UL.scrolldown').show();
			});	
			
			jQuery('#header UL #specialmenu').bind('mouseout', function(e) {
				jQuery('#header UL #specialmenu UL.scrolldown').hide();
			});	
		}

	});
	
	
	
	
}




function insertGuestHouseId() {

	var str = jQuery("TEXTAREA#uid57").val();
	
	if (str =="") {
			jQuery("TEXTAREA#uid57").attr({disabled:""});
	} else {
			jQuery("TEXTAREA#uid57").attr({disabled:"disabled"});
	}
	
	
	
}





function checkHeadSearch() {
	jQuery("#header FORM").bind("submit",function(event) {
				var input = jQuery(".tx-indexedsearch-searchbox-sword.sword");
				if ( (input.val() =='Suchbegriff eingeben') || ( input.val() =="" ) )   {
					event.preventDefault();
					input.val(''); 
					input.focus();
				} else {
					return true;
				}
				
		});	


}

function showItem(item){
	//var depth = 0;
	
	var list = $(item).getElementsByTagName('ul');
	//alert($$('.scrolldown').getElementsByTagName('li'));
		
	item = list[0];
	if( $(item).visible() ) {
		new Effect.Fade(item,{duration:0.25});
	} else { 
		new Effect.Appear(item,{duration:0.25});
	}
	
}


function clickitem(item){
	//var depth = 0;
	
	var list = this.getElementsByTagName('ul');
	//alert($$('.scrolldown').getElementsByTagName('li'));
		
	item = list[0];
	if( $(item).visible() ) {
		new Effect.Fade(item,{duration:0.25});
	} else { 
		new Effect.Appear(item,{duration:0.25});
	}
	
}

/*
Event.observe(window, 'load', function(){
  $$('#specialmenu').each(function(el){
     
        
    Event.observe(el, 'mousemove', function(){
        var sub = el.getElementsByTagName('ul');      
        sub[0].className = 'PrototypeExample_hover';
    });

    Event.observe(el, 'mouseout', function(){
          var sub = el.getElementsByTagName('ul');     
        sub[0].className = 'PrototypeExample';
    });
    
  });
});
*/



window.onload = function(){
	//$('specialmenu').observe('click', clickitem);
	//$('specialmenu').observe('mousemove', clickitem);
	//$('specialmenu').observe('mouseout', clickitem);
	
	//alert($('searchmask').innerHTML);
	//$('headersearch').observe('submit',checkon(this))
}




function checkon(item) {
		//return true;
	
	textbox = Form.getInputs(item,type="text");
	for (i=0;i < textbox.length;i++) {
	
		if ( textbox[i].value == searchterm ) {
			//alert("Bitte "+globalParams);
			
			notehinweis = $('note');
			//alert(notehinweis);
			if (notehinweis == null) {
				var note = document.createElement('div');
				
				note.setAttribute('id','note');
				note.innerHTML = searchtermNote;
				item.appendChild(note);
				new Effect.Fade(note,{duration:1.25});
				textbox[i].focus();
				
			} else {
				new Effect.Appear(notehinweis,{duration:1.25});
				new Effect.Fade(notehinweis,{duration:0.85});
				textbox[i].focus();
			}
			
			
			//textbox[i].focus();
			return false;
		} else {
			return true;
			
		}
		
		
	}

	
	
}
      

