function cot_tl_bigPopup(url){
	newwindow=window.open(url,'name','WIDTH=450,HEIGHT=500,FRAMEBORDER=0,MARGINWIDTH=0,MARGINHEIGHT=0,SCROLLBARS=1,allowtransparency=true');
	if(window.focus){
		newwindow.focus();
		}
	return false;
} 

$(document).ready(function(){
		
	try { 
		$("#navi_bar").hover(
				function () {
					$("#navi_hover_text").show();
				}, 
				function () {
					$("#navi_hover_text").hide();
				}
		);
	} catch (e) {}
	
	try { 
		$("#navi_map").click(
				function () {
					$("#karte_box").toggle();
				}
		);
	} catch (e) {}
	
	try { 
		$("#karte_schliessen").click(
				function () {
					$("#karte_box").hide();
				}
		);
	} catch (e) {}
	
  
	// panorama starten
	try {	createPlayer();			} catch (e) {}
	
	// sound button starten
	try {	createSoundbutton();	} catch (e) {}
	
	// karte starten
	try {	createMap();			} catch (e) {}

	// fade starten
	try {	$("#from_white").fadeOut("slow");	} catch (e) {}
	
	// mail holen
	//try {	setTimeout('gotmail()', 100);		} catch (e) {}
	try {	gotmail();				} catch (e) {}
})





// image rollover
function roll(img_name, img_src)
   {
   document[img_name].src = img_src;
   }

// load status of new mails
function gotmail() {
	if ( $("#got_mail").length > 0 ) {
		$("#got_mail").load("/myhome/comcenter/mailstatus/new/1/", "", function() {
			/*
			if (document.getElementById('got_mail').innerHTML=='0' || document.getElementById('got_mail').innerHTML=='') {
				$("#got_mail").hide();
			} else {
				$("#got_mail").show();
			}
			*/
			setTimeout('gotmail()', 300000);
		});
	}
}

// upload new user images - called by flash
function openFileDialog(imageId) {
	
	button_container = $('#upload_container').html();
	
	var new_content = $('#upload_container').html();
	new_content = new_content + '<div id="" class="button cancel" onclick="cancelUpload('+imageId+');">'+my_cancel_text+'</div>';
	new_content = new_content + '<div id="" class="button delete" onclick="removeUpload('+imageId+');">'+my_delete_text+'</div>';
	$('#upload_container').html(new_content);
	
	var button = $('#button1'), interval, id;
	id = imageId;
	new Ajax_upload(button,{
		action: '/myhome/data/imageload/id/'+imageId+'/', 
		name: 'upload',
		autoSubmit: true,
		onSubmit: function(file, ext){
			// change button text, when user selects file			
			button.text_old = button.text();
			// If you want to allow uploading only 1 file at time,
			// you can disable upload button
			this.disable();
			// Uploding -> Uploading. -> Uploading...
			interval = window.setInterval(function(){
				var text = button.text();
				if (text.length < 13){
					button.text(text + '.');					
				} else {
					button.text(button.text_old);				
				}
			}, 200);
		},
		onComplete: function(file, response){
			$('#upload_container').hide();
			//button.text('Upload');
			window.clearInterval(interval);
			// enable upload button
			this.enable();
			var flashMovie;
			if (navigator.appName.indexOf("Microsoft") != -1) {
				flashMovie = window["player1"];
			} else {
				flashMovie  = document["player1"];
			}
			//status-code: "complete", "abort", "error", "sizeTooBig"
			var statusCode = "complete";
			flashMovie.onImageUploadStatusAvailable(id, statusCode);
			//alert(file + ' | ' + response + ' | ' + id);
			$('#upload_container').html(button_container);
		}
	});
	$('#upload_container').show();
}

function cancelUpload(id) {
	$('#upload_container').hide();
	var flashMovie;
	if (navigator.appName.indexOf("Microsoft") != -1) {
		flashMovie = window["player1"];
	} else {
		flashMovie  = document["player1"];
	}
	//status-code: "complete", "abort", "error", "sizeTooBig"
	var statusCode = "complete";
	flashMovie.onImageUploadStatusAvailable(id, statusCode);
	//alert(file + ' | ' + response + ' | ' + id);
	$('#upload_container').html(button_container);
}

