// 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, 312],
	    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("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;
	    }
}

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 s = '';
    var i;
    if (google_ads.length == 0) {
       return;
    }
	if (google_ads.length > 1) {
	            s += '<div class="boxHeader"><h2><a href=\"' + google_info.feedback_url + '\" >Google-Anzeigen</a></h2></div>'
	            for(i = 0; i < google_ads.length; ++i) {
	                s += '<div class="ad">';
	                if (i > 0){
	                    s += '<div class="horizontal"></div>';
	                }
	                s += '<a href="' +
	                google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
	                google_ads[i].visible_url + '\';return true"> <b>' +
	                google_ads[i].line1 + '</b><br></a> ' +
	                google_ads[i].line2;
	                if (google_afs_ad == 'n3'){
	                  s += '<br>';
	                }
	                s += google_ads[i].line3 + '<br><a target="_blank" class="adlink" href="' +
	                google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'go to ' +
	                google_ads[i].visible_url + '\';return true">' +
	                google_ads[i].visible_url + '</a>';
	                s += '</div>';
	            }
	}
    document.write(s);
    return;
}
google_ad_client = "pub-7797359673629161";
//google_afs_adtest = 'on'; // muss spï¿½ter raus
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 = '3';
google_language = 'de';
google_gl = 'de';


/************************* /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 ********************/

$(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
	$('.faq').click(function(){
		$(this).toggleClass('open');
		$('#faqbox').hide();
		$('#faqbox').show();
	});		
		
	});
	function reinitTooltip() {
	    $('.tt *').tooltip({
	    track: true,
	    extraClass: "jdee",
	    showURL: false
	}); 
}

