/*function make() {
	
	Cookie.write('open', 'true', {path: "/"});
}

function srub() {
	
	Cookie.write('open', 'false', {path: "/"});
	
}*/

var sifrVar = false;

message = false;

window.addEvent('domready', function() {
	
	if(!message){
	
	var myAccordion = new Accordion($('left-col'), 'h3.toggler', '.element', {
        display: 0,
        alwaysHide: true,
        onActive: function(toggler, element){
            toggler.removeClass('toggle_closed');
			toggler.addClass('toggle_open');
		},
        onBackground: function(toggler, element){
			toggler.removeClass('toggle_open');
			toggler.addClass('toggle_closed');
		}
    });
	}else{
		var myAccordion = new Accordion($('left-col'), 'h3.toggler', '.element', {
	        display: 1,
	        alwaysHide: true,
	        onActive: function(toggler, element){
	            toggler.removeClass('toggle_closed');
				toggler.addClass('toggle_open');
			},
	        onBackground: function(toggler, element){
				toggler.removeClass('toggle_open');
				toggler.addClass('toggle_closed');
			}
	    });
	}
    
    var fade = new Fx.Morph('client-list-open', {duration: 1000, transition: Fx.Transitions.Quad.easeInOut});
    var fadein = new Fx.Morph('client-list-open', {duration: 1000, transition: Fx.Transitions.Quad.easeInOut});
	var boxfade = new Fx.Morph('our-work-closed', {duration: 1000, transition: Fx.Transitions.Quad.easeInOut});
	
	$('our-work-closed').setStyle('opacity', 0);
	
	// If cookie is active upon refresh. 
	
	if(admin){
		
		$('clients').addEvent('click', function(e) {
	
		if($('client-list-open').getStyle('height').toInt()==0)
		        { 
			e.stop(),
	    		fadein.start({
	                'height': [0, 300],
					'border-top': [0, 1],
					'border-top-style': 'solid'
		
	    		})
			
			$('clients').addClass('active');
			
	
			}
	
	});
	

		
	$('clients').addEvent('click', function(e) {
		if($('client-list-open').getStyle('height').toInt()==300)
		        {
					  e.stop(),
			    		fade.start({
			                'height': [300, 0],
							'border-top': 0,
							'border-top-style': 'solid'
	
			    		})

		 $('clients').removeClass('active');

		// 246	
		}
	
	});
	
	$('close-click').addEvent('click', function(e) {
		if($('client-list-open').getStyle('height').toInt()==300)
		        {
					  e.stop(),
			    		fade.start({
			                'height': [300, 0],
							'border-top': 0,
							'border-top-style': 'solid'
	
			    		})
			
		 $('clients').removeClass('active');	
		// 246
		

		}
	
		});
	
	$('close-click').addEvent('click', function(e) {
		if($('client-list-open').getStyle('height').toInt()==300)
		        {
						boxfade.start({
			                'opacity': [1, 0]

			    		})
		
					}
				});
				
				$('clients').addEvent('click', function(e) {
					if($('client-list-open').getStyle('height').toInt()==300)
					        {
									boxfade.start({
						                'opacity': [1, 0]

						    		})
					
								}
							});
							
			$('clients').addEvent('click', function(e) {
				if($('client-list-open').getStyle('height').toInt()==0)
				        {
								boxfade.start({
					                'opacity': [0, 1]

					    		})
				
				
						}
						});

	
	}else{
	
	$('clients').addEvent('click', function(e) {
	
		if($('client-list-open').getStyle('height').toInt()==0)
		        { 
			e.stop(),
	    		fadein.start({
	                'height': [0, 165],
					'border-top': [0, 1],
					'border-top-style': 'solid'
		
	    		})
			
			$('clients').addClass('active');
			
	
			}
	
	});
	

		
	$('clients').addEvent('click', function(e) {
		if($('client-list-open').getStyle('height').toInt()==165)
		        {
					  e.stop(),
			    		fade.start({
			                'height': [165, 0],
							'border-top': 0,
							'border-top-style': 'solid'
	
			    		})

		 $('clients').removeClass('active');

		// 246	
		}
	
	});
	
	$('close-click').addEvent('click', function(e) {
		if($('client-list-open').getStyle('height').toInt()==165)
		        {
					  e.stop(),
			    		fade.start({
			                'height': [165, 0],
							'border-top': 0,
							'border-top-style': 'solid'
	
			    		})
			
		 $('clients').removeClass('active');	
		// 246
		

		}
	
		});
	
	$('close-click').addEvent('click', function(e) {
		if($('client-list-open').getStyle('height').toInt()==165)
		        {
						boxfade.start({
			                'opacity': [1, 0]

			    		})
		
					}
				});
				
				$('clients').addEvent('click', function(e) {
					if($('client-list-open').getStyle('height').toInt()==165)
					        {
									boxfade.start({
						                'opacity': [1, 0]

						    		})
					
								}
							});
							
			$('clients').addEvent('click', function(e) {
				if($('client-list-open').getStyle('height').toInt()==0)
				        {
								boxfade.start({
					                'opacity': [0, 1]

					    		})
				
				
						}
						});

	
	
	
	}
	
	
		
	// $$('#left-col, #showreel, #showreel-nav, .footer').addEvent('click', function(e) {
	// 		if($('client-list-open').getStyle('height').toInt() == 165)
	// 		        {
	// 					  e.stop(),
	// 			    		fade.start({
	// 			                'height': [165, 0],
	// 								'border-top': 0,
	// 								'border-top-style': 'solid'
	// 	
	// 			    		}),
	// 							boxfade.start({
	// 				                'opacity': [1, 0]
	// 
	// 				    		})
	// 			
	// 		 $('clients').removeClass('active');	
	// 		// 246	
	// 		}
	// 	
	// 	});

	
	
	/* if (Cookie.read('open') == 'true') {
	
			$('client-list-open').setStyle('height', 100);
			$('client-list-open').setStyle('border-top-color', '#373737');
			$('work').addClass('work-open');
	}
	
	var a = document.URL.split("//"); // split at protocol
	a = (a[1] ? a[1] : a[0]).split("/");
	
	if (a[1] == 'clients') {
	
		//document.example.src = imgArray[0];
   } */
	
	
});	
		

//	$('client-list-open').setStyle('height', 100);
//	$('client-list-open').setStyle('border-top-color', '#373737');


