$().ready(function(){ 

	 $(".aufeinenblick").mouseover (
	    function () {$("#show_all_layer").show();}
	  )
	  $(".aufeinenblick").mouseout (
	    function () {$("#show_all_layer").hide();}
	  )
	  $("#show_all_layer").mouseover (
	    function () {$("#show_all_layer").show();}
	  )
	  $("#show_all_layer").mouseout (
	    function () {$("#show_all_layer").hide();}
	  )
	
	  $(".erweitertesuchelink").click (
	    function () {$("#advanced_search_overlay").toggle();}
	  )
	  
		$("#tabs").tabs();
		$("#tabs_event").tabs();
	
	  $('#head').cycle({ 
		  fx:     'fade',
		  pager:  '.head_switch',
		  speed:  '1000',
		  timeout:'5000'
	  });
	  
	  $('#widget_one_meldungen').cycle({ 
		  fx:     'fade',
		  speed:  '1000',
		  timeout:'5000'
	  });
	
	  $(".aeb_show_head a,.aeb_close_head a").click (
		    function () {
		      $(this).parent().parent().find(".aeb_infos").toggle();
		      $(this).toggleClass("close");
	  })
		
	
	  $(".showInterschutzInfo").click(function(e){ 
		e.preventDefault();
		showInterschutzInfo();
	  });
	  
	  
	  $(".showInterschutzInfoEventAddition").click(function(e){ 
		e.preventDefault();
		showInterschutzInfoEventAddition(this);
	  });
	
});

function showInterschutzInfo()
{
	var infoContainer = $('<div style="text-align:center;"><img width="478" height="163" alt="retter.tv - INTERSCHUTZ 2010" src="/pu_interschutz/images/dialog_switch.gif" /><br />Erstellen Sie jetzt einen Beitrag zur INTERSCHUTZ auf retter.tv, dem Portal f&uuml;r Helfer und Retter.<br />Schildern Sie Ihre Messe-Eindr&uuml;cke und ver&ouml;ffentlichen Sie eigene Bilder und Videos.<br />Alle Beitr&auml;ge zur INTERSCHUTZ werden automatisch auch auf INTERSCHUTZ LIVE dargestellt.<br /><br /><div class="button_grey btn_right" style="width:200px;"><a href="/link.php?puid=1&pageid=10&param=action=interschutz" target="_blank">eigenen Beitrag erstellen</a></div>').attr('id', 'infoContainer');
        
    infoContainer.appendTo(document.body);
    $('#infoContainer').dialog({
        title: 'interschutz.retter.tv',
        open: function(){
             //$('.ui-dialog-titlebar').corner("top 5px");
        },
        close: function() {
            $(this).remove();
        },
        modal: true,
        overlay: {
          opacity: 0.5,
          background: "black"
        },
        height: 350,
        width: 580
    });
    
}

function showInterschutzInfoEventAddition(obj)
{
	var infoContainer = $('<div style="text-align:center;"><img width="478" height="163" alt="retter.tv - INTERSCHUTZ 2010" src="/pu_interschutz/images/dialog_switch.gif" /><br />Erg&auml;nzen Sie jetzt zu diesem Beitrag Ihre eigenen Bilder und Videos auf retter.tv, dem Portal f&uuml;r Helfer und Retter. Alle Beitr&auml;ge, Fotos und Videos zur INTERSCHUTZ werden automatisch auch auf INTERSCHUTZ LIVE dargestellt.<br /><br /><div class="button_grey btn_right" style="width:250px;"><a href="'+$(obj).attr("href")+'" target="_blank">Bilder und Videos hinzuf&uuml;gen</a></div>').attr('id', 'infoContainer');
        
    infoContainer.appendTo(document.body);
    $('#infoContainer').dialog({
        title: 'interschutz.retter.tv',
        open: function(){
             //$('.ui-dialog-titlebar').corner("top 5px");
        },
        close: function() {
            $(this).remove();
        },
        modal: true,
        overlay: {
          opacity: 0.5,
          background: "black"
        },
        height: 350,
        width: 550
    });
    
}


function socialLink(service){
	var title = escape(document.title);
	var url = escape(document.URL);
	window.open('/social_links.php?service='+service+'&title='+title+'&url='+url);
	
	return false;
}

function getIdFromClass(className, subClassName){
	classNameArray = className.split(" ");
	for(i=0; i< classNameArray.length; i++ ){
		var className = classNameArray[i];
		var position = className.search(subClassName);
		if( position != -1){
			//extract the id
			return className.replace(subClassName,"");
		}
	}
	
	return 0;
}