function removeUpload(id) {
	$('#upload_container').hide();
	$.get("/myhome/data/imageload/delete/"+id+"/", {}, function() {
		var flashMovie;
		if (navigator.appName.indexOf("Microsoft") != -1) {
			flashMovie = window["player1"];
		} else {
			flashMovie  = document["player1"];
		}
		//status-code: "complete", "abort", "error", "sizeTooBig"
		var statusCode = "complete";
		flashMovie.onImageUploadStatusAvailable(id, statusCode);
		//alert(file + ' | ' + response + ' | ' + id);
		$('#upload_container').html(button_container);
	});
}

function modalDialog() {
	//select all the a tag with name equal to modal  
    $('a[name=modal]').click(function(e) { 
    	
        //Cancel the link behavior  
        e.preventDefault();  
        //Get the A tag  
        var id = $(this).attr('href');
        var myid = $(this).attr('myid');
        var mytype = $(this).attr('mytype');
        var mytab = $(this).attr('mytab');
        $('#dialog').attr('myid', myid);
        $('#dialog').attr('mytype', mytype);
        $('#dialog').attr('mytab', $(".modal_tabs li.active_tab").attr('id'));
        if (mytab) {
        	$(".modal_tabs li").removeClass("active_tab");
			$("#"+mytab).addClass("active_tab");
			$("#dialog div.tab_body").hide();
			$("#dialog div."+mytab).show();
			$('#dialog').attr('mytab', mytab);
        }
        $('#contactdata').html('<div class="list_loader"><img src="/img/loader.gif" alt="loading" /></div>');
        $('#comhistory').html('<div class="list_loader"><img src="/img/loader.gif" alt="loading" /></div>');
        if (mytype == 'contact') {
        	mycontacturl = '/partneroffice/recruiting/contactinfo/id/';
        } else {
        	mycontacturl = '/partneroffice/recruiting/accountinfo/id/';
        }
        $('#contactdata').load(mycontacturl+myid+'/'+ Math.random()*99999, {}, function(data){
        		document.getElementById('contactdata').innerHTML = data;
    	});
        $('#comhistory').load('/myhome/comcenter/communicationload/id/'+myid+'/'+ Math.random()*99999, {}, function(data){
        		document.getElementById('comhistory').innerHTML = data;
        });
        
        $("#dialog").show();
        
      
        //Get the screen height and width  
        var maskHeight = $(document).height();  
        var maskWidth = $(window).width();  
      
        //Set heigth and width to mask to fill up the whole screen  
        $('#mask').css({'width':maskWidth,'height':maskHeight});  
          
        //transition effect       
        $('#mask').fadeIn(300);      
        $('#mask').fadeTo(500,0.8);     
      
        //Get the window height and width  
        var winH = $(window).height();  
        var winW = $(window).width();  
                
        //Set the popup window to center  
        $(id).css('top',  winH/2-$(id).height()/2);  
        $(id).css('left', winW/2-$(id).width()/2);  
      
        //transition effect  
        $(id).fadeIn(500);   
        
      
    });  
      
    //if close button is clicked  
    $('.window .close, .window1 .close').click(function (e) {  
        //Cancel the link behavior  
        e.preventDefault();  
        $('#mask, .window').hide();
        $('#mask, .window1').hide();  
    });       
      
    //if mask is clicked  
    $('#mask').click(function () {  
        $(this).hide();  
        $('.window').hide();  
        $('.window1').hide();  
    });		  	
}

