function fncFrameBodyCommon () {
    this.getStatus = function ( target, status ) {
        if ( status == true ) {
            $(target + "_frame_button_open").removeClass("frame_button_open");
            $(target + "_frame_button_open").addClass("frame_button_close");
            $(target + "_frame_body").slideDown("fast");
            return false;
        } else {
            $(target + "_frame_button_open").removeClass("frame_button_close");
            $(target + "_frame_button_open").addClass("frame_button_open");
            $(target + "_frame_body").slideUp("fast");
            return true;
        }
    }
    this.basicFrame = function () {
        //ターゲットフレームタイトル
        $(this.target + "_frame_header_title").text( this.title );

        status		= this.status;
        statusName	= this.statusName;

        //初期状態
        this.status = this.getStatus( this.target, this.status );

        //開閉ボタン
        toggleOpenButton = function ( obj ) {
            return function() {
                $.cookie( obj.statusName, obj.status );
                obj.status = obj.getStatus( obj.target, obj.status );
            }
        }
        $(this.target + "_frame_button_open").click( toggleOpenButton( this ) );
    }
    this.toggleListButton = function ( obj, viewStatus ) {
        return function() {
            $.cookie( obj.viewStatusName, viewStatus );
            obj.viewStatus = viewStatus;
            obj.getList();
        }
    }
}

function fncFrameBodyUser  () {
    this.getList = function() {
            //リストをクリア
            $( this.target + '_frame_body' ).empty();

            var myData;
            var total = this.total;
            var target = this.target;
            var viewStatus = this.viewStatus;
            var maxColumns = this.maxColumns;
            var args        = this.args;

            //XML読み込み
            $.ajax({
                dataType: "JSONP",
                cache: true,
                url: this.xmlFile,
                success: function (data) {
                    myData = data;
                    view();
                }
            });

            function view(){
                myData = eval( 'json=' + myData );
                total = myData.channel.total;
                if (total == 0){
                    $( target + '_frame_body' ).append ( UtlColumnView.columnEmpty() );
                    return true;
                }
                if ( viewStatus == true ) {
                        if ( total == 1 || myData.channel.item.length == undefined ) {
                                        items = UtlColumnView.pickupThumbnails ( myData.channel.item );
                                        $( target + '_frame_body' ).append ( items );
                        } else if ( total > 1 ) {
                                var j = 1;
                                for( var i=0; i < myData.channel.item.length; i++ ){
                                        if ( maxColumns > i ) {
                                                var items;
                                                items = UtlColumnView.pickupThumbnails ( myData.channel.item[i] );
                                                if ( j == 4 ) {
                                                        items += '<div class="c-both"></div>';
                                                        j = 1;
                                                } else {
                                                        j += 1;
                                                }
                                                $( target + '_frame_body' ).append ( items );
                                        }
                                }
                        }
                } else {
                        if ( total == 1 || myData.channel.item.length == undefined ) {
                                        items = UtlColumnView.pickupThumbnailList ( myData.channel.item );
                                        $( target + '_frame_body' ).append ( items );
                        } else if ( total > 1 ) {
                                for( var i=0; i < myData.channel.item.length; i++ ){
                                        if ( maxColumns > i ) {
                                                var items;
                                                items = UtlColumnView.pickupThumbnailList ( myData.channel.item[i] );
                                                $( target + '_frame_body' ).append ( items );
                                        }
                                }
                        }
                }
                $( target + '_frame_body' ).append ( '<div class="c-both"></div>' );

                if (args != undefined) {
                       args.pageNumber		= Math.ceil (total / maxColumns);
                      //ページング
                       pagingSet = new fncPagingSet( args );
                       $('#'+args.pgTarget).html( pagingSet.getPagingSet() );
                }
            }
        }
}
fncFrameBodyUser.prototype = new fncFrameBodyCommon;


