jQuery(document).ready(function(){
	searchGrid = {
		width: 888,
		height: 220,	// 95,
		headers:[' ', ' ', __('Title'),  __('Artist'),  __('Remix'), __('Album'), __('Length'), __('Price'), __('Label'), __('Genres'), __('Release Date') ], 
		columns: [
	              {name:'play', width:15, resizable: false},
	              {name:'favourite', width:15, resizable: false},
	              {name:'title', width:86},
	              {name:'Artist.name', width:83},
	              {name:'Remixer.name', width:83},
	              {name:'Release.title', width:84},
	              {name:'length', width:55, resizable: false},
	              {name:'price', width:110, resizable: false},
	              //{name:'popularity', width:91},
	              {name:'Label.name', width:83, resizable: false},
	              {name:'Genres', width:83, resizable: false},
	              {name:'release_date', width:90}
	              ],
	   loadComplete: function() {
						/* SET jScroll Pane height correctly to make it work fine */
		   				/* Reset size of the box to get jqgrid height*/
		   				jQuery('.ui-jqgrid-bdiv').height(jQuery('.ui-jqgrid-bdiv div table').height());
		   				/* Reset pane height */
		   			   	jQuery(searchGrid.pane).height(searchGrid.height + 13);
					   	jQuery(searchGrid.pane + ' .jScrollPaneContainer').height(searchGrid.height + 13);
					   	jQuery(searchGrid.pane).jScrollPane({showArrows:true});
					   	/* Not selectable table rows */
					   	jQuery("#trackList tr").each(function(i) {
					   	  this.onselectstart = function() { return(false); };
							  this.unselectable = "on"; 
							  jQuery(this).css('-moz-user-select', 'none');
					   	});
						jQuery("#searchSuccess").jScrollPane({showArrows:true});
						actions.click("#searchSuccess");
	   				}
	}
	
	trackFromReleaseGrid = {
		width: 393,
		height: 205,	// 90,
		headers:[' ', ' ', '#', __('Title'),  __('Artist'), __('Album'), __('Length'), __('Price') ], //__('Popularity') 
		columns: [
		          {name:'play', width:22, align:"left", resizable: false},
		          {name:'favourite', width:22, align:"left", resizable: false},
		          {name:'id', width:19, resizable: false, align:"right" },
		          {name:'title', width:100},
		          {name:'length', width:87, resizable: false, align:"right"},
		          {name:'price', width:110, resizable: false}
		          //{name:'popularity', width:91, resizable: false},
		          ]
			
	}
	
	releaseViewGrid = {
			width: 600,
			height: 210,	// 95,
			headers:[' ', ' ', '#', __('Title'),  __('Artist'), __('Remix'), __('Length'), __('Price'), __('Genres') ], //__('Popularity')
			columns: [
		              {name:'play', width:15, resizable: false},
		              {name:'favourite', width:15, resizable: false},
		              {name:'nr', width:10, resizable: false, align:"center" },
		              {name:'title', width:86},
		              {name:'Artist.name', width:83},
		              {name:'Remixer.name', width:40},
		              {name:'length', width:45, resizable: false},
		              {name:'price', width:80, resizable: true},
		              {name:'Genres', width:95}
		              //{name:'popularity', width:45}
		              ],
  		    sortorder: "asc",
  		    sortname: "nr",
			loadComplete: function() {
							   	/* SET jScroll Pane height correctly to make it work fine */ 
							   	jQuery('.ui-jqgrid-bdiv').height(jQuery('.ui-jqgrid-bdiv div table').height());
							   	jQuery('.trackGridSmallPane').height(releaseViewGrid.height + 13);
							   	jQuery('.trackGridSmall .jScrollPaneContainer').height(releaseViewGrid.height + 13);
							   	jQuery('.trackGridSmallPane').jScrollPane({showArrows:true});
							   	/* Not selectable table rows */
							   	jQuery("#trackList tr").each(function(i) {
							   	  this.onselectstart = function() { return(false); };
									  this.unselectable = "on"; 
									  jQuery(this).css('-moz-user-select', 'none');
							   	});
								actions.click("#trackList");
			   				}
	}
	
	artistViewGrid = {
			width: 804,
			height: 210,	// 95,
			headers:[' ', ' ', __('Title'),  __('Remix'), __('Release'), __('Length'), __('Price'), __('Label'), __('Genre'), __('Release Date') ], 
			columns: [
		              {name:'play', width:15, resizable: false},
		              {name:'favourite', width:15, resizable: false},
		              {name:'title', width:86},
		              {name:'Remixer.name', width:83},
		              {name:'Release.title', width:83},
		              {name:'length', width:55, resizable: false},
		              {name:'price', width:110, resizable: false},
		              //{name:'popularity', width:91, resizable: false},
		              {name:'Label.name', width:83, resizable: false},
		              {name:'Genre.name', width:83, resizable: false},
		              {name:'release_date', width:90}
		              ],
  		    sortorder: "asc",
  		    sortname: "nr",
			loadComplete: function() {
							   	/* SET jScroll Pane height correctly to make it work fine */ 
							   	jQuery('.ui-jqgrid-bdiv').height(jQuery('.ui-jqgrid-bdiv div table').height());
							   	jQuery('.trackGridSmallPane').height(releaseViewGrid.height + 13);
							   	jQuery('.trackGridSmall .jScrollPaneContainer').height(releaseViewGrid.height + 13);
							   	jQuery('.trackGridSmallPane').jScrollPane({showArrows:true});
							   	/* Not selectable table rows */
							   	jQuery("#trackList tr").each(function(i) {
							   	  this.onselectstart = function() { return(false); };
									  this.unselectable = "on"; 
									  jQuery(this).css('-moz-user-select', 'none');
							   	});
								actions.click("#trackList");
			   				}
	}
	
	labelViewGrid = {
			width: 804,
			height: 210,	// 95,
			headers:[' ', ' ', __('Title'),  __('Artist'),  __('Remix'), __('Release'), __('Length'), __('Price'), __('Genre'), __('Release Date') ], 
			columns: [
		              {name:'play', width:15, resizable: false},
		              {name:'favourite', width:15, resizable: false},
		              {name:'title', width:86},
		              {name:'Artist.name', width:83},
		              {name:'Remixer.name', width:83},
		              {name:'Release.title', width:83},
		              {name:'length', width:55, resizable: false},
		              {name:'price', width:110, resizable: false},
		              //{name:'popularity', width:91, resizable: false},
		              {name:'Genre.name', width:83, resizable: false},
		              {name:'release_date', width:90}
		              ],
  		    sortorder: "asc",
  		    sortname: "nr",
			loadComplete: function() {
							   	/* SET jScroll Pane height correctly to make it work fine */ 
							   	jQuery('.ui-jqgrid-bdiv').height(jQuery('.ui-jqgrid-bdiv div table').height());
							   	jQuery('.trackGridSmallPane').height(releaseViewGrid.height + 13);
							   	jQuery('.trackGridSmall .jScrollPaneContainer').height(releaseViewGrid.height + 13);
							   	jQuery('.trackGridSmallPane').jScrollPane({showArrows:true});
							   	/* Not selectable table rows */
							   	jQuery("#trackList tr").each(function(i) {
							   	  this.onselectstart = function() { return(false); };
									  this.unselectable = "on"; 
									  jQuery(this).css('-moz-user-select', 'none');
							   	});
								actions.click("#trackList");
			   				}
	}
	
	genreViewGrid = {
			width: 592,
			height: 210,	// 95,
			headers:[' ', ' ', __('Title'),  __('Artist'), __('Album'), __('Length'), __('Price') ], 
			columns: [
		              {name:'play', width:15, resizable: false},
		              {name:'favourite', width:15, resizable: false},
		              {name:'title', width:86},
		              {name:'Artist.name', width:83},
		              {name:'Release.title', width:84},
		              {name:'length', width:87, resizable: false},
		              {name:'price', width:87, resizable: false},
		              //{name:'popularity', width:91, resizable: false},
		              ],
			loadComplete: function() {
							   	/* SET jScroll Pane height correctly to make it work fine */ 
							   	jQuery('.ui-jqgrid-bdiv').height(jQuery('.ui-jqgrid-bdiv div').height());
							   	jQuery('.trackGridSmallPane').height(releaseViewGrid.height + 13);
							   	jQuery('.trackGridSmall .jScrollPaneContainer').height(releaseViewGrid.height + 13);
							   	jQuery('.trackGridSmallPane').jScrollPane({showArrows:true});
							   	/* Not selectable table rows */
							   	jQuery("#trackList tr").each(function(i) {
							   	  this.onselectstart = function() { return(false); };
									  this.unselectable = "on"; 
									  jQuery(this).css('-moz-user-select', 'none');
							   	});
								actions.click("#trackList");
			   				}
	}
	
	myPlaylistGrid = {
			id: '#playlistTrackList',
			width: 303,
			height: 408,
			pane: '#playlistTrackList',
			headers:[' ', ' ', __('Title'),  __('Artist'), __('Album') ], 
			columns: [
			                   {name:'play', width:15, resizable: false},
			                   {name:'favourite', width:15, resizable: false},
			                   {name:'title', width:86},
			                   {name:'Artist.name', width:83},
			                   {name:'Release.title', width:84},
			                   ],
			loadComplete: function() {
								/* SET jScroll Pane height correctly to make it work fine */ 
							   	jQuery('.ui-jqgrid-bdiv').height(jQuery('.ui-jqgrid-bdiv div').height());
							   	jQuery('#playlistTrackList .jScrollPaneContainer').height(myPlaylistGrid.height + 13);
							   	/* Not selectable table rows */
							   	jQuery('#playlistTrackList tbody').sortable();
							   	jQuery("#playlistTrackList tr").each(function(i) {
							   	  this.onselectstart = function() { return(false); };
									  this.unselectable = "on"; 
									  jQuery(this).css('-moz-user-select', 'none');
							   	});
								actions.click("#trackList");
			   				}
	}
	
	createPlaylistGrid = {
			width: 911,
			height: 276,
			pane: '.advantageSearchDown',
			headers:[' ', ' ', __('Title'),  __('Artist'), __('Album'), __('Length'), __('Price') ], 
			columns: [ 
		              {name:'play', width:15, resizable: false},
		              {name:'favourite', width:15, resizable: false},
		              {name:'title', width:86},
		              {name:'Artist.name', width:83},
		              {name:'Release.title', width:84},
		              {name:'length', width:87, resizable: false},
		              {name:'price', width:110, resizable: false},
		              //{name:'popularity', width:91, resizable: false},
		              ],
		   loadComplete: function() {
							/* SET jScroll Pane height correctly to make it work fine */ 
						   	jQuery('.ui-jqgrid-bdiv').height(jQuery('.ui-jqgrid-bdiv div').height());
						   	jQuery('#pane1AdvantageSearch').height(searchGrid.height + 13);
						   	jQuery('.advantageSearchDown .jScrollPaneContainer').height(searchGrid.height + 13);
						   	jQuery('#pane1AdvantageSearch').jScrollPane({showArrows:true});
						   	/* Not selectable table rows */
						   	jQuery("#trackList tr").each(function(i) {
						   	  this.onselectstart = function() { return(false); };
								  this.unselectable = "on"; 
								  jQuery(this).css('-moz-user-select', 'none');
						   	});
							actions.click("#trackList");
		   				}
		}
	
	trackFavoriteGrid = {
		id: '#favoriteTrackList',
		width: 900,
		height: 358,	//358,
		pane: '#favoriteTrack',
		headers:[' ', ' ', __('Title'),  __('Artist'),  __('Remix'), __('Album'), __('Length'), __('Price'), __('Label'), __('Genre'), __('Release Date') ], 
		columns: [
	              {name:'play', width:25, resizable: false},
	              {name:'unfavourite', width:25, resizable: false},
	              {name:'title', width:180},
	              {name:'Artist.name', width:180},
	              {name:'Remixer.name', width:80},
	              {name:'Release.title', width:180},
	              {name:'length', width:100, resizable: false},
	              {name:'price', width:100, resizable: false},
	              //{name:'popularity', width:91},
	              {name:'Label.name', width:150, resizable: false},
	              {name:'Genre.name', width:150, resizable: false},
	              {name:'release_date', width:200}
	              ],
	    loadComplete: function() {
						jQuery('#favoriteTrack').jScrollPane({showArrows:true});
					   	jQuery("#favoriteTrack tr").each(function(i) {
					   	  this.onselectstart = function() { return(false); };
							  this.unselectable = "on"; 
							  jQuery(this).css('-moz-user-select', 'none');
					   	});
						actions.click("#trackList");
	   				}
	};
	
	historyViewGrid = {
		url: baseUrl + 'track/historyTracks',
		width: 612,
	    height: 288,
	    scroll: false,
	    altRows: true,
	    gridview: true,
	    scrollOffset: 0,
	    imgpath: baseUrl_root+'images/grid',
	    loadui: 'disable',
		datatype: "json", 
		colNames:[' ', ' ',__('Date of purchase'), __('Title'),  __('Artist'), __('Remix'), __('Release'), __('Length'), __('Label') ],
	    colModel:[
	      	{name:'play', width:22, align:"left", resizable: false},
	      	{name:'favourite', width:22, align:"left", resizable: false},
	        {name:'purchase_date', width:130, resizable: false},
	        {name:'title', width:80, resizable: false},
	        {name:'Artist.name', width:80, resizable: false},
	        {name:'Remixer.name', width:91, resizable: false},
	        {name:'Release.title', width:90, resizable: false},
	        {name:'length', width:55, resizable: false, align:"right"},
	        {name:'Label.name', width:80, resizable: false}
	    ],
	    pager: '#historyPager', 
	    sortname: 'nr', 
	    jsonReader : { 
	        root: "rows", 
	        page: "page", 
	        total: "total", 
	        records: "records", 
	        repeatitems: false, 
	        cell: "cell", 
	        id: "id",
	        userdata: "userdata", 
	        subgrid: { root:"rows", repeatitems: true, cell:"cell" } 
	    },
	    viewrecords: true,
	    sortorder: "asc",
	    loadComplete: function() {
		   	/* SET jScroll Pane height correctly to make it work fine */ 
		   	jQuery('.ui-jqgrid-bdiv').height(jQuery('.ui-jqgrid-bdiv div table').height());
		   	jQuery('.contentTableGrid').height(releaseViewGrid.height + 13);
		   	jQuery('.contentTableGrid .jScrollPaneContainer').height(releaseViewGrid.height + 13);
		   	jQuery('.contentTableGrid').jScrollPane({showArrows:true});
		   	/* Not selectable table rows */
		   	jQuery("#trackList tr").each(function(i) {
		   	  this.onselectstart = function() { return(false); };
				  this.unselectable = "on"; 
				  jQuery(this).css('-moz-user-select', 'none');
		   	});
			actions.click("#trackList");
			}
	};
	
	/*
	browseGenreList = {
		id: '#panelGrid',
		url: baseUrl + 'browse/browseGenre',
		
	    width: 612,
	    height: 360,
	    altRows: true,
	    imgpath: baseUrl_root+'images/grid',
	    loadui: 'disable',

		datatype: "json", 
		colNames:[' ', __('Genre Name'),  __('Number of Releases') ],
	    colModel:[
  	        {name:'favorite', width:30, resizable: false},
	        {name:'name', width:190, resizable: true},
	        {name:'releasesNumber', width:135, align: "right"},
	        //{name:'popularity', width:82, resizable: false},
        ],
        rowNum:-1, 
        pager: '#browsePager', 
        sortname: 'name', 
        viewrecords: true,
        sortorder: "asc" 
	}
	*/
});