function modalDialog_edit_favouritefoods(favgrp_id) {
	//select all the a tag with name equal to modal  
    
	
        $('#fav_form').val('');
     	prod_count_fav['frueh'] = 0;
     	prod_count_fav['zwischen1'] = 0;
     	prod_count_fav['mittag'] = 0 ;
     	prod_count_fav['zwischen2'] = 0;
     	prod_count_fav['abend'] = 0;
     	prod_count_fav['snack'] = 0;
        prod_count_fav['others']=0;
        //Get the A tag  
        var id = '#dialog';
        var myid = favgrp_id;
        
        $('#dialog').attr('myid', myid);
        
        $('#newdata').html('<div class="list_loader"><img src="/img/loader.gif" alt="loading" /></div>');
        
        $('#newdata').load('/coaching/plan/nutritionsfavouritebuild/favgrpid/'+myid);
        
        $('#fav_example').suggest(nutritions_searching(),{
				onSelect: function() {}});
		
      
        //Get the screen height and width  
        var maskHeight = $(document).height();  
        var maskWidth = $(window).width();  
      
        //Set heigth and width to mask to fill up the whole screen  
        $('#mask').css({'width':maskWidth,'height':maskHeight});  
          
        //transition effect       
        $('#mask').fadeIn(300);      
        $('#mask').fadeTo(500,0.8);     
      
        //Get the window height and width  
        var winH = $(window).height();  
        var winW = $(window).width();  
                
        //Set the popup window to center  
        $(id).css('top',  winH/2-$(id).height()/2);  
        $(id).css('left', winW/2-$(id).width()/2);  
      
        //transition effect  
        $(id).fadeIn(500);   
      
  
  //if close button is clicked  
    $('.window .close, .window2 .close').click(function (e) {  
        //Cancel the link behavior 
    	
        e.preventDefault();
       
        $('#mask, .window').hide();
        $('#mask, .window2').hide();
        
    });       
      
    //if mask is clicked  
    /*$('#mask').click(function () {  
        $(this).hide();  
        $('.window').hide();  
        $('.window1').hide();  
    });*/	  	
}

function modalDialog_favouritefoods() {
	//select all the a tag with name equal to modal  
    $('a[name=modal]').click(function(e) { 
    	
        //Cancel the link behavior  
        e.preventDefault();
        $('#fav_form').val('');
     	prod_count_fav['frueh'] = 0;
     	prod_count_fav['zwischen1'] = 0;
     	prod_count_fav['mittag'] = 0 ;
     	prod_count_fav['zwischen2'] = 0;
     	prod_count_fav['abend'] = 0;
     	prod_count_fav['snack'] = 0;
        prod_count_fav['others']=0;
        //Get the A tag  
        var id = $(this).attr('href');
        var myid = $(this).attr('myid');
        
        $('#dialog').attr('myid', myid);
        
        $('#newdata').html('<div class="list_loader"><img src="/img/loader.gif" alt="loading" /></div>');
        
        $('#newdata').load('/coaching/plan/nutritionsfavouritebuild/');
        
      
        //Get the screen height and width  
        var maskHeight = $(document).height();  
        var maskWidth = $(window).width();  
      
        //Set heigth and width to mask to fill up the whole screen  
        $('#mask').css({'width':maskWidth,'height':maskHeight});  
          
        //transition effect       
        $('#mask').fadeIn(300);      
        $('#mask').fadeTo(500,0.8);     
      
        //Get the window height and width  
        var winH = $(window).height();  
        var winW = $(window).width();  
                
        //Set the popup window to center  
        $(id).css('top',  winH/2-$(id).height()/2);  
        $(id).css('left', winW/2-$(id).width()/2);  
      
        //transition effect  
        $(id).fadeIn(500);   
      
    });  
  //if close button is clicked  
    $('.window .close, .window2 .close').click(function (e) {  
    
    	
        //Cancel the link behavior 
    	
        e.preventDefault();
       
        $('#mask, .window').hide();
        $('#mask, .window2').hide();
        
        //set flag of current window to 0
        current_window=0;
        
    });       
      
    //if mask is clicked  
    /*$('#mask').click(function () {  
        $(this).hide();  
        $('.window').hide();  
        $('.window1').hide();  
    });*/	  	
}

function modalDialog_fitness() {
	//select all the a tag with name equal to modal  
    $('a[name=modal]').click(function(e) { 
    	
        //Cancel the link behavior  
        e.preventDefault();  
        //Get the A tag  
        var id = $(this).attr('href');
        var myid = $(this).attr('myid');

        $('#dialog').attr('myid', myid);
        
        $('#newdata').html('<div class="list_loader"><img src="/img/loader.gif" alt="loading" /></div>');
        
        
        $('#newdata').load('/fitness/index/projectplaner/');
        
      
        //Get the screen height and width  
        var maskHeight = $(document).height();  
        var maskWidth = $(window).width();  
      
        //Set heigth and width to mask to fill up the whole screen  
        $('#mask').css({'width':maskWidth,'height':maskHeight});  
          
        //transition effect       
        $('#mask').fadeIn(300);      
        $('#mask').fadeTo(500,0.8);     
      
        //Get the window height and width  
        var winH = $(window).height();  
        var winW = $(window).width();  
                
        //Set the popup window to center  
        $(id).css('top',  winH/2-$(id).height()/2);  
        $(id).css('left', winW/2-$(id).width()/2);  
      
        //transition effect  
        $(id).fadeIn(500);   
        
      
    });  
      
    //if close button is clicked  
    $('.window .close, .window1 .close').click(function (e) {  
        //Cancel the link behavior  
        e.preventDefault();  
        $('#mask, .window').hide();
        $('#mask, .window1').hide();  
    });       
      
    //if mask is clicked  
    $('#mask').click(function () {  
        $(this).hide();  
        $('.window').hide();  
        $('.window1').hide();  
    });	  	
}

