// <![CDATA[

			function startGallery() {
			  if ($('myGallery') == undefined) return;
				$('myGallery').style.display = 'block';
				var myGallery = new gallery($('myGallery'), {
					 showArrows: false,
           showCarousel: false,
           showInfopane: false,
           embedLinks: true,
           fadeDuration: 500,
           timed: true,
           delay: 9000
				});
				
			}
			window.addEvent('domready', startGallery);
			window.addEvent('domready', function() {
	
        	//create our Accordion instance
        	var myAccordion = new Accordion($('accordion'), 'h3.toggler', 'div.element', {
        		opacity: false,
        		onActive: function(toggler, element){
        			toggler.setStyle('color', '#528CE0');
        		},
        		onBackground: function(toggler, element){
        			toggler.setStyle('color', 'white');
        		}
        	});})
        	
      window.addEvent('domready',function() {
      
        $$('.rate').each(function(element,i){
                element.addEvent('click', function(){
                        var myStyles = ['nostar', 'onestar', 'twostar', 'threestar', 'fourstar', 'fivestar'];
                        myStyles.each(function(myStyle){
                                if(element.getParent().hasClass(myStyle)){
                                        element.getParent().removeClass(myStyle)
                                }
                        });            
                        myStyles.each(function(myStyle, index){
                                if(index == element.id){
                                        element.getParent().toggleClass(myStyle);
                                        var pid = element.parentNode.id.replace(/pid/,'');
                                        var php = element.getParent().hasClass('vendor') ? 'vendrater.php' : 'prodrater.php';
                                        var pidKey = element.getParent().hasClass('vendor') ? 'vid' : 'pid'; 
                                        var myRequest = new Request({url: '/' + php}).send(pidKey +  "=" + pid + "&theRate=" + element.id);
                                        $('throbber').style.display = 'block';
                                        myRequest.onSuccess = function(responseText) {
                                          $('thanksForRating').style.display = 'block';
                                          $('currentRating').style.backgroundPosition = '0 -' + (176 + ((responseText - 1) * 16)) + 'px';
                                          $('throbber').style.display = 'none';
                                        }
                                }
                        });            
                       
                });
        });      
      
      
      
      });