function fncFrameBodyMovie () {
    this.getList = function () {
        //リストをクリア
        $( this.target + '_frame_body' ).empty();

        var myData;
        var total       = this.total;
        var target      = this.target;
        var viewStatus  = this.viewStatus;
        var maxColumns  = this.maxColumns;
        var args        = this.args;
        var edit        = this.edit;

        //XML読み込み
        $.ajax({
            dataType: "JSONP",
            cache: false,
            url: this.xmlFile,
            success: function (data) {
                myData = data;
                view();
            }
        });

        function view(){
            myData = eval( 'json=' + myData );
            total = myData.channel.total;
            if (total == 0){
                $( target + '_frame_body' ).append ( UtlColumnView.columnEmpty() );
                return true;
            }
            if ( viewStatus == true ) {
                    if ( total == 1 || myData.channel.item.length == undefined ) {
                        if (edit == true){
                            items = UtlColumnView.movieThumbnailsEdit ( myData.channel.item );
                        } else {
                            items = UtlColumnView.movieThumbnails ( myData.channel.item );
                        }
                        $( target + '_frame_body' ).append ( items );
                    } else if ( total > 1 ) {
                        var j = 1;
                        if( myData.channel.item.length == undefined ) {
                            if( myData.channel.item.md5Id != '' ){
                                if (edit == true){
                                    items = UtlColumnView.movieThumbnailsEdit ( myData.channel.item );
                                } else {
                                    items = UtlColumnView.movieThumbnails ( myData.channel.item );
                                }
                                $( target + '_frame_body' ).append ( items );
                            }
                        } else {
                            for( var i=0; i < myData.channel.item.length; i++ ){
                                if ( maxColumns > i ) {
                                    var items;
                                    if (edit == true){
                                        items = UtlColumnView.movieThumbnailsEdit ( myData.channel.item[i] );
                                    } else {
                                        items = UtlColumnView.movieThumbnails ( myData.channel.item[i] );
                                    }
                                    if ( j == 4 ) {
                                            items += '<div class="c-both"></div>';
                                            j = 1;
                                    } else {
                                            j += 1;
                                    }
                                    $( target + '_frame_body' ).append ( items );
                                }
                            }
                        }
                    }
            } else {
                if ( total == 1 || myData.channel.item.length == undefined ) {
                    items = UtlColumnView.movieThumbnailList ( myData.channel.item );
                    $( target + '_frame_body' ).append ( items );
                } else if ( total > 1 ) {
                    for( var i=0; i < myData.channel.item.length; i++ ){
                        if ( maxColumns > i ) {
                            var items;
                            items = UtlColumnView.movieThumbnailList ( myData.channel.item[i] );
                            $( target + '_frame_body' ).append ( items );
                        }
                    }
                }
            }
            $( target + '_frame_body' ).append ( '<div class="c-both"></div>' );

             if (args != undefined) {
                args.pageNumber		= Math.ceil (total / maxColumns);
               //ページング
                pagingSet = new fncPagingSet( args );
                if (args.pgTarget == undefined) {
                    $('#pagingArea').html( pagingSet.getPagingSet() );
                } else {
                    $('#'+args.pgTarget).html( pagingSet.getPagingSet() );
                }
             }
        }
    }
}
fncFrameBodyMovie.prototype = new fncFrameBodyCommon;

function fncFrameBodyMovieSizeS () {
	this.getList = function () {
		//リストをクリア
		$( this.target + '_frame_body' ).empty();

                var myData;
		var target      = this.target;
		var viewStatus  = this.viewStatus;
		var maxColumns  = this.maxColumns;
                var args        = this.args;

		//XML読み込み
                $.ajax({
                    dataType: "JSONP",
                    cache: true,
                    url: this.xmlFile,
                    success: function (data) {
                        myData = data;
                        view();
                    }
                });

                function view(){
                    myData = eval( 'json=' + myData );
                    total = myData.channel.total;
                    if (total == 0){
                        $( target + '_frame_body' ).append ( UtlColumnView.columnEmpty() );
                        return true;
                    }
                    if ( viewStatus == true ) {
                            if ( total == 1 || myData.channel.item.length == undefined ) {
                                            items = UtlColumnView.movieThumbnailsSizeS ( myData.channel.item );
                                            $( target + '_frame_body' ).append ( items );
                            } else if ( total > 1 ) {
                                    var j = 1;
                                    for( var i=0; i < myData.channel.item.length; i++ ){
                                            if ( maxColumns > i ) {
                                                    var items;
                                                    items = UtlColumnView.movieThumbnailsSizeS ( myData.channel.item[i] );
                                                    if ( j == 2 ) {
                                                            items += '<div class="c-both"></div>';
                                                            j = 1;
                                                    } else {
                                                            j += 1;
                                                    }
                                                    $( target + '_frame_body' ).append ( items );
                                            }
                                    }
                            }
                    } else {
                            if ( total == 1 || myData.channel.item.length == undefined ) {
                                            items = UtlColumnView.movieThumbnailListSizeS ( myData.channel.item );
                                            $( target + '_frame_body' ).append ( items );
                            } else if ( total > 1 ) {
                                    for( var i=0; i < myData.channel.item.length; i++ ){
                                            if ( maxColumns > i ) {
                                                    var items;
                                                    items = UtlColumnView.movieThumbnailListSizeS ( myData.channel.item[i] );
                                                    $( target + '_frame_body' ).append ( items );
                                            }
                                    }
                            }
                    }
                    $( target + '_frame_body' ).append ( '<div class="c-both"></div>' );

                    if (args != undefined) {
                           args.pageNumber		= Math.ceil (total / maxColumns);
                          //ページング
                           pagingSet = new fncPagingSet( args );
                           $('#'+args.pgTarget).html( pagingSet.getPagingSet() );
                    }
            }
    }
}
fncFrameBodyMovieSizeS.prototype = new fncFrameBodyCommon;


