/* @version $Rev$ */
// OPTIONS DIALOGE

// klein
var dialog_frau334_148 = {
    overlay: {'background-color':'white','opacity':'0.5'},
    modal: true,
    width: 334,
    height: 148,
    resizable: false,
    draggable: true,
    position: [177, 312],
    closeOnEscape: false
};

// mittel ;)
var dialog_frau334_308 ={
    overlay: {'background-color':'white','opacity':'0.5'},
    modal: true,
    width: 334,
    height: 308,
    resizeable: false,
    draggable: true,
    position: [177,312],
    closeOnEscape: false
};

//mittel ;)
var dialog_frau114_90 ={
    overlay: {'background-color':'white','opacity':'0.5'},
    modal: true,
    width: 114,
    height: 90,
    resizeable: false,
    draggable: true,
    position: [177,312],
    closeOnEscape: false
};

// contentbreite
var dialog_frau668_308 = {
    overlay: {'background-color':'white','opacity':'0.5'},
    modal: true,
    width: 668,
    height: 308,
    resizable: false,
    draggable: true,
    position: [10,312],
    closeOnEscape: false
};

var dialog_frau668_flex = {
		overlay: {'background-color':'white','opacity':'0.5'},
		modal: true,
		width: 668,
		height: 1000,
		resizable: false,
		draggable: true,
		position: [10, 112],
	    closeOnEscape: false
	};

	function showDialog(id, size) {
		if(id.charAt(0) !=  '#') {
	        id = '#' + id;
	    }

	    if(typeof size == 'undefined') {
	    	var size = 'small';
	    }
	    if(size == 'big') {
	    	showLayer = dialog_frau668_308;
	    } else if(size == 'middle') {
	    	showLayer = dialog_frau334_308;
	    } else if(size == 'flex') {
	    	showLayer = dialog_frau668_flex;
	    } else {
	    	showLayer = dialog_frau334_148;
	    }
	    $(id).dialog(showLayer).show();
	    $(id).dialog('open');
	}

function closeDialog(id) {
    if(id.charAt(0) !=  '#') {
        id = '#' + id;
    }
    $(id).dialog('close');
    $(id).hide();
}


function evalKeySubmit(event, frm) {  
  if (event && (event.which == 13 || event.keyCode==13 )){
    frm.submit();
   } else{ 
  return true;
  }  
}  

function doHide(id) {
    document.getElementById(id).setAttribute('style','display:none;');
}

function newPW(){
    var postdata={};
    postdata['email']=document.newpwform.email.value;
    $.post('/user/registrierung/neuespasswort',postdata,function (data){responseNewPw(data);}, "json");
}

function responseNewPw(data){
    $('#dialognewPW').dialog('close');
    doHide('dialognewPW');

    if (data.pwemailsend) {
		$('#dialogNewPwResponse').attr("title", data.title);
		$('#dialogNewPwResponsecontent').html(data.text+'<br/><br/>');
		$('#dialogNewPwResponse').dialog(dialog_frau334_148).show();
		$('#dialogNewPwResponse').dialog('open');
    } else {
		$('#dialogNewPwResponseError').attr("title", data.title);
		$('#dialogNewPwResponseErrorcontent').html(data.text+'<br/><br/>');
		$('#dialogNewPwResponseError').dialog(dialog_frau334_148).show();
		$('#dialogNewPwResponseError').dialog('open');
    }
}

function newPWrelog(){
    var postdata={};
    postdata['email']=document.newpwformrelog.email.value;
    $.post('/user/registrierung/neuespasswort',postdata,function (data){responseNewPwRelog(data);}, "json");
}

function responseNewPwRelog(data){
    $('#dialogRelog').dialog('close');
    doHide('dialogRelog');

      if (data.pwemailsend) {
			$('#dialogRelogResponse').attr("title", data.title);
			$('#dialogRelogResponsecontent').html(data.text+'<br/><br/>');
			$('#dialogRelogResponse').dialog(dialog_frau334_148).show();
			$('#dialogRelogResponse').dialog('open');    
      } else {
			$('#dialogRelogResponseError').attr("title", data.title);
			$('#dialogRelogResponseErrorcontent').html(data.text+'<br/><br/>');
			$('#dialogRelogResponseError').dialog(dialog_frau334_148).show();
			$('#dialogRelogResponseError').dialog('open');    
      }      
}

