function galeryAddFolder(){
    if (document.getElementById('gnf').g_Free) {
    	
    
    	if (document.getElementById('gnf').g_Free.checked) {
    		root=encodeURIComponent('Free');
    	} else if (document.getElementById('gnf').g_MO.checked) {
    		root=encodeURIComponent('For members');
    	} else if (document.getElementById('gnf').g_FAN.checked) {
    		root=encodeURIComponent('Fan club');
    	} else {
    		return false;
    	}
    	
    } else {
        var root=encodeURIComponent( (document.getElementById('gnf').g_CB.value) );
    }

    obj = new Object;
    header = new Object;
    header["Content-Type"] = "application/x-www-form-urlencoded";
    obj["method"] = "POST";
    str ='g_new_folder='+encodeURIComponent(document.getElementById('gnf').g_new_folder.value)+
        '&g_new_folder_desc='+encodeURIComponent(document.getElementById('gnf').g_new_folder_desc.value)+
        '&g_new_folder_keyword='+encodeURIComponent(document.getElementById('gnf').g_new_folder_keyword.value)+
        '&g_new_folder_add='+encodeURIComponent(document.getElementById('gnf').g_new_folder_add.value)+
        '&g_action='+encodeURIComponent(document.getElementById('gnf').g_action.value)+
        '&g_model='+encodeURIComponent(document.getElementById('gnf').g_model.value)+
        '&g_root='+root;
    obj["postData"] = str;
    obj["headers"] = header;
    return obj;
}


// ajaxos hívásnál 
function prettyLoad() {
	$("a[rel^='prettyPhoto']").prettyPhoto({animation_speed:'normal',theme:'facebook',slideshow:5000, autoplay_slideshow: false,social_tools:''});
	$(".gallery:first a[rel^='prettyPhoto']").prettyPhoto({animation_speed:'normal',theme:'facebook',slideshow:5000, autoplay_slideshow: false,social_tools:''});
	$(".gallery:gt(0) a[rel^='prettyPhoto']").prettyPhoto({animation_speed:'fast',slideshow:10000, autoplay_slideshow: false,hideflash: true,social_tools:''});
}


/**
 * Flash multiUploader objektum
 *  
 * @author Molnar Gabor 2011.06.30
 *
 */
var multiUploaderGalery = {
	
	/**
	 * visszaadja az aktualis session azonositot.
	 *
	 * @author Molnar Gabor 2011.06.30
	 *
	 * @return string SessionId
	 */
	getPHPSessionId : function() {
		var start=document.cookie.lastIndexOf('PHPSESSID=');
	    var cookies=document.cookie.substr(start+10,document.cookie.length);
	    var end=cookies.indexOf(';');
	    if (end!=-1) {
	    	return cookies.substr(0,end);
	    } else {
	    	return cookies;
	    }
	},
	
	/**
	 * frissiti a bal oldali konyvtarlistat, az uj albumdarabszamnak megfeleloen.
	 *
	 * @author Molnar Gabor 2011.06.30
	 *
	 * @return void
	 */
	refreshGaleryText : function(i,t,rootId,rootText) {
		$('a#'+i).html(t); 
		$('a#'+rootId).html(rootText); 
	},
	
	/**
	 * Frissiti a flash uploadert tartamazo keretet.
	 *
	 * @author Molnar Gabor 2011.06.30
	 *
	 * @param int height new Flash height
	 *
	 * @return void
	 */
	galeryUploaderSetHeight : function(height) {
		$('.multiGaleryUploader').height(height);
		$('.multiGaleryUploaderEmbed').height(height);
		if (height>480) {
			$('#galery_main_border').height($('#galery_main_border').height()+(height-480));
			$('#galery_content').height($('#galery_content').height()+(height-480));
		}
	},
	
	// a feltöltés végeztével ezt a fv-t hívja meg a flash
	uploadSuccess : function(rootId,rootText,model) {
		
		$.ajax({
				type: 'POST',
				url: '/ajax/galery.php?model='+model+'&action=getimages',
				success: function(data) {
					$('#galery_content').html(data);
				},
				failure: function() {
					alert('Error while loading! Please try again.');
				}
		});
	}
};

var delUri = "";
function notEmptyDirConfirm(p) {
	delUri = p;
	$.jqDialog.confirm("The directory is not empty! Are you sure?",
		function() {
			eval(delUri);
		},
		function() {
			
		}
	);
}