function modalDialogAddContacts() {
	//select all the a tag with name equal to modal  
    $('a[name=modalDialogAddContacts]').click(function(e) { 
    	
        //Cancel the link behavior  
        e.preventDefault();  
        //Get the A tag  
        var id = $(this).attr('href');
        var myid = $(this).attr('myid');
        var mytype = $(this).attr('mytype');
        var mytab = $(this).attr('mytab');
        $('#dialogAddContacts').attr('myid', myid);
        $('#dialogAddContacts').attr('mytype', mytype);
        $('#dialogAddContacts').attr('mytab', $(".modal_tabs li.active_tab").attr('id'));
        if (mytab) {
        	$("#dialogAddContacts .modal_tabs li").removeClass("active_tab");
			$("#"+mytab).addClass("active_tab");
			$("#dialogAddContacts div.tab_body").hide();
			$("#dialogAddContacts div."+mytab).show();
			$('#dialogAddContacts').attr('mytab', mytab);
        } else {
        	$("#dialogAddContacts .modal_tabs li").removeClass("active_tab");
			$("#tab_contactadd").addClass("active_tab");
			$("#dialogAddContacts div.tab_body").hide();
			$("#dialogAddContacts div.tab_contactadd").show();
			$('#dialogAddContacts').attr('mytab', 'tab_contactadd');
        }
        $('#contactadd').html('<div class="list_loader"><img src="/img/loader.gif" alt="loading" /></div>');
        //$('#importcsv').html('<div class="list_loader"><img src="/img/loader.gif" alt="loading" /></div>');
        $('#importcsv').html('<iframe src="/partneroffice/recruiting/importcsv2/" width="750" height="400" frameborder="0" scrolling="no"  marginheight="0" marginwidth="0" /></iframe>');
        $('#contactadd').load('/partneroffice/recruiting/contactadd/'+ Math.random()*99999, {}, function(data){
        		document.getElementById('contactadd').innerHTML = data;
    	});
        /*
        $('#importcsv').load('/partneroffice/recruiting/importcsv/'+ Math.random()*99999, {}, function(data){
        		document.getElementById('importcsv').innerHTML = data;
        });
        */
        
        $("#dialogAddContacts").show();
      
        //Get the screen height and width  
        var maskHeight = $(document).height();  
        var maskWidth = $(window).width();  
      
        //Set heigth and width to mask to fill up the whole screen  
        $('#mask').css({'width':maskWidth,'height':maskHeight});  
          
        //transition effect       
        $('#mask').fadeIn(300);      
        $('#mask').fadeTo(500,0.8);     
      
        //Get the window height and width  
        var winH = $(window).height();  
        var winW = $(window).width();  
                
        //Set the popup window to center  
        $(id).css('top',  winH/2-$(id).height()/2);  
        $(id).css('left', winW/2-$(id).width()/2);  
      
        //transition effect  
        $(id).fadeIn(500);   
        
      
    });  
      
    //if close button is clicked  
    $('.window .close, .window1 .close').click(function (e) {  
        //Cancel the link behavior  
        e.preventDefault();  
        $('#mask, .window').hide();
        $('#mask, .window1').hide();  
    });       
      
    //if mask is clicked  
    $('#mask').click(function () {  
        $(this).hide();  
        $('.window').hide();  
        $('.window1').hide();  
    });	  	
}