function fncFrameBodySimpleColumn () {
	this.getList = function () {
		//リストをクリア
		$( this.target + '_frame_body' ).empty();
		//XML読み込み
		var item = { url : this.xmlFile };
		var myData = utl.getDataWithAjax( item );

		target = this.target;
		maxColumns = this.maxColumns;

		$(myData).find("item ").each(function( i ){
			if ( maxColumns > i ) {
				var items;
				items = UtlColumnView.newColumn ( $(this) );
				$( target + '_frame_body' ).append ( items );
			}
		});
		$( target + '_frame_body' ).append ( '<div class="c-both"></div>' );
	}
}
fncFrameBodySimpleColumn.prototype = new fncFrameBodyCommon;

function fncFrameBodyRankingPopC () {
	this.getList = function () {
		//リストをクリア
		$( this.target + '_frame_body' ).empty();
		//XML読み込み
		var item = { url : this.xmlFile };
		var myData = utl.getDataWithAjax( item );

		this.total;	//全件数
		target = this.target;
		maxColumns = this.maxColumns;

		//ランキング種リンク
		var link;
		link  = '<div id="ranking_navi_box">';
		link += '	<div id="ranking_navi_type">';
		link += '		再生回数ランキング作品別｜';
		link += '		<a href="./?o=u&r=pop">再生回数ランキングユーザ別</a>｜';
//		link += '		<a href="./?o=c&r=fav">お気に入りランキング作品別</a>｜';
//		link += '		<a href="./?o=u&r=fav">お気に入りランキングユーザ別</a>';
		link += '	</div>';
		link += '	<div id="ranking_navi_term">';
		link += '		<a href="./?o=c&r=pop&t=d">日ごと(1ケ月以内の投稿)</a>｜';
		link += '		<a href="./?o=c&r=pop&t=w">週ごと(1ケ月以内の投稿)</a>｜';
		link += '		<a href="./?o=c&r=pop&t=m">月ごと(全期間)</a>';
		link += '	</div>';
		link += '</div>';
		$( target + '_frame_body' ).append( link );

		this.total = $(myData).find("total").text();
		if ( this.viewStatus == true ) {
			var j = 1;
			$(myData).find("item").each(function( i ){
				if ( maxColumns > i ) {
					var items;
					items = UtlColumnView.rankingPopCThumbnails ( $(this) );
					if ( j == 4 ) {
						items += '<div class="c-both"></div>';
						j = 1;
					} else {
						j += 1;
					}
					$( target + '_frame_body' ).append( items );
				}
			});
		} else {
			$(myData).find("item ").each(function( i ){
				if ( maxColumns > i ) {
					var items;
					items = UtlColumnView.rankingPopCList( $(this) );
					$( target + '_frame_body' ).append( items );
				}
			});
		}
		$( target + '_frame_body' ).append( '<div class="c-both"></div>' );
	}
}
fncFrameBodyRankingPopC.prototype = new fncFrameBodyCommon;

function fncFrameBodyRankingFavC () {
	this.getList = function () {
		//リストをクリア
		$( this.target + '_frame_body' ).empty();
		//XML読み込み
		var item = { url : this.xmlFile };
		var myData = utl.getDataWithAjax( item );

		this.total;	//全件数
		target = this.target;
		maxColumns = this.maxColumns;

		//ランキング種リンク
		var link;
		link  = '<div id="ranking_navi_box">';
		link += '	<div id="ranking_navi_type">';
		link += '		<a href="./?o=c&r=pop">再生回数ランキング作品別</a>｜';
		link += '		<a href="./?o=u&r=pop">再生回数ランキングユーザ別</a>｜';
//		link += '		お気に入りランキング作品別｜';
//		link += '		<a href="./?o=u&r=fav">お気に入りランキングユーザ別</a>';
		link += '	</div>';
		link += '	<div id="ranking_navi_term">';
		link += '		<a href="./?o=c&r=fav&t=d">日ごと</a>｜';
		link += '		<a href="./?o=c&r=fav&t=w">週ごと</a>｜';
		link += '		<a href="./?o=c&r=fav&t=m">月ごと</a>';
		link += '	</div>';
		link += '</div>';
		$( target + '_frame_body' ).append( link );

		this.total = $(myData).find("total").text();
		if ( this.viewStatus == true ) {
			var j = 1;
			$(myData).find("item ").each(function( i ){
				if ( maxColumns > i ) {
					var items;
					items = UtlColumnView.rankingFavCThumbnails( $(this) );
					if ( j == 4 ) {
						items += '<div class="c-both"></div>';
						j = 1;
					} else {
						j += 1;
					}
					$( target + '_frame_body' ).append( items );
				}
			});
		} else {
			$(myData).find("item ").each(function( i ){
				if ( maxColumns > i ) {
					var items;
					items = UtlColumnView.rankingFavCList( $(this) );
					$( target + '_frame_body' ).append( items );
				}
			});
		}
		$( target + '_frame_body' ).append( '<div class="c-both"></div>' );
	}
}
fncFrameBodyRankingFavC.prototype = new fncFrameBodyCommon;

