$(document).ready(function (){

	var f1 = $("div #diviframe")[0];
	//f1.attachEvent ? f1.attachEvent('onload',onFrameLoad);
	function onFrameLoad(){
		alert('da');
	};
	//alert("aaaaa");
	//f1.addEventListener('load',onFrameLoad,false);
	

	// menu
	$(".menu-item").each(function(){
		
      $(this).mouseover(function() {
        $(this).find(".dropdown").addClass("submenu-ul");
        $(this).find(".dropdown").css("display","block");
      });
      $(this).mouseout(function() {
        $(this).find(".dropdown").css("display","none");
      });
		
	});
   //alert("dsa sda");	
	// search
	/*
    $('div#navigation form fieldset a').click(function() {
        $('#keyword-filter').toggle();
        return false;
    });    

    $('ul#keyword-filter li input').click(function() {
        $("#keyword-filter").hide('normal');    
    })
	*/ 
    // open/close shortcuts
    $(".shortcuts-on").each(function(){
    	
    	var parent = $(this);
    	
    	$(this).find(".close").each(function(){
	    	$(this).click(function() {
				$(".shortcuts-off").css("display","block");    		
				parent.hide("normal");				
	    	});    		
    	})
    });

    $(".shortcuts-off").each(function(){
    	$(this).click(function(){
	    	$(".shortcuts-on").show("slow");
	    	$(this).toggle();    		
    	});
    });
//alert('bbb');
    
    // messages
    $('table#messagelist td.subject a').click(function() {
        var at = $(this).attr('id').split('-');    
        $('#message-info-'+at[1]).hide();
        $('#message-details-'+at[1]).show();
        return false;
    });

    $('.close-message').click(function() {
        var at = $(this).attr('id').split('-'); 
        $('#message-info-'+at[2]).show();
        $('#message-details-'+at[2]).hide();
        return false;
    });	
/*
    $("#example").tabs();

    $("#accordion").accordion({
			header: "h3"
    });
*/
//tomy :
	$('div.feed-box-home a#recent-trips').click(function(event) {
		$('div.feed-box-home ul#notes').hide();
		$('div.feed-box-home ul#trips').show();
		$('div.feed-box-home a#recent-notes').removeClass("on");
		$(this).addClass("on");
		event.preventDefault();
		
	});
	$('div.feed-box-home a#recent-notes').click(function(event) {
		$('div.feed-box-home ul#notes').show();
		$('div.feed-box-home ul#trips').hide();
		$('div.feed-box-home a#recent-trips').removeClass("on");
		$(this).addClass("on");
		event.preventDefault();

	});
	$('div.feed-container a.scroll-up').click(function(event) {
		$('div.feed-container ul.info').hide();
		$('div.feed-container a.expand').hide();
		event.preventDefault();
	});
	$('div.feed-container a.scroll-down').click(function(event) {
		$('div.feed-container ul.info').show();
		$('div.feed-container a.expand').show();
		event.preventDefault();
	});

	$('div#content ul.multimedia-list#multimedia_photo img').click(function(event){
		var container = $('div.post-content img#img_container');
		var img_mare = $('div#photo_mare img#' + $(this).attr('id'));
		container.attr('src',img_mare.attr('src'));
	});

// tags in trip homepage
	$('div#sidebar div.tags a.tag').click(function(event) {
		event.preventDefault();
	});
 	$('div#note_photos a').click(function(event){
					event.preventDefault() });
 	$('div#trip_photos a').click(function(event){
					event.preventDefault() });
// multimedia show big pictures
	//$('a#multimedia-show').click(function(event){
		//$('img(
// test img change local
	$('input#form_trip_trip_photo').change(function(event) {
		//alert($(this).attr('nodeName'));
		//$('img#trip_img').attr('src',$(this).attr('path'));
	});
//test img holder
	//$('div#fragment-1 a#img-holder').click(function(event){
		//alert($('input#tgroup_tgroup_image').html());
		//$('img#img1').value()
	//	event.preventDefault();
	//});
// test inchide/deschide all document -ok
/*	$('div.container div.box ul.scroll a.scroll-down').click(function(event){
		var t = $(this).parent().parent().parent().children('ul.thumbs').show();
		var t2 = $(this).parent().parent().parent().children('ul.thumbs-multimedia').show();
		var t3 = $(this).parent().parent().parent().children('ul.multimedia-list').show();
	});
	$('div.container div.box ul.scroll a.scroll-up').click(function(event){
		var t = $(this).parent().parent().parent().children('ul.thumbs').hide();
		var t2 = $(this).parent().parent().parent().children('ul.thumbs-multimedia').hide();
		var t3 = $(this).parent().parent().parent().children('ul.multimedia-list').hide();
	});
*/
	$('div.container div.box ul.scroll a.scroll-down').removeAttr('href');
	$('div.container div.box ul.scroll a.scroll-up').removeAttr('href');
// test click search input
	//$('div#navigation form fieldset input').click(function(){
		//$(this).select();
	//});
// inchide/deschide - homepage
/* s-au scos butoanele
	$('div.feed-container-home div.feed-box-home ul.scroll a.scroll-down').click(function(event){
		$(this).parent().parent().parent().children('ul.new-users').show();
	});	
	$('div.feed-container-home div.feed-box-home ul.scroll a.scroll-up').click(function(event){
		$(this).parent().parent().parent().children('ul.new-users').hide();
	});
	
	$('div.feed-container-home.last div.feed-box-home ul.scroll a.scroll-down').click(function(event){
		var trips = $(this).parent().parent().parent().children('ul#trips');
		var posts = $(this).parent().parent().parent().children('ul#notes');
		if($(this).parent().parent().parent().children('ul.title li a#recent-trips').attr('class') == 'on')
			trips.show();
		else
			posts.show();
	});	
	$('div.feed-container-home.last div.feed-box-home ul.scroll a.scroll-up').click(function(event){
		var trips = $(this).parent().parent().parent().children('ul#trips').hide();
		var posts = $(this).parent().parent().parent().children('ul#notes').hide();
	});	
*/
});
function checkRelogin(data){
	if(!!data.status == false)
		return;
	if(data.status == 'relogin')
		eval(data.script);
}