function modalDialogMailing(attach) {
	//select all the a tag with name equal to modal  
    $('a[name=modalDialogMailing]').click(function(e) { 
    	
        //Cancel the link behavior  
        e.preventDefault();  
        //Get the A tag  
        var id = $(this).attr('href');
        var myid = $(this).attr('myid');
        var mytype = $(this).attr('mytype');
        var mytab = $(this).attr('mytab');
        $('#dialogMailing').attr('myid', myid);
        $('#dialogMailing').attr('mytype', mytype);
        $('#dialogMailing').attr('mytab', $(".modal_tabs li.active_tab").attr('id'));
        if (mytab) {
        	$("#dialogMailing .modal_tabs li").removeClass("active_tab");
			$("#"+mytab).addClass("active_tab");
			$("#dialogMailing div.tab_body").hide();
			$("#dialogMailing div."+mytab).show();
			$('#dialogMailing').attr('mytab', mytab);
        } else {
        	$("#dialogMailing .modal_tabs li").removeClass("active_tab");
			$("#tab_mailing").addClass("active_tab");
			$("#dialogMailing div.tab_body").hide();
			$("#dialogMailing div.tab_mailing").show();
			$('#dialogMailing').attr('mytab', 'tab_mailing');
        }
        $('#mailing').html('<div class="list_loader"><img src="/img/loader.gif" alt="loading" /></div>');
        $('#bzinfo').html('<div class="list_loader"><img src="/img/loader.gif" alt="loading" /></div>');
        $('#bzinfo').load('/partneroffice/recruiting/bzinfo/'+attach+ Math.random()*99999, {}, function(data){
    		document.getElementById('bzinfo').innerHTML = data;
        });
        
        $('#mailing').load('/partneroffice/recruiting/mailingload/'+attach+ Math.random()*99999, {}, function(data){
        		document.getElementById('mailing').innerHTML = data;
        });
        
        $("#dialogMailing").show();

        //Get the screen height and width  
        var maskHeight = $(document).height();  
        var maskWidth = $(window).width();  
      
        //Set heigth and width to mask to fill up the whole screen  
        $('#mask').css({'width':maskWidth,'height':maskHeight});  
          
        //transition effect       
        $('#mask').fadeIn(300);      
        $('#mask').fadeTo(500,0.8);     
      
        //Get the window height and width  
        var winH = $(window).height();  
        var winW = $(window).width();  
        
                
        //Set the popup window to center  
        $(id).css('top',  winH/2-$(id).height()/2);  
        $(id).css('left', winW/2-$(id).width()/2);  
      
        //transition effect  
        $(id).fadeIn(500);   
        
      
    });  
      
    //if close button is clicked  
    $('.window .close, .window1 .close').click(function (e) {  
        //Cancel the link behavior  
        e.preventDefault();  
        $('#mask, .window').hide();
        $('#mask, .window1').hide();  
    });       
      
    //if mask is clicked  
    $('#mask').click(function () {  
        $(this).hide();  
        $('.window').hide();  
        $('.window1').hide();  
    });		  	
}

function modalDialogIncomeplan() {
	//select all the a tag with name equal to modal  
    $('a[name=modalDialogIncomeplan]').click(function(e) { 
    	
        //Cancel the link behavior  
        e.preventDefault();  
        //Get the A tag  
        var id = $(this).attr('href');
        var myid = $(this).attr('myid');
        var mytype = $(this).attr('mytype');
        var mytab = $(this).attr('mytab');
        $('#dialogIncomeplan').attr('myid', myid);
        $('#dialogIncomeplan').attr('mytype', mytype);
        $('#dialogIncomeplan').attr('mytab', $(".modal_tabs li.active_tab").attr('id'));
        if (mytab) {
        	$("#dialogIncomeplan .modal_tabs li").removeClass("active_tab");
			$("#"+mytab).addClass("active_tab");
			$("#dialogIncomeplan div.tab_body").hide();
			$("#dialogIncomeplan div."+mytab).show();
			$('#dialogIncomeplan').attr('mytab', mytab);
        } else {
        	$("#dialogIncomeplan .modal_tabs li").removeClass("active_tab");
			$("#tab_incomeplan").addClass("active_tab");
			$("#dialogIncomeplan div.tab_body").hide();
			$("#dialogIncomeplan div.tab_incomeplan").show();
			$('#dialogIncomeplan').attr('mytab', 'tab_incomeplan');
        }
        $('#incomeplan').html('<div class="list_loader"><img src="/img/loader.gif" alt="loading" /></div>');
        $('#incomeplan').load('/partneroffice/leadership/incomeplanload/'+ Math.random()*99999, {}, function(data){
        		document.getElementById('incomeplan').innerHTML = data;
        });
        
        $("#dialogIncomeplan").show();
      
        //Get the screen height and width  
        var maskHeight = $(document).height();  
        var maskWidth = $(window).width();  
      
        //Set heigth and width to mask to fill up the whole screen  
        $('#mask').css({'width':maskWidth,'height':maskHeight});  
          
        //transition effect       
        $('#mask').fadeIn(300);      
        $('#mask').fadeTo(500,0.8);     
      
        //Get the window height and width  
        var winH = $(window).height();  
        var winW = $(window).width();  
                
        //Set the popup window to center  
        $(id).css('top',  winH/2-$(id).height()/2);  
        $(id).css('left', winW/2-$(id).width()/2);  
      
        //transition effect  
        $(id).fadeIn(500);   
        
      
    });  
      
    //if close button is clicked  
    $('.window .close, .window1 .close').click(function (e) {  
        //Cancel the link behavior  
        e.preventDefault();  
        $('#mask, .window').hide();
        $('#mask, .window1').hide();  
    });       
      
    //if mask is clicked  
    $('#mask').click(function () {  
        $(this).hide();  
        $('.window').hide();  
        $('.window1').hide();  
    });	  	
}

