// JavaScript Document


//document.observe("dom:loaded", bodyOnload);
Event.observe(window, 'load', bodyOnload, false); 
	function bodyOnload() {				
		$$('div.txt-rest').each(function(s){ 
										var height = s.getHeight();
										s.setStyle({ 'height': height+"px"});										
										s.hide(); 
										});
		
		$$('a.read-more-link').each(function(a){ a.update('Read more +'); });
	}
	var openId = null;
	var busy = null;
	
	
  Effect.ShowTheText = function (contentId, aId, exepctionId) {
		
		var slideDown = 0.6;
    	var slideUp = 0.4;
      
        contentId = $(contentId);		
		id = $(aId);		
		display = contentId.getStyle('display');
				
		if(busy != null){
			return;	
		}

                if (display == 'none')
				{
  						busy =1;  
						if(id.innerHTML == 'more »'){
							id.update('hide -');
						}
						
						new Effect.SlideDown(contentId, {duration: slideDown,							
										   				afterFinish: function() {																	
																busy =null;
																}
														}
											);                        					
				
				
				openId = contentId;
				}else{
						busy =1;  
						if(id.innerHTML == 'hide -'){
							id.update('more »');
						}
						new Effect.SlideUp(contentId, {duration: slideUp,							
										   				afterFinish: function() {															
																busy =null;
																}
														}
											);   
						openId = null;
				}
	
  }
  
  
  
  // get youtube thumb
function getScreen( url, size )
{
  if(url === null){ return ""; }

  size = (size === null) ? "big" : size;
  var vid;
  var results;

  results = url.match("[\\?&]v=([^&#]*)");

  vid = ( results === null ) ? url : results[1];

  if(size == "small"){
    return "http://img.youtube.com/vi/"+vid+"/2.jpg";
  }else {
    return "http://img.youtube.com/vi/"+vid+"/0.jpg";
  }
}