//Alle Funktionen, die jquery ansprechen
$(window).load(function() {
	if(jQuery(this).width() <= 1024) {
		myHeader('none');
	}
	else {
		myHeader('block');
	}	
});
$(window).resize(function() {
		if(jQuery(this).width() <= 1024) {
			myHeader('none');
		}
		else {
			myHeader('block');
		}			
	});

$(document).ready(function() {	
	enableTooltip('content');
	$(".hover").hoverIntent(			  
			  function () {
			    $(this).find(".hoverClass").show('slow');
			  }, 
			  function () {
				  $(this).find(".hoverClass").hide('slow');
			  }
			);	
	$(".link").hover(
			  function () {
				  $(this).css('cursor', 'pointer');
			  }, 
			  function () {
				  $(this).css('cursor', 'default');
			  }
			);
	$('.link').click(function() {
		window.location.href = $(this).find('a').attr('href');		  
		});
	$(".hoverLink").hover(
			  function () {
				  $(this).css('cursor', 'pointer');
			  }, 
			  function () {
				  $(this).css('cursor', 'default');
			  }
			);
	$(".hoverLink").hoverIntent(			  
			  function () {
			    $(this).find(".hoverClass").show('slow');
			  }, 
			  function () {
				  $(this).find(".hoverClass").hide('slow');
			  }
			);
});
//Alle Funktionen, die im Script benötigt werden

function myHeader(display) {
	$('#logoRight').css('display',display);
	$('#logoLeft').css('display',display);
}
function navHover(boxID) {	
	
}
function editValue(object) {	
	object.parent().parent().find('.hiddenValue').fadeIn('slow');
	object.parent().parent().parent().find('span').css('display', 'none');	
	object.parent().parent().parent().find('.hoverClass').hide('slow');
	object.parent().parent().find('.hoverClass').remove();
}
function enableTooltip (id) {
	$('#' + id + ' *').tooltip({ 
	    track: true, 
	    delay: 600, 	    
	    showURL: false
	});
}
function sendData(host, site, id, boxid, form, ajaxLoader){
	  $(document).ready(function(){  	  
	  	  myArray = $('#'+form).serialize();
	      $.ajax({
	        url: host+'index.php',        
	        cache: false,
	        type: 'POST',    
	        data: {ajax: 'true', site: site, id: id, myArray: encodeURIComponent(myArray)},
	        beforeSend: function() { 	        	
	        	$('#'+ajaxLoader).find('.ajaxLoader').css('display', 'block');
	        },
	        error: function() {	        	
	        	$('#'+ajaxLoader).find('.ajaxLoader').css('display', 'none');
	        },
	        success: function( neueDaten ){  
	            $('#'+boxid).html( neueDaten ); 
	            $('#'+ajaxLoader).find('.ajaxLoader').css('display', 'none');
	            //enableTooltip(boxid);
	        }
	      });
		});
	} 
function changeSite(host, site, id, boxid, ref){
	if(site == 'member-comments')
		loaderID = 'guestbook';
	else
		loaderID = boxid;
	if(ref == 'delete')
		action=window.confirm("Inhalt wirklich entfernen?");
	else
		action=true;
	if(action) {
	  $(document).ready(function(){
	      $.ajax({
	        url: host+'index.php',
	        cache: false,
	        type: 'GET',    
	        data: {ajax: 'true', site: site, id: id, ref: ref, box:boxid},
	        beforeSend: function() {         	                          
	        	$('#'+loaderID).find('.ajaxLoader').css('display', 'block');
	        },
	        error: function() {        	
	        	$('#'+loaderID).find('.ajaxLoader').css('display', 'none');
	        },
	        success: function( neueDaten ){
	        	if(boxid == 'filesUploaded')
	        		$('#'+boxid).append( neueDaten );
	        	else
	        		$('#'+boxid).html( neueDaten );
	        	enableTooltip(boxid);
	        	$('#'+loaderID).find('.ajaxLoader').css('display', 'none');
	        }
	      });
		});
	}
}
function fadeOutBox(boxID) {
	$('#'+boxID).hide(700);
}
function fadeInBox(boxID) {
	$('#'+boxID).show(700);
}
function disposeObject(object) {
	$('#'+object).remove();
}
function addMap(object) {
	$('#'+object).append('<tr>'+
				'<td class="icon"><div class="matchMaps"></div></td>'+							
				'<td class="info">'+	
					'<input class="rinnda_edit" type="text" name="map[]" size="12" maxlength="20" value="" /> - '+
					'<input class="rinnda_edit" type="text" name="scoreHome[]" size="2" maxlength="20" value="" />:<input class="rinnda_edit" type="text" name="scoreGuest[]" size="2" maxlength="20" value="" />'+													
				'</td>'+									
			'</tr>');
}