function modalDialogBanner() {
	//select all the a tag with name equal to modal  
    $('a[name=modalDialogBanner]').click(function(e) { 
    	
        //Cancel the link behavior  
        e.preventDefault();  
        //Get the A tag  
        var id = $(this).attr('href');
        var myid = $(this).attr('myid');
        var mytype = $(this).attr('mytype');
        var mytab = $(this).attr('mytab');
        $('#dialogBanner').attr('myid', myid);
        $('#dialogBanner').attr('mytype', mytype);
        $('#dialogBanner').attr('mytab', $(".modal_tabs li.active_tab").attr('id'));
        if (mytab) {
        	$("#dialogBanner .modal_tabs li").removeClass("active_tab");
			$("#"+mytab).addClass("active_tab");
			$("#dialogBanner div.tab_body").hide();
			$("#dialogBanner div."+mytab).show();
			$('#dialogBanner').attr('mytab', mytab);
        } else {
        	$("#dialogBanner .modal_tabs li").removeClass("active_tab");
			$("#tab_banner").addClass("active_tab");
			$("#dialogBanner div.tab_body").hide();
			$("#dialogBanner div.tab_banner").show();
			$('#dialogBanner').attr('mytab', 'tab_banner');
        }
        $('#banner').html('<div class="list_loader"><img src="/img/loader.gif" alt="loading" /></div>');
        $('#banner').load('/partneroffice/recruiting/bannerload/'+ Math.random()*99999, {}, function(data){
        		document.getElementById('banner').innerHTML = data;
        });
        
        $("#dialogBanner").show();
      
        //Get the screen height and width  
        var maskHeight = $(document).height();  
        var maskWidth = $(window).width();  
      
        //Set heigth and width to mask to fill up the whole screen  
        $('#mask').css({'width':maskWidth,'height':maskHeight});  
          
        //transition effect       
        $('#mask').fadeIn(300);      
        $('#mask').fadeTo(500,0.8);     
      
        //Get the window height and width  
        var winH = $(window).height();  
        var winW = $(window).width();  
                
        //Set the popup window to center  
        $(id).css('top',  winH/2-$(id).height()/2);  
        $(id).css('left', winW/2-$(id).width()/2);  
      
        //transition effect  
        $(id).fadeIn(500);   
        
      
    });  
      
    //if close button is clicked  
    $('.window .close, .window1 .close').click(function (e) {  
        //Cancel the link behavior  
        e.preventDefault();  
        $('#mask, .window').hide();
        $('#mask, .window1').hide();  
    });       
      
    //if mask is clicked  
    $('#mask').click(function () {  
        $(this).hide();  
        $('.window').hide();  
        $('.window1').hide();  
    });	  	
}

