
// --------------------------------------------------
// Onload
// --------------------------------------------------


$(document).ready(function() {              
	
	//DIV-Popup
	
	var api = $("#popupdivtarget").overlay({
		
		api: true ,
		speed: 'fast' ,
		oneInstance: false, 
		finish : { top: 'center' , left: 'center' } ,
		expose : { color: '#c1c1c1' , opacity: 0.8 , loadSpeed: 0 , closeSpeed: 0 }
	}) ;
	
	//Caller Overlay
	
	window.StatusOverlay = function(iframeurl) { 
	
		if ( $("#popupdivtarget").length ) {

			if ( $("#popupdiviframe").length ) {
	
				$("#popupdiviframe").attr("src",iframeurl) ;
			}
	
			api.load(); 			
			
			return false ;
		}
	} 
	
	//Tooltipps
	
	 $("#camlistdiv a").tooltip( { position: "center left" , lazy: true , delay:0 , offset: [0,360] } );
	 $("#lastview  img[title]").tooltip( { tip: '#navialttipp' , lazy: true , delay:0 , position: "bottom right" , offset: [-5,-8] , opacity: .85 } );
	 $("#previewd1 img[title]").tooltip( { tip: '#navialttipp' , lazy: true , delay:0 , position: "bottom right" , offset: [-5,-8] , opacity: .85 } );

	//Senderliste
	 
	if ( $("#onlinelistdiv").length ) {
	 
	 	$("#onlinelistdiv a").tooltip( { position: "center left" , lazy: true , fadeOutSpeed: 0 , offset: [0,360] } );
	 		 
	 	$("#onlinelistdiv").scroll(function() {
	 
	 		$("#onlinelistdiv div:first").html("<img src=\"/all/images/ajax-loader1.gif\">") ;
			$("#onlinelistdiv div:first").load("/all/include/session_online.txt", "", function(){
   			
				$("#onlinelistdiv a").tooltip( { position: "center left" , lazy: true , fadeOutSpeed: 0 , offset: [0,360] } );
				$("#onlinelistdiv").unbind('scroll');
			
				if ( syshost != "http://www.private4.com" ) {

					$("#onlinelistdiv a").each(function(i){ 
		
						var a = $(this).attr('href').replace( /http\:\/\/www\.private4\.com/ig , syshost ) ;
						$(this).attr( 'href' , a ) ;
					});
				}
 			});
 		});
	}
});



// --------------------------------------------------
// Allgemeine JS-Funktionen
// --------------------------------------------------


function navihide(nid) {

	var objre = $('#nav'+nid) ;
	objre.style.visibility = "hidden" ;
}


function naviset(nid) {

	var objre = $('#nav'+nid) ;
	objre.style.visibility = "visible" ;
}


function navijump(link) {

	if ( link ) {

		location.href = link ;
	}
}


function wopen(link,wi,he) {
	
	var width = wi ;  
	var height = he ;
	var l = (screen.availWidth-width)/2 ;
	var t = (screen.availHeight-height)/2 ;
    wincom = window.open(link ,"oswin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width="+wi+",height="+he+",screenX="+l+",screenY="+t+",left="+l+",top="+t);
    
    if (wincom) {
    	wincom.focus() ;
	} else {
		alert(statustext) ;
	}
}


function wopencheck(link,wi,he) {

	var width=wi; var height=he;
	var l=(screen.availWidth-width)/2;
	var t=(screen.availHeight-height)/2;
    
    wincom=window.open(link ,"oswin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width="+wi+",height="+he+",screenX="+l+",screenY="+t+",left="+l+",top="+t);

	if (wincom) { 
		
		wincom.focus() 
	}
	
	return false ;
}


function dellink(link,btext) {

	Check = confirm(btext);

	if(Check == false) {
		
		return ;
		
	} else {
		
		window.open(link,'_self') ;
	}
}


function getcontentform(btext) {

     Check = confirm(btext) ;

	if( Check == false ) {
		
		return false ;
		
	} else {
		
		return true ;
	}

}


function getwebcam(link,btext) {

	var wi = 950 ; 
	var he = 500 ;
	var l  = (screen.availWidth-wi)/2 ;
	var t  = (screen.availHeight-he)/2 ;
    
   	wincom=window.open(link ,"oswin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width="+wi+",height="+he+",screenX="+l+",screenY="+t+",left="+l+",top="+t);

	if (wincom) { 
		
		wincom.focus() 
	}
}


function fielddel(f) {

	if ( f.value == f.defaultValue ) {
	
		f.value = "" ;
	}
}


function fieldset(f) {

	if ( f.value == "" ) {
		
		f.value = f.defaultValue ;
	}
}


function fieldemp(f) {

	if ( f.sbeg.value == f.sbeg.defaultValue ) {
		
		f.sbeg.value = "" ;
	}
}



// --------------------------------------------------
// Suchboxen
// --------------------------------------------------


function nav_search (boxid,amount) {
	
	for ( var i=1 ; i<=amount ; i++ ) {

		var objre1 = $('#searchl'+i) ;
		var objre2 = $('#searchd'+i) ;
				
		if ( i == boxid ) {

			objre2.css('display','block') ;
			objre2.css('backgroundColor','#A20607') ;
			objre1.css({ backgroundColor:'#A20607',marginBottom:'0px',borderBottom:'2px solid #A20607' }); 
			
		} else {
			
			objre2.css('display','none') ;
			objre1.css('backgroundColor','#B41819') ;
			objre1.css({ backgroundColor:'#808080',marginBottom:'2px',marginRight:'2px',borderBottom:'0px' }); 
		}
	}
}


function nav_online(boxid,amount) {
	
	for ( var i=1 ; i<=amount ; i++ ) {

		var objre1 = $('#onlinel'+i) ;
		var objre2 = $('#onlined'+i) ;
				
		if ( i == boxid ) {

			objre2.css('display','block') ;
			objre2.css('backgroundColor','#A20607') ;
			objre1.css({ backgroundColor:'#A20607',marginBottom:'0px',borderBottom:'2px solid #A20607' });
			
		} else {
			
			objre2.css('display','none') ;
			objre1.css('backgroundColor','#B41819') ;
			objre1.css({ backgroundColor:'#808080',marginBottom:'2px',marginRight:'2px',borderBottom:'0px' }); 
		}
	}
}


function nav_preview(boxid,amount) {
	
	for ( var i=1 ; i<=amount ; i++ ) {

		var objre1 = $('#previewl'+i) ;
		var objre2 = $('#previewd'+i) ;
				
		if ( i == boxid ) {

			objre2.css('display','block') ;
			objre2.css('backgroundColor','#A20607') ;
			objre1.css({ backgroundColor:'#A20607',marginBottom:'0px',borderBottom:'2px solid #A20607' });
			
		} else {
			
			objre2.css('display','none') ;
			objre1.css('backgroundColor','#B41819') ;
			objre1.css({ backgroundColor:'#808080',marginBottom:'2px',marginRight:'2px',borderBottom:'0px' }); 
		}
	}
}



// --------------------------------------------------
// END
// --------------------------------------------------
