window.addEvent('domready',
function() {
	
	
$('load_content').setStyle('visibility','visible');

$('load_content').set('opacity',0);

$('load_content').fade('in');

	
	
	
MySlide = new Class({
 
  Extends: Fx.Slide,
 
  initialize: function(element,options){
    this.parent(element,options);
    if(this.options.mode == 'horizontalRtL'){
        this.wrapper.setStyle('float','right');
        this.extraWrapper = new Element('div',{
            styles: {
                overflow: 'hidden'
            }
        }).wraps(this.wrapper);    
    }
  },
 
  horizontalRtL: function(){
    this.margin = 'margin-right';
    this.layout = 'width';
    this.offset = this.element.offsetWidth;
  }
 
});

// And then:
var mySlide = new MySlide($('load_content'),{mode: 'horizontalRtL'});
 

 
 


	
    // SET SLIDE FX TO DIV CONTAINER
    var myVerticalSlide = new Fx.Slide('load_content', {mode: 'horizontal'});
	
	
	function sendReq(){
			req.send();
			
			
	}
	
	
	//SET MENU ARRAY FOR EACH CLASS LINK NAMED "menu"
    var menuSabores = $$('#top_menu a','#home a','#sec_menu a','#online_menu a');
	
	    menuSabores.each(function(element) {
							  
							  
		//ON CLICK LINK FOREACH
        element.addEvent('click', function(event) {
										  
			$('load_content').fade('out');
			myVerticalSlide.addEvent('complete',sendReq);
			myVerticalSlide.slideOut();
			event.stop();
			var linkLocation = this.href;

			req = new Request.HTML({
				url: element.get('href'),
				method: 'get',
				onSuccess: function(html) {
					
					redirectPage(linkLocation);

					/*$('load_content').set('text', '');
					$('load_content').adopt(html);
					
					$('load_content').adopt(html);
					$('load_content').fade('in');
					myVerticalSlide.removeEvent('complete',sendReq);
					myVerticalSlide.show();*/
					//mySlide.toggle();
			
				},
				onFailure: function() {
					//redirectPage("index.php");
					$('load_content').set('text', 'The request failed');
				}
			});
			
			//mySlide.slideOut();
        	
        });
			
			
			
			
		
		
    });
	
	
	
	
	
});
		
function redirectPage(linkLoc) {
	window.location = linkLoc;
}

var selected;
function checkSelected(target) {

//alert(target);
//alert(selected);
if (selected) {
	selected.setStyle('background-position','0px -27px');
}

selected = target;
selected.setStyle('background-position','0px 0px');
	
}
	
function update_radio_btns_Fn(target) {

// VARS - RADIO BTNS AND IMGS BESIDE THEM
var flv = $$('#flv');
var flv_img = $$('#flv_radio_btn');

var mp4 = $$('#mp4');
var mp4_img = $$('#mp4_radio_btn');

var wm = $$('#wm');
var wm_img = $$('#wm_radio_btn');

var qt = $$('#qt');
var qt_img = $$('#qt_radio_btn');

if(target == "flv"){
	flv_img.setStyle('background-position','top');
	flv.setProperty('checked','True');
	
	mp4_img.setStyle('background-position','0% 101%');
	mp4.removeProperty('checked');
	
	wm_img.setStyle('background-position','0% 101%');
	wm.removeProperty('checked');
	
	qt_img.setStyle('background-position','0% 101%');
	qt.removeProperty('checked');
	
	}else if (target == "mp4") {
	flv_img.setStyle('background-position','0% 101%');
	flv.removeProperty('checked');
	
	mp4_img.setStyle('background-position','top');
	mp4.setProperty('checked', 'True');
	
	wm_img.setStyle('background-position','0% 101%');
	wm.removeProperty('checked');
	
	qt_img.setStyle('background-position','0% 101%');
	qt.removeProperty('checked');
}else if (target == "wm") {
	flv_img.setStyle('background-position','0% 101%');
	flv.removeProperty('checked');
	
	mp4_img.setStyle('background-position','0% 101%');
	mp4.removeProperty('checked');
	
	wm_img.setStyle('background-position','top');
	wm.setProperty('checked', 'True');
	
	qt_img.setStyle('background-position','0% 101%');
	qt.removeProperty('checked');
}else if (target == "qt") {
	flv_img.setStyle('background-position','0% 101%');
	flv.removeProperty('checked');
	
	mp4_img.setStyle('background-position','0% 101%');
	mp4.removeProperty('checked');
	
	wm_img.setStyle('background-position','0% 101%');
	wm.removeProperty('checked');
	
	qt_img.setStyle('background-position','top');
	qt.setProperty('checked', 'True');
}else {
alert('error');

}
}
