function popup(url){
	var windowWidth=600 ; 
	var windowHeight=600 ;
	var name ='popup';
	myleft=(screen.width)?(screen.width-windowWidth)/2:100;

	mytop=(screen.height)?(screen.height-windowHeight)/2:100;

	properties = "width="+windowWidth+",height="+windowHeight+",scrollbars=no, top="+mytop+",left="+myleft;

	window.open(url,name,properties)

}

function popup_video(url){
	var windowWidth=445 ; 
	var windowHeight=365 ;
	var name ='popup';
	myleft=(screen.width)?(screen.width-windowWidth)/2:100;

	mytop=(screen.height)?(screen.height-windowHeight)/2:100;

	properties = "width="+windowWidth+",height="+windowHeight+",toolbar=0,status = no,location=0,scrollbars=0, top="+mytop+",left="+myleft;

	window.open(url,name,properties);

}

function loadNewsList(from,id){
	
new Ajax.Updater('list_news','panel_news.php?from='+from+'&id='+id, {
  method: 'get'
  });
  
}

function toogleEventData(id,option){
	
	$('whats_on_option').className='';
	$('line_up_option').className='';
	$('location_option').className='';
	$('tickets_info_option').className='';
	$(option+'_option').className='sel';
	
	
	$('event_text').innerHTML = $('text_'+option).innerHTML;
	

	if (option=='whats_on' || option=='location' ){
		$('event_img').src ='resources/events'+id+'_'+option+'.png';
		$('event_img').style.display='';
	}else{
		$('event_img').style.display='none';
		
		
	}
	div_scroll1.resetScroll();
	
	document.getElementById('scroll_up').style.visibility ='hidden';
	
  if (document.getElementById('scroll_content').offsetHeight<=document.getElementById('scroll_box').style.height.replace('px','')){
		  	document.getElementById('scroll_down').style.visibility ='hidden';
		  	
		  }else{
		  	
		  	  	document.getElementById('scroll_down').style.visibility ='';
		  }
	
	
	
}

function toogleImagesGallery(id){
	if (id==document.getElementById('total_pics').value)
		id =0;
		
		if (id<0)
			id =parseInt(document.getElementById('total_pics').value)-1;
		
	
	pics = document.getElementsByName('pics');
	for(i=0;i<pics.length;i++){
		pics[i].src='img/pic.jpg';
		
		
	}
	document.getElementById('main_pic').src='resources/'+ document.getElementById('src_'+id).value;
	document.getElementById('main_pic').style.display='';
	
	document.getElementById('pic_'+id).src='img/pic_current.jpg';
	document.getElementById('title_pic').innerHTML=document.getElementById('title_'+id).value;
	document.getElementById('id_current_pic').value =id;
	
}

function loadGalleryList(from,id){
	
new Ajax.Updater('list_gallery','panel_gallery.php?from='+from+'&id='+id, {
  method: 'get'
  });
  
}


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();
	}
}

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



function TextScroll(scrollname, div_name, up_name, down_name,content)
{
    this.div_name = div_name;
    this.name = scrollname;
    this.scrollCursor = 0;
    this.speed = 5;
    this.timeoutID = 0;
    this.div_obj = null;
    this.up_name = up_name;
    this.dn_name = down_name;
    this.content = document.getElementById(content);

{
        if (document.getElementById) {
            div_obj = document.getElementById(this.div_name);
            if (div_obj) {
                this.div_obj = div_obj;
                this.div_obj.style.overflow = 'hidden';
            }
            div_up_obj = document.getElementById(this.up_name);
            div_dn_obj = document.getElementById(this.dn_name);
            if (div_up_obj && div_dn_obj) {

            	div_up_obj.onmouseover = function() { eval(scrollname + ".scrollUp();" ) };
div_up_obj.onmouseout = function() { eval(scrollname + ".stopScroll();" ) };

div_dn_obj.onmouseover = function() { eval(scrollname + ".scrollDown();" ) };
div_dn_obj.onmouseout = function() { eval(scrollname + ".stopScroll();" ) };

            }
        }
    }

this.stopScroll = function() {
        clearTimeout(this.timeoutID);
    }

this.scrollUp = function() {
        if (this.div_obj) {
            this.scrollCursor = (this.scrollCursor - this.speed) < 0 ? 0 : this.scrollCursor - this.speed;
            this.div_obj.scrollTop = this.scrollCursor;
            this.timeoutID = setTimeout(this.name + ".scrollUp()", 60);
            
      if ( this.div_obj.scrollTop==0  ){
          	document.getElementById(this.up_name).style.visibility ='hidden';
          }
          
            
             	document.getElementById(this.dn_name).style.visibility ='';
        }
    }

this.scrollDown = function() {
        if (this.div_obj) {
            this.scrollCursor += this.speed;
            this.div_obj.scrollTop = this.scrollCursor;
            this.timeoutID = setTimeout(this.name + ".scrollDown()", 60);
            
          if (this.content.offsetHeight  <= this.div_obj.scrollTop+parseInt(this.div_obj.style.height.replace('px',''))  ){
          	document.getElementById(this.dn_name).style.visibility ='hidden';
          }
         
          document.getElementById(this.up_name).style.visibility ='';   
        }
    }

this.resetScroll = function() {
        if (this.div_obj) {
            this.div_obj.scrollTop = 0;
            this.scrollCursor = 0;
        }
    }
}
