Ext.namespace('fenceco','fenceco.public');

fenceco.public.services = function() {

    var init = function( ) {

		new Ext.ux.Carousel('entryfenceimage', {
            itemSelector: 'img',
            interval: 5,
        	transitionEasing: 'easeIn'  ,
        	autoPlay: true,
            showPlayButton: true,
            pauseOnNavigate: true,
            freezeOnHover: true,
            navigationOnHover: true              
    	});
	}
	
	var select = function( groupId ) {
	
	    window.location = 'services.php?t=' + groupId;
	}

    var openViewer = function( bad ) {
		
		var url = 'imageviewer.php';
		
		if( bad ) {
		
		    url += '?t=badstain';
		}
		else {
		
		    url += '?t=goodstain';
		}
		
	    window.open( url , 'fencecoimageviewer' , 'width=640,height=450,resizable=no,scrollbars=yes,location=no,directories=no,menubar=no,copyhistory=no,status=no');
	}
	
	var toggleShow = function( linkObj , textId ) {

		var linkObj = document.getElementById( linkObj );
		var textObj = document.getElementById( textId );

		if( textObj.className == 'viewmorehidden' ) {
			
			//Is Hidden, show the details
			textObj.className = 'viewmore';
			linkObj.innerHTML = 'Show Less';
		}
		else {
			
			//Is shown, hide it
			textObj.className = 'viewmorehidden';
			linkObj.innerHTML = 'Read More';
		}
		
		return false;
	}

    return {
    
        init : function( ) {
        
            init( );
        },
        
        openViewer : function( bad ) {
        
            openViewer( bad );
        },
        
        select : function( id ) {
        
            select( id );
        },
        
        toggleShow : function( linkObj , textId ) {
        	
        	toggleShow( linkObj , textId );
        }
    }
}();