function modalDialogLandingpages() {
	//select all the a tag with name equal to modal  
    $('a[name=modalDialogLandingpages]').click(function(e) { 
    	
        //Cancel the link behavior  
        e.preventDefault();  
        //Get the A tag  
        var id = $(this).attr('href');
        var myid = $(this).attr('myid');
        var mytype = $(this).attr('mytype');
        var mytab = $(this).attr('mytab');
        $('#dialogLandingpages').attr('myid', myid);
        $('#dialogLandingpages').attr('mytype', mytype);
        $('#dialogLandingpages').attr('mytab', $(".modal_tabs li.active_tab").attr('id'));
        if (mytab) {
        	$("#dialogLandingpages .modal_tabs li").removeClass("active_tab");
			$("#"+mytab).addClass("active_tab");
			$("#dialogLandingpages div.tab_body").hide();
			$("#dialogLandingpages div."+mytab).show();
			$('#dialogLandingpages').attr('mytab', mytab);
        } else {
        	$("#dialogLandingpages .modal_tabs li").removeClass("active_tab");
			$("#tab_landingpages").addClass("active_tab");
			$("#dialogLandingpages div.tab_body").hide();
			$("#dialogLandingpages div.tab_landingpages").show();
			$('#dialogLandingpages').attr('mytab', 'tab_landingpages');
        }
        $('#banner').html('<div class="list_loader"><img src="/img/loader.gif" alt="loading" /></div>');
        $('#banner').load('/partneroffice/recruiting/landingpagesload/'+ Math.random()*99999, {}, function(data){
        		document.getElementById('landingpages').innerHTML = data;
        });
        
        $("#dialogLandingpages").show();
      
        //Get the screen height and width  
        var maskHeight = $(document).height();  
        var maskWidth = $(window).width();  
      
        //Set heigth and width to mask to fill up the whole screen  
        $('#mask').css({'width':maskWidth,'height':maskHeight});  
          
        //transition effect       
        $('#mask').fadeIn(300);      
        $('#mask').fadeTo(500,0.8);     
      
        //Get the window height and width  
        var winH = $(window).height();  
        var winW = $(window).width();  
                
        //Set the popup window to center  
        $(id).css('top',  winH/2-$(id).height()/2);  
        $(id).css('left', winW/2-$(id).width()/2);  
      
        //transition effect  
        $(id).fadeIn(500);   
        
      
    });  
      
    //if close button is clicked  
    $('.window .close, .window1 .close').click(function (e) {  
        //Cancel the link behavior  
        e.preventDefault();  
        $('#mask, .window').hide();
        $('#mask, .window1').hide();  
    });       
      
    //if mask is clicked  
    $('#mask').click(function () {  
        $(this).hide();  
        $('.window').hide();  
        $('.window1').hide();  
    });	  	
}

function initMenu() {
	   $('#navigation ul').hide();
	   $('#navigation ul:first').show();
	   $('#nav_othersports li.tooltip').hide();
	   $('#navigation h3').click(
	   function() {
	   var checkElement = $(this).next();
		   if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
			   return false;
		   }
		   if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
			   $('#navigation ul:visible').slideUp('normal');
			   checkElement.slideDown('normal');
			   return false;
		   }
		  
	   }
	   );
	   $('#navigation h4').click(
	   function() {  
		   
	   var checkElement = $(this).next();
	   		
	   		if((checkElement.is('li.tooltip')) && (checkElement.is(':visible'))) {
	   			$('#nav_othersports li.tooltip:visible').slideUp('normal');
	   			return false;
	   		}
	   		if((checkElement.is('li.tooltip')) && (!checkElement.is(':visible'))) {
	   			$('#nav_othersports li.tooltip:visible').slideUp('normal');
	   			checkElement.slideDown('normal');
	   			while(checkElement.next().is('li.tooltip')){
	   				checkElement = checkElement.next();
	   				checkElement.slideDown('normal');
	   			}
	  			return false;
	   		}
	   	   if((checkElement.is('ul ul')) && (checkElement.is(':visible'))) {
			   return false;
		   }
		   if((checkElement.is('ul ul')) && (!checkElement.is(':visible'))) {
			   $('#navigation ul ul:visible').slideUp('normal');
			   checkElement.slideDown('normal');
			   return false;
		   }
		   }
		   
	   
	   );
	   
	   
	   }

function initMenu2() {
	   $('#navigation ul').hide();
	   $('#navigation h5').click(
	   function() {
	   var checkElement = $(this).next();
		   if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
			   return false;
		   }
		   if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
			   $('#navigation ul:visible').slideUp('normal');
			   checkElement.slideDown('normal');
			   return false;
		   }
		   
	   }
	   );
	   
	   }