function fncFrameBodyRankingPopU () {
	this.getList = function () {
		//リストをクリア
		$( this.target + '_frame_body' ).empty();
		//XML読み込み
		var item = { url : this.xmlFile };
		var myData = utl.getDataWithAjax( item );

		this.total;	//全件数
		target = this.target;
		maxColumns = this.maxColumns;

		//ランキング種リンク
		var link;
		link  = '<div id="ranking_navi_box">';
		link += '	<div id="ranking_navi_type">';
		link += '		<a href="./?o=c&r=pop">再生回数ランキング作品別</a>｜';
		link += '		再生回数ランキングユーザ別｜';
//		link += '		<a href="./?o=c&r=fav">お気に入りランキング作品別</a>｜';
//		link += '		<a href="./?o=u&r=fav">お気に入りランキングユーザ別</a>';
		link += '	</div>';
		link += '	<div id="ranking_navi_term">';
		link += '		<a href="./?o=u&r=pop&t=d">日ごと</a>｜';
		link += '		<a href="./?o=u&r=pop&t=w">週ごと</a>｜';
		link += '		<a href="./?o=u&r=pop&t=m">月ごと</a>';
		link += '	</div>';
		link += '</div>';
		$( target + '_frame_body' ).append( link );

		this.total = $(myData).find("total").text();
		if ( this.viewStatus == true ) {
			var j = 1;
			$(myData).find("item ").each(function( i ){
				if ( maxColumns > i ) {
					var items;
					items = UtlColumnView.rankingPopUThumbnails( $(this) );
					if ( j == 4 ) {
						items += '<div class="c-both"></div>';
						j = 1;
					} else {
						j += 1;
					}
					$( target + '_frame_body' ).append( items );
				}
			});
		} else {
			$(myData).find("item ").each(function( i ){
				if ( maxColumns > i ) {
					var items;
					items = UtlColumnView.rankingPopUList( $(this) );
					$( target + '_frame_body' ).append( items );
				}
			});
		}
		$( target + '_frame_body' ).append( '<div class="c-both"></div>' );
	}
}
fncFrameBodyRankingPopU.prototype = new fncFrameBodyCommon;

function fncFrameBodyRankingFavU () {
	this.getList = function () {
		//リストをクリア
		$( this.target + '_frame_body' ).empty();
		//XML読み込み
		var item = { url : this.xmlFile };
		var myData = utl.getDataWithAjax( item );

		this.total;	//全件数
		target = this.target;
		maxColumns = this.maxColumns;

		//ランキング種リンク
		var link;
		link  = '<div id="ranking_navi_box">';
		link += '	<div id="ranking_navi_type">';
		link += '		<a href="./?o=c&r=pop">再生回数ランキング作品別</a>｜';
		link += '		<a href="./?o=u&r=pop">再生回数ランキングユーザ別</a>｜';
//		link += '		<a href="./?o=c&r=fav">お気に入りランキング作品別</a>｜';
//		link += '		お気に入りランキングユーザ別';
		link += '	</div>';
		link += '	<div id="ranking_navi_term">';
		link += '		<a href="./?o=u&r=fav&t=d">日ごと</a>｜';
		link += '		<a href="./?o=u&r=fav&t=w">週ごと</a>｜';
		link += '		<a href="./?o=u&r=fav&t=m">月ごと</a>';
		link += '	</div>';
		link += '</div>';
		$( target + '_frame_body' ).append( link );

		this.total = $(myData).find("total").text();
		if ( this.viewStatus == true ) {
			var j = 1;
			$(myData).find("item ").each(function( i ){
				if ( maxColumns > i ) {
					var items;
					items = UtlColumnView.rankingFavUThumbnails( $(this) );
					if ( j == 4 ) {
						items += '<div class="c-both"></div>';
						j = 1;
					} else {
						j += 1;
					}
					$( target + '_frame_body' ).append( items );
				}
			});
		} else {
			$(myData).find("item ").each(function( i ){
				if ( maxColumns > i ) {
					var items;
					items = UtlColumnView.rankingFavUList( $(this) );
					$( target + '_frame_body' ).append( items );
				}
			});
		}
		$( target + '_frame_body' ).append( '<div class="c-both"></div>' );
	}
}
fncFrameBodyRankingFavU.prototype = new fncFrameBodyCommon;

