// JavaScript Document

//Twitter
//! <div id="twitter"><p>wird geladen <img src="img/indicator.gif" /></p></div>
function LoadTwitter()
{
	  getTwitters('twitter', { 
		  id: 'Horizontnet', 
		  clearContents: true, 
		  count: 5, 
		  withFriends: false,
		  ignoreReplies: true,
		  template: '<div id="twitter-head">%time%</div><div id="twitter-text">%text%</div>'
	  });	  
}

//jQuery HoverFader
function jQueryHoverOpacity()
{
	jQuery().ready(function(){
		
		jQuery('[rel="jquery-fade"]').fadeTo("slow", 0.8); // This sets the opacity of the thumbs to fade down to 60% when the page loads
		jQuery('[rel="jquery-fade"]').hover(
			function() {
				jQuery(this).fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
				
			},function() {
				jQuery(this).fadeTo("fast", 0.8); // This should set the opacity back to 60% on mouseout
				
			});
	});
}

//jQuery Mouseover Img Replace
//doc: http://bavotasan.com/tutorials/a-simple-mouseover-hover-effect-with-jquery/
function jQueryImgReplace()
{	
	jQuery().ready(function(){  
		jQuery('[rel="jquery-imgreplace"]').hover(
												  
			function() {  			
				orgImg = jQuery(this).attr("src");
				orgImg_ext = orgImg.substring(orgImg.length-4,orgImg.length); 
				hovImg = orgImg.replace(orgImg_ext,"_over"+orgImg_ext);
				
				jQuery(this).attr("src",hovImg);  
				
				}, function() {  
					jQuery(this).attr("src",orgImg);  
			
			}); 
	});  
}


//jQuery Ajax Load Page Function
function jQueryAjax(file,targetid,anker)
{
	jQuery.ajax({
	  type:"POST",
	  url: file,
	  cache: false,
	  success: function(html){
		jQuery("#"+targetid).empty();				//clear div
	   	jQuery("#"+targetid).append(html);		//insert
		Shadowbox.init({ skipSetup: true }); Shadowbox.setup(); //shadowbox init
		location.href="#"+anker;
		}
	});	
};

//MIME Plugin, Video, etc.
//doc: http://malsup.com/jquery/media/
function jQueryLoadMedia()
{	
	jQuery().ready(function(){
		jQuery('a.media').media();		
	});	
};

//VIMEO ADDON
function Vimeo(id,w,h)
{
	
	
	
	document.write('<embed src=\"http://vimeo.com/moogaloop.swf?clip_id='+id+'&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=&amp;fullscreen=1'+  
        'type="application/x-shockwave-flash"'+ 
        'allowfullscreen="true"'+ 
        'allowscriptaccess="always"'+ 
        'width="'+w+'"'+ 
        'height="'+h+'"></embed>');	
}

//Jquery SWFOBJECT Plugin
//doc:http://jquery.thewikies.com/swfobject/examples

function jQueryLoadVideo(id,filepath,w,h)
{
	jQuery().ready(function(){   
		
		jQuery('#'+id).flash({ 
			   
			swf: '/includes/flvplayer.swf',
			height: h,
			width: w,
			params: {   
				play: true,
				loop: false,
				
				flashvars: {  
					file: filepath,
					autostart:true
				}  
			}
		}); 
	});
}

//Validate Form
//doc: http://www.position-relative.net
function jQuerySubmitForm(id)
{
	
	var formular = document.getElementById(id);
	
	if(jQuery("#"+id).validationEngine({returnIsValid:true}))
	{
		formular.submit();			
	}
};


//Accordion Menu Vertical
//doc: http://docs.jquery.com/UI/Accordion
function jQueryAccordionMenu()
{
	jQuery().ready(function(){	
							
		jQuery('#accordion').accordion({
			active: 'h3.selected',
			//event: 'mouseover',
			collapsible: true,
			autoHeight: false,
			showSpeed: 400,
			hideSpeed: 800
		});
	
		
	});
};

//Shadowbox Img/Media Viewer
//doc: http://www.shadowbox-js.com/usage.html
function jQueryShadowbox(init)
{
	Shadowbox.init({
    	language:   "de-DE",
    	players:    ["flv","swf","qt","iframe","html"]
	});
}


//needs a div #easylider, 
//doc: <div id="slider"><ul><li>....</li></ul></div>
function jQueryEasySlider()
{
	jQuery().ready(function(){	
		jQuery("#slider").easySlider({			
		});
	});		
};