function addDroppable(element) {
	
	$('#'+element+' textarea:last').Droppable(
	    	{
		    	
	    		accept : 'dropaccept',
	    		tolerance:		'intersect',
	    		hoverclass: 'fitness_textarea_hover',
	    		ondrop:	function (drag)
	    				{
	    					// nur durchführen, wenn slot noch offen ist
	    					if ($(this).hasClass('fitness_textarea_open')) {
	    						
								if(typeof $(drag).attr('plantext') != 'undefined')
								{
									$(this).val($(drag).attr('plantext'));
								}else{
								
									$(this).val($(drag).html());
								}
								$(this).removeClass('fitness_textarea_open');
								$(this).addClass('fitness_textarea_closed');
								$(this).DroppableDestroy();
		    					$('#'+element+' input:last').val($(drag).attr('id'));
								$('#'+element+' input:last').removeAttr('disabled');
		    					$('#'+element+' a:last').show();
		    					$('#'+element+'').append(
		    							$('#'+element+'_template').html()
				    					);
				    			try{fivesteps_repeat[$(drag).attr('id').substr(1)] = fivesteps_repeat[$(drag).attr('id').substr(1)] -1;}catch(e){}
				    			
				    			if (fivesteps_repeat[$(drag).attr('id').substr(1)] < 0)
				    			{
				    				$('#'+$(drag).attr('id')+'repeat').html('('+0+')');
				    				
				    			}else{
				    				$('#'+$(drag).attr('id')+'repeat').html('('+fivesteps_repeat[$(drag).attr('id').substr(1)]+')');
				    			}
		    					addDroppable(element);
		    					
	    					}
	    				}
	    	}
	    );
}
function addDroppable2(element) {
	
	$('#'+element+' textarea:last').Droppable(
	    	{
		    	
	    		accept : 'dropaccept2',
	    		tolerance:		'intersect',
	    		hoverclass: 'fitness_textarea_uebung_hover',
	    		ondrop:	function (drag)
	    				{
				    		// nur durchführen, wenn slot noch offen ist
							if ($(this).hasClass('fitness_textarea_uebung_open')) {
		    					$(this).val($(drag).html());
								$(this).removeClass('fitness_textarea_uebung_open');
								$(this).addClass('fitness_textarea_uebung_closed');
								$(this).DroppableDestroy();
		    					$('#'+element+' input:last').val($(drag).attr('id'));
								$('#'+element+' input:last').removeAttr('disabled');
		    					$('#'+element+' a:last').show();
		    					$('#'+element+'').append(
		    							$('#'+element+'_template').html()
				    					);
		    					addDroppable2(element);
							}
	    				}
	    	}
	    );
}


/**
*
*  Javascript trim, ltrim, rtrim
*  http://www.webtoolkit.info/
*
* Without the second parameter, Javascript function will trim these characters:
    * " " (ASCII 32 (0x20)), an ordinary space.
    * "\t" (ASCII 9 (0x09)), a tab.
    * "\n" (ASCII 10 (0x0A)), a new line (line feed).
    * "\r" (ASCII 13 (0x0D)), a carriage return.
    * "\0" (ASCII 0 (0x00)), the NUL-byte.
    * "\x0B" (ASCII 11 (0x0B)), a vertical tab.
*
**/
 
function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

function isValidEmailAddress(emailAddress) {
//	var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
	var pattern = new RegExp(/^[a-z0-9]+([_\.-]?[a-z0-9]+)*@[a-z0-9àáâãäåæçèéêëðìíîïñòóôõöøþùúûüýÿ]+([\.-]?[a-z0-9]+)*(\.[a-z]{2,4})+$/i);
	return pattern.test(emailAddress);
}

/**
 * This function could be used for cast the link for nonkeep-alive user for magento,
 * redirect to our urlcast function for produce a seesiontoken and send user to magento with session-token
 * 
 * @param prefix
 * @param theUrls
 * 
 * @return
 */

function castUrl(prefix,theUrls) {
	
	if(theUrls.length) {

		for(i = 0; i < theUrls.length; i++) {
			
			current_need_checked_url = theUrls[i];
			
			$("a[href^=" + current_need_checked_url+"]").attr('href',  function(){
				
				this.href = prefix + encodeURIComponent(this.href);
				
			});	
		}
		
		
	} 
}