function reloadIVW()
{
        var ref = document.referrer;
        var ivw = document.getElementById("ivwpixel");
        if (ivw == null) ivw = document.getElementById("ivw2");
        if (ivw != null) {
	        if ( (reloadIVW.arguments) && (reloadIVW.arguments.length==2))
	        {
	            var _agof=reloadIVW.arguments[0]; 
	            var _ivw=reloadIVW.arguments[1]; 
	            var imgurl = "http://frauzi.ivwbox.de/cgi-bin/ivw/CP/"+_agof+';'+_ivw+'?r='+ref+'&d=' + Math.round(1000000*Math.random());
	        }
	        else if ( ((typeof _initialAGOF) == 'string') && ((typeof _initialIVW) == 'string') )
	        {
	            var imgurl = "http://frauzi.ivwbox.de/cgi-bin/ivw/CP/"+_initialAGOF+';'+_initialIVW+'?r='+ref+'&d=' + Math.round(1000000*Math.random());
	        }
	        else
	        {
	            var pos = ivw.src.indexOf("&");
	            var imgurl = ivw.src.substring(0, pos) + "&d=" + Math.round(1000000*Math.random());
	            imgurl = imgurl.replace(/r=&/, "r="+ref+"&");
	        }
	        ivw.src = imgurl;
	    }
    	// adReload()
    	adReload.reloadAll();
}

