/****************************************************************************************************** 
 * JavaScript file for Ajax.Request on Member Profile page
 *
 * author: Slavisa Miljanovic <slavisa.miljanovic@softserbia.com>
 * 
 */

    function user_click_on_image(param1, param2, param3 ) {
    
        // param1 can be: '0', '' or from JSdata Array
        // param2 can be: 'redir' or 'gallery'
        // param3 can be: 'auswahl', 'album', '18', 'album_1', 'album_2', 'album_3' 
    
        var params = 'image_id=' + param1 + '&action_type=' + param2;
        redir_album_type = param3;
//        alert(params);
//        alert(redir_album_type);

        if (redir_album_type != '') {
            var ajax = new Ajax.Request(JSdata['siteUrl'] + "/member_profile/showimage", {method: 'get', parameters: params, onComplete: function(e) {redir_after_image_click(e);} });
        } else {
            var ajax = new Ajax.Request(JSdata['siteUrl'] + "/member_profile/showimage", {method: 'get', parameters: params, onSuccess: function(transport) {var response = transport.responseText; document.getElementById('photo_box').innerHTML = response;}, onFailure: function() {alert('... Error Loading Image ...');} });
        }    
    } 

    function redir_after_image_click(e) {
        
        switch (redir_album_type) {
            
            case 'auswahl':
                window.location.href = JSdata['siteUrl'] + "/member_profile/index/memberId/" + JSdata['user'] + "/tabAction/pics/";
                break;

            case 'album':
                window.location.href = JSdata['siteUrl'] + "/member_profile/index/memberId/" + JSdata['user'] + "/tabAction/pics/viewAlbum/true";
                break;

            case '18':
                window.location.href = JSdata['siteUrl'] + "/member_profile/index/memberId/" + JSdata['user'] + "/tabAction/pics/viewHardCore/true";
                break;

            case 'album_1':
                window.location.href = JSdata['siteUrl'] + "/member_profile/index/memberId/" + JSdata['user'] + "/tabAction/pics/viewAlbum1/true";
                break;

            case 'album_2':
                window.location.href = JSdata['siteUrl'] + "/member_profile/index/memberId/" + JSdata['user'] + "/tabAction/pics/viewAlbum2/true";
                break;

            case 'album_3':
                window.location.href = JSdata['siteUrl'] + "/member_profile/index/memberId/" + JSdata['user'] + "/tabAction/pics/viewAlbum3/true";
                break;
            
            default:
                break;
        }
    }

