

function validateForm(){
		var akolTov = true;
	
	   $$('.required').each(function(elem){
	   		
	   		if (elem.value =='' && !elem.disabled){
				elem.className ='required correct';
				akolTov =false;
	   		}else{
	   			elem.className ='required input';
	   			
	   		}
	   	
        });
	if(!akolTov){
		alert('Please complete all the required fields');
		
	}
        
        
	return akolTov;
	
}

function toogleSubMenu(xName){
	var class_value = 'hide';
	
	if (document.getElementById(xName).className == 'hide')
		class_value ='show';
	
	
	
	document.getElementById(xName).className = class_value;
}

var newwindow;
function popup(url)
{
	newwindow=window.open(url,'name','height=500,width=500');
	if (window.focus) {newwindow.focus()}
}


function changeStar(section_code){
	
	if (section_code ==''){
		document.getElementById('star').src ='img/sections.png';	
		document.getElementById('star_title').className ='hide';
	}else{
	
		document.getElementById('star').src ='img/sections_'+section_code+'.png';
		document.getElementById('star_title').src ='img/star_'+section_code+'.png';
		document.getElementById('star_title').className ='show_inline';
	}
}

function loadPosts(from){
	
new Ajax.Updater('section_data','blog_panel.php?from='+from, {
  method: 'get'
  });
  
}


function loadPostsTable(from,post_id){
	
new Ajax.Updater('table','post_table_panel.php?from='+from+'&post_id='+post_id, {
  method: 'get'
  });
  
}
function loadPortfolioTable(from,section_id){
	
new Ajax.Updater('table','portfolio_table_panel.php?from='+from+'&section_id='+section_id, {
  method: 'get',
  onComplete: function(){
    loadPortfolio(0);}
  
  });
 // fixH('table','section_data');
}

function loadPortfolio(id){
	
	if (id!=0){
		var x =document.getElementsByName('thumbs');
		for(i=0;i<x.length;i++){
			x[i].className='thumb';
		}
	}
	
new Ajax.Updater('section_data','portfolio_panel.php?id='+id, {
  method: 'get',
  onComplete: function(){
    	document.getElementById('thumb-'+id).className ='thumb-selected';}
     
  });
 // fixH('table','section_data');
}

function validateContact(){
			var akolTov = true;
	
	   $$('.required').each(function(elem){
	   		
	   		if (elem.value =='' && !elem.disabled){
				elem.className ='required correct';
				akolTov =false;
	   		}else{
	   			elem.className ='required';
	   			
	   		}
	   	
        });
	if(!akolTov){
		alert('Please complete all the required fields');
		
	}else{   	
		document.getElementById('frm').submit();
	}
}