function IvwPlaybutton() {
	var _agof, _ivw, _r;
	if ((IvwPlaybutton.arguments) && (IvwPlaybutton.arguments.length == 2) && typeof IvwPlaybutton.arguments[0] == 'string' && typeof IvwPlaybutton.arguments[1] == 'string') {
   		_agof = IvwPlaybutton.arguments[0];
   		_ivw = IvwPlaybutton.arguments[1];
   	}
	else if (((typeof _initialAGOF) == 'string') && ((typeof _initialIVW) == 'string'))
	{
   		_agof = _initialAGOF;
   		_ivw = _initialIVW;
	}

	if (((typeof _agof) == 'string') && ((typeof _ivw) == 'string'))
	{
		_r = {agof:_agof+'_', ivw: _ivw.replace(/\/frauenzimmer\//, '/frauenzimmer/videoabrufe/')};
	}
	else
		_r = {agof:'', ivw:''};
	return _r;
}

var adReload = {};

adReload._ord = 0;

adReload.reloadAll = function() {
	if (typeof(ip_stopadreload) != undefined && ip_stopadreload === true) {
		return false;
	}
	try {
	    adReload.ord();
	    adReload.rectangle();
	    adReload.banner();
	    adReload.sky();
    } catch (e) {
    	return e;
    }
	return true;
};

adReload.ord = function () {
	adReload._ord = Math.round(1000000 * Math.random());
};

adReload.rectangle = function () {
	var urls = [];
	var i = 0;
	$.each(adSlotsDelivered['300x250'], function(idx, val) {
		if (val == undefined) {
	    	return;
	    }
	    var url = val.url;
	    delete (val.ord);
	    $.each(val, function(k, v) {
	        if (k == 'url' || k == 'u') {
	            return;
	        }
	        url = url + k + '=' + v + ';';
	    });
	    if (typeof n_pbt != 'undefined' && n_pbt != '') {
	        url = url + n_pbt + ';';
	    }
	    if (typeof AD_VISBILITY_PARAM === 'boolean' && AD_VISBILITY_PARAM === true ) {
	    	url += (typeof adVisibility == 'function' ? adVisibility($('.pageRectangleAd.isAdVisible').eq(i)) : '');
	    }
	    
	    url = url + 'u=' + val.u + ';ord=' + adReload._ord;
	    urls[i] = url;
	    i = i + 1;
	});
	if (i == 1) {
		$('.rectangel .media').html('').html(writeCapture.sanitize('<script type="text/javascript" src="' + urls[0] + '?"></script>'));
	} else if (i == 2) {
		$('.rectangel .media').each(function(i) {
			$(this).html('').html(writeCapture.sanitize('<script type="text/javascript" src="' + urls[i] + '?"></script>'));
		});
	}
};

adReload.banner = function () {
	    var banner = adSlotsDelivered['468x60'];
	    if (banner == undefined) {
	    	return;
	    }
	    var url = banner.url;
	    delete (banner.ord);
	    $.each(banner, function(k, v) {
	        if (k == 'url' || k == 'u') {
	            return;
	        }
	        url = url + k + '=' + v + ';';
	    });
	    if (typeof n_pbt != 'undefined' && n_pbt != '') {
	        url = url + n_pbt + ';';
	    }
	    if (typeof AD_VISBILITY_PARAM === 'boolean' && AD_VISBILITY_PARAM === true ) {
	    	url += (typeof adVisibility === 'function' ? adVisibility($('#bannerDummy.isAdVisible').filter(':last')) : '');	    
	    }
	    
	    url = url + 'u=' + banner.u + ';ord=' + adReload._ord;
	    $('#banner').html('').html(writeCapture.sanitize('<script type="text/javascript" src="' + url + '?"></script>'));
};

adReload.sky = function () {
    var sky = adSlotsDelivered['120x600'];
    if (sky == undefined) {
    	return;
    }
    var url = sky.url;
    delete (sky.ord);
    $.each(sky, function(k, v) {
        if (k == 'url' || k == 'u') {
            return;
        }
        url = url + k + '=' + v + ';';
    });
    if (typeof n_pbt != 'undefined' && n_pbt != '') {
        url = url + n_pbt + ';';
    }
    if (typeof AD_VISBILITY_PARAM === 'boolean' && AD_VISBILITY_PARAM === true ) {
    	url += (typeof adVisibility === 'function' ? adVisibility($('#bannerDummy.isAdVisible').filter(':last')) : '');
    }
    
    url = url + 'u=' + sky.u + ';ord=' + adReload._ord;
    if ($('#skyscraper').size() > 0) {
         $('#skyscraper').html('').html(writeCapture.sanitize('<script type="text/javascript" src="' + url + '?"></script>'));
    } else if ($('#ip_wallsky').size() > 0) {
    	$('#ip_wallsky').remove();
    	$('body').append(writeCapture.sanitize('<script type="text/javascript" src="' + url + '?"></script>'));
    }
};

function rtl_writeln(rtl_flashcode) {
    document.writeln(rtl_flashcode);
}

function popup(file)
{
  breit=388; hoch=565;
  xpos = (screen.width-breit)/2; ypos = (screen.height-hoch)/2;
  bigstring = "width="+breit+",height="+hoch+",screenX="+xpos+",screenY="+ypos+",top="+ypos+",left="+xpos+",directories=no,status=no,scrollbars=yes,resize=no,menubar=no";
  detailfenster = window.open(file,"myTnWindow",bigstring);
}

/************************* GOOGLE AdSense ************************/
function google_ad_request_done(google_ads) {
	var r;
	var s = '';
	var _retained_length;
	var i;
	var _ads;
	var ads = '';
    if (google_ads.length == 0) {
       return;
    }
	if (google_ads.length >= 1) {
		if (html_type_google=='contentall'){
			r = Math.round(Math.random()*1000000);
			document.writeln('<span id="gifu_' + r + '"></span>'); // GoogleFeedbackInfoUrl
			$.each( $('#gifu_' + r).siblings('h3'),
				function () {
					$(this)
						.click(function () { window.open(google_info.feedback_url); } )
						.hover(function () { $(this).css('cursor','pointer'); }, function () { $(this).css('cursor','auto'); } );
				}
			);

			if (fz_google_retain == 0) { // altes Schema
				fz_google_retain = '1';
			}
			
		} else if (html_type_google=='contentall2') {
			s += '<h3><a target="_blank" href=\"' + google_info.feedback_url + '\" >Google-Anzeigen</a></h3>';
		} else {
            s += '<div class="boxHeader"><h2><a target="_blank" href=\"' + google_info.feedback_url + '\" >Google-Anzeigen</a></h2></div>';
		}

		_retained_length = fz_google_retained_ads.length;
		for(i = 0; i < _retained_length  + google_ads.length; ++i) {
			
			if ( i < (google_ads.length + _retained_length - fz_google_retain) ) {
				
				if ( i < _retained_length) {
					fz_google_retained_ads.reverse();
					_ads = fz_google_retained_ads.pop();
					fz_google_retained_ads.reverse();
				} else {
					_ads = google_ads[i-_retained_length];
				}
				
				ads += '<div class="ad">';
				if (i > 0) {
					ads += '<div class="horizontal"></div>';
				}
				ads += '<a href="'
		                + _ads.url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to '
		                + _ads.visible_url + '\';return true"> <b>'
		                + _ads.line1 + '</b><br></a> '
		                + '<span>' + _ads.line2 + ' </span>';
				ads += _ads.line3 + '<br><a target="_blank" class="adlink" href="'
		                + _ads.url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to '
		                + _ads.visible_url + '\';return true">'
		                + _ads.visible_url + '</a>';
				ads += '</div>';
			} else {
				fz_google_retained_ads.push(google_ads[i]);
			}
		}
	}

	if (google_ads[0].bidtype == "CPC") { /* insert this snippet for each ad call */
		google_adnum = google_adnum + google_ads.length;
		google_skip = google_adnum;
	}
	
    document.write(s + ads);
    return;
}
google_ad_client = "pub-7797359673629161";
google_ad_type = "text";
google_afs_hl = 'de';
google_afs_ie ='utf8';
google_afs_oe = 'utf8';
google_afs_ad = 'n3';
google_feedback = 'on';
google_ad_output = 'js';
google_max_num_ads = '2';
google_language = 'de';
google_gl = 'de';
google_adnum = 0;
google_skip = 0;

html_type_google = '';

fz_google_retain = 0;
fz_google_retained_ads = new Array();
/************************* /GOOGLE AdSense ************************/



/************************* Standard-Flashes ************************/
function renderFzVideoplayer(preroll, midroll, postroll, postad, flashxml) {
	if (renderFzVideoplayer.arguments.length == 6) { // letzer Parameter optional (mehrere Player pro Seite)
		count = renderFzVideoplayer.arguments[5];
	} else {
		count = '';
	}
	var flashvars = {};
	flashvars.angebot = 'frauenzimmer';
	flashvars.ivw = _initialIVW;
	flashvars.xml = flashxml;
	flashvars.as = '0';
	if (count == '') { // Werbung nur beim ersten Player der Seite
		flashvars.preroll = preroll;
		flashvars.midroll = midroll;
		flashvars.postroll = postroll;
		flashvars.postad = postad;
	} else {
		flashvars.preroll = '';
		flashvars.midroll = '';
		flashvars.postroll = '';
		flashvars.postad = '';
	}
	var params = {
	    quality: 'high',
	    wmode: 'opaque',
	    bgcolor: '#ffffff',
	    allowfullscreen: 'true',
	    allowscriptaccess: 'always',
	    menu: 'true',
	    play: 'true',
	    loop: 'true',
	    devicefont: 'false',
	    scale: 'showall'
	};
	  
	var attributes = {
	    	align: 'middle',
	    	style: 'background-image:url(http://bilder.frauenzimmer.de/images/video_defaultbild_16zu9.jpg);'
	    };
	var jetzt = new Date();
	    
	swfobject.embedSWF('http://bilder.frauenzimmer.de/flash/frauenzimmer_videoplayer.swf?r=' + jetzt.getTime(), 'videoplayer'+count, '520', '326', '9.0.28', false, flashvars, params, attributes);
	
}

function renderFzVideoplayerWrapper(idname) {
	if (renderFzVideoplayerWrapper.arguments.length == 2) { // letzer Parameter optional (mehrere Player pro Seite)
		count = renderFzVideoplayerWrapper.arguments[1];
	} else {
		count = '';
	}
	$('#'+idname).html('<div id="videoplayer'+count+'" ><a href="javascript:void(0)" onclick="render_videoplayer(\'\',\'\',\'\',\'\'); return false;">'
			   + '<img src="http://bilder.frauenzimmer.de/images/video_defaultbild_16zu9.jpg" width="520" height="326" border="0" style="margin-bottom: 25px;">'
			   + '</a></div>');
}
/************************* /Standard-Flashes ************************/


/******************* G R U P P EN    J S ********************/

function doGroupSearch() {
	$(document).ready(function() {
        var suchbegriff = $(".search input[name='searchField']").attr("value");
        var suche = $(".search select[name='searchIn']").attr("value");
        if(suche >= 1 && suche <= 5 && jQuery.trim(suchbegriff).length >= 3 && suchbegriff != 'Suchbegriff') {
        	document.formSerachInGroups.submit();
        } else {
            alert('Fehler!\nDer Suchbegriff muss mindestens 3 Zeichen umfassen.\n\nKorrigiere deine Suche und versuche es erneut.');
        }
	});
}
	
function showEditLayer(id) {
	$(document).ready(function() {
        $.ajax({
            type: "GET",
            url: "/gruppen/erstellen/bearbeiten/id/"+id+"/format/html",
            success: function(msg){
                $("body").prepend('<div id="gruppenBearbeiten" class="frau668_flex"><div class="bgbox"></div><div class="contentbox"><div class="textBox">'+msg+'</div></div><div class="clear"></div></div>');
                showDialog('gruppenBearbeiten','flex');
                $(".ui-dialog-titlebar").html("<span class=\"ui-dialog-title\"></span><a onClick=\"closeEditLayer();\" class=\"ui-dialog-titlebar-close-ersatz\"><span></span></a>");
                $(".ui-dialog-title").html("Allgemeine Einstellungen");
            }
        }); 
    });      
}

function setDialogTitle(title) {
	$(document).ready(function() {
		$(".frau668_flex .ui-dialog-title").html(title);
	})
}

function closeEditLayer() {
	$(document).ready(function() {
		$("#gruppenBearbeiten").dialog('close');
		window.location.reload();
	});
}

function activate_reiter(id) {
	$("#gruppenprofil .boxReiter6_" + id + "").removeClass("boxReiter").addClass("boxReiterAktiv");
}
function activate_button(id) {
	$("#groupEditMainBox #button_" + id + "").removeClass("textButton").addClass("textButtonAktiv");
}

/******************* / G R U P P EN    J S ********************/

/******************* FORUM MOVETHREAD J S ********************/

function forumShowMovethreadLayer(forumid, threadid, hint) {
	if (typeof (threadid)== "number" ){
		if (hint == 1){
			var threadurl ="/forum/movethread/removehint/forum/"+forumid+"/thread/"+threadid+"/format/html";
		} else {
			var threadurl ="/forum/movethread/target/forum/"+forumid+"/thread/"+threadid+"/format/html";
		}
	} else {
		var threadurl ="/forum/movethread/index/format/html";
	}
    $(document).ready(function() {
        $.ajax({
            type: "GET",
            //url: "/forum/movethread/index/format/html",
            url: threadurl,
            success: function(msg){
                $("body").prepend("<div id=\"forumMovethread\" class=\"bastel\" style=\"display:none;\">"+msg+"</div>");
                var dialogData = {
                        overlay: {'background-color':'black','opacity':'0.3'},
                        modal: true,
                        width: 617,
                        overflow: 'visible',
                        closeOnEscape: false,
                        resizable: false,
                        draggable: true,
                        position: [172, 100]
                };
                $("#forumMovethread").dialog(dialogData).show();
                $("#forumMovethread").dialog('open');
                //$(document).unbind("keydown.ui-dialog-overlay");
                $(".ui-dialog-titlebar").remove(".ui-dialog-titlebar");
            }
        }); 
    });      
}

/******************* / FORUM MOVETHREAD J S ********************/

function forumCloseMovethreadLayer() {
	$(document).ready(function() {
		$("#forumMovethread").dialog('close');
		window.location.reload();
	});
}


$(document).ready(function(){
	// MouseOver/Down ButtonAnimation
	 $(".textButton a").mousedown(function () { 
		  $(this).children('.divLeft').css('top','-38px');
		  $(this).children('.divRight').css('top','-38px');	 	  
	});
	$(".textButton a").hover(function () {
		  $(this).children('.divLeft').css('top','-19px');
		  $(this).children('.divRight').css('top','-19px');	 
	}, function () {
		  $(this).children('.divLeft').css('top','0px');
		  $(this).children('.divRight').css('top','0px');	 	  
	});
	
	
	// MouseOver/Down ButtonAnimation
	 $(".actionButton a").mousedown(function () { 
		  $(this).children('.bg').css('top','-60px');
		  $(this).children('.bg').css('top','-60px');	 	  
	});
	$(".actionButton a").hover(function () {
		  $(this).children('.bg').css('top','-30px');
		  $(this).children('.bg').css('top','-30px');	 
	}, function () {
		  $(this).children('.bg').css('top','0px');
		  $(this).children('.bg').css('top','0px');	 	  
	});
	

	// MouseOver/Down LinkButtonAnimation
	 $(".linkButton a").mousedown(function () { 
		  $(this).children('.bg').css('top','0px');  
	});
	$(".linkButton a").hover(function () {
		  $(this).children('.bg').css('top','-18px');
	}, function () {
		  $(this).children('.bg').css('top','-36px'); 	  
	});

	// MouseOver/Down LinMiniButtonAnimation
	 $(".linkMiniButton a").mousedown(function () { 
		  $(this).children('.bg').css('top','0px');  
	});
	$(".linkMiniButton a").hover(function () {
		  $(this).children('.bg').css('top','-14px');
	}, function () {
		  $(this).children('.bg').css('top','-28px'); 	  
	});	
	// MouseOver/Down boxReiterAnimation
	$(".boxReiter a").mousedown(function () { 
	    $(this).children('.bg').css('top','0px');
	    $(this).children('.item').css('font-weight','bold');
	});
	$(".boxReiter a").hover(function () {
	    if (!$(this).parent().hasClass('boxReiterAktiv')) {
	        $(this).children('.bg').css('top','-28px');
	    }
	}, function () {
	    if (!$(this).parent().hasClass('boxReiterAktiv')) {
	        $(this).children('.bg').css('top','-56px');
	        $(this).children('.item').css('font-weight','normal');
	    }
	});

	// MouseOver/Down newUser imgBoxAnimation
	$(".newUser .imgBox a").hover(function () {
		  $(this).children('.bg').css('top','-15px');
	}, function () {
		  $(this).children('.bg').css('top','0px');
	});
	
	
	// MouseOver/Down newUserBoxButtonAnimation
	 $(".newUserBoxButton a").mousedown(function () { 
		  $(this).children('.bg').css('top','0px');  
	});
	$(".newUserBoxButton a").hover(function () {
		  $(this).children('.bg').css('top','-64px');
	}, function () {
		  $(this).children('.bg').css('top','-128px'); 	  
	});

	// MouseOver/Down Pfeile 65px hoch
	 $(".pfeil65 a").mousedown(function () { 
		  $(this).children('.bg').css('top','0px');  
	});
	$(".pfeil65 a").hover(function () {
		  $(this).children('.bg').css('top','-69px');
	}, function () {
		  $(this).children('.bg').css('top','-138px'); 	  
	});
	
	// ********* Funktionen Handtasche *********
	// Handtasche oeffnen / schliessen
	// loggedOut
		$(".toggleContentBox a").toggle(function () {
		$('.handtascheContentBox').slideDown('fast');
		
		$('.toggleContentBox a .txt').text('Handtasche schließen');
	}, function () {
		$('.handtascheContentBox').slideUp('fast');
		$('.toggleContentBox a .txt').text('Handtasche öffnen');		
	});
	// loggedIn
	$(".toggleContentBox2 a").toggle(function () {
	    $('.handtascheContentBox').slideUp('fast');
	    $('.toggleContentBox2 a .txt').text('Handtasche öffnen');
	}, function () {
	    $('.handtascheContentBox').slideDown('fast');
	    $('.toggleContentBox2 a .txt').text('Handtasche schließen');        
	});
	
	//$('.handtascheContentBox').slideUp('fast');
	
	$(".toggleContentBox a").mousedown(function () {
		  $(this).children('.toggleContentBoxBG').css('top','-28px');  
	});	
	$(".toggleContentBox a").mouseout(function () {
		  $(this).children('.toggleContentBoxBG').css('top','0px');  
	});
		
	// MouseOver/Down BigButtonAnimation
	$(".bigButton a").mousedown(function () { 
		  $(this).children('.bigButtonBG').css('top','-68px');  
	});
	$(".bigButton a").hover(function () {
		  $(this).children('.bigButtonBG').css('top','-34px');
	}, function () {
		  $(this).children('.bigButtonBG').css('top','0px');	  
	});			
		
	
	// HandtaschenIcons Auswahl Overlay
		 
    handbag_loaded = false;
 	$('#showTascheOverlay').mousedown(function () {
        if (!handbag_loaded) {
            $(".selectTascheContent").load("/user/auth/handtasche/format/html")
            handbag_loaded = true;
        }
        $(".selectTascheOverlay").toggle();
    });

	
	$('.selectNewTasche').mousedown(function () {
		// Klasse des geklickten HandtaschenIcons ermitteln
		var handtascheType = $(this).children('div').attr("class");
		// ******* var handtascheType muss hier per Ajax wegegschrieben werden ***************
		$.get('/user/registrierung/handtasche/class/'+handtascheType);
		// neues HantaschenIcon im Kopf der Handtasche anzeigen
		$("#handtascheIconTop").removeClass().addClass(handtascheType);
	
		// Taschenauswahl schliessen
		$(".selectTascheOverlay").hide();  
	});	
	
	
	//ToolTipps
	$('.tt *').tooltip({
	    track: true,
	    extraClass: "jdee",
	    showURL: false
	});	

	// FAQs ein-/ausblenden
	$('.faqHeader').click(function(){
		$(this).toggleClass('open');
		$('#faqbox').hide();
		$('#faqbox').show();
	});	

	// FAQs ein-/ausblenden
	$('.faq').click(function(){
		$(this).toggleClass('open');
		$(this).parent().toggleClass('open');
		$('#faqbox').hide();
		$('#faqbox').show();
	});		
	
});

function reinitTooltip() {
	    $('.tt *').tooltip({
	    track: true,
	    extraClass: "jdee",
	    showURL: false
	}); 
}

function popup_x_y(x_,y_,url_) {
	parameter='height='+y_+',width='+x_+',top=0,left=0,toolbar=no,menubar=no,location=no,scrollbars=no,statusbar=no';
	if (popup_x_y.arguments) { parameter+=((popup_x_y.arguments.length>=4)&&(typeof(popup_x_y.arguments[3])!='undefined')) ? ','+popup_x_y.arguments[3] : ''; }
	window.open(url_,'',parameter);
}

/**
 * adVisibility
 * 
 * @param obj element
 * @return string
 */
function adVisibility(elem)
{
	if ($(elem).length === 0) return ''; 
	
    var docViewTop = $(window).scrollTop();
    var docViewBottom = docViewTop + $(window).height();
    var docViewLeft = $(window).scrollLeft();
    var docViewRight = docViewLeft + $(window).width();

    var elemTop = $(elem).offset().top;
    var elemBottom = elemTop + $(elem).height();
    var elemLeft = $(elem).offset().left;
    var elemRight = elemLeft + $(elem).width();
	
    var elemVisibleTop, elemVisibleLeft, elemVisibleBottom, elemVisibleRight;
	
	if (elemTop >= docViewTop) {
		if (elemTop < docViewBottom) {
			elemVisibleTop = elemTop;
		} else {
			elemVisibleTop = false;
		}
	} else { // elemTop < docViewTop
		elemVisibleTop = docViewTop;
	}

	if (elemLeft >= docViewLeft) {
		if (elemLeft < docViewRight) {
			elemVisibleLeft = elemLeft;
		} else {
			elemVisibleLeft = false;
		}
	} else { // elemLeft < docViewLeft
		elemVisibleLeft = docViewLeft;
	}

	if (elemBottom <= docViewBottom) {
		if (elemBottom >= docViewTop) {
			elemVisibleBottom = elemBottom;
		} else { // elemBottom < docViewTop
			elemVisibleBottom = false;
		}
	} else { // elemBottom > docViewBottom
		elemVisibleBottom = docViewBottom;
	}
	
	if (elemRight <= docViewRight) {
		if (elemRight > docViewLeft) {
			elemVisibleRight = elemRight;
		} else { // elemRight < docViewLeft
			elemVisibleRight = false;
		}
	} else { // elemRight > docViewRight
		elemVisibleRight = docViewRight;
	}

	if (elemVisibleTop === false || elemVisibleLeft === false || elemVisibleBottom === false || elemVisibleRight === false) {
		return 'ip_v=0;';
	} else {
		var elemVisibility = Math.round((elemVisibleRight-elemVisibleLeft)/$(elem).width() * (elemVisibleBottom-elemVisibleTop)/$(elem).height()*100); 
		return 'ip_v=' + (elemVisibility==100 ? '1' : '0') +';';
	}
}
