$(function()  
{  
  var hideDelay = 500;    
  var currentID;  
  var hideTimer = null;  
   
  var container = $('<div id="resort-comment-box"><div id="box-resort"></div><div id="box-comment"></div></div>');  
  
  $('.ski-resort').css('cursor', 'pointer');

  $('body').append(container);  
  
  $('.ski-resort').hover(function(){
	  
	  var ta	= (this.id).split('-');
	  var id	= ta[1];
	  var pos	= $('#' + this.id).offset();
	  var width = $('#' + this.id).width();

	  container.css({  
          left: (pos.left + width) + 'px',  
          top: pos.top - 50 + 'px'  
      });
	
	  worktime = '';

	  switch($('#n' + this.id).html()){

		  case 'Банско':
			worktime = '<br /><span style="font-weight: normal; text-transform: lowercase">Работи всеки ден от 8:30 до 16:30</span>';
		  break;

		  case 'Боровец':
			worktime = '<br /><span style="font-weight: normal; text-transform: lowercase">Работи всеки ден от 8:30 до 16:30 .Поради профилактика не работи всеки последен четвъртък от месеца до 12 часа</span>';
		  break;

		  case 'Пампорово':
			worktime = '<br /><span style="font-weight: normal; text-transform: lowercase">Работи всеки ден 8:30 до 17:00</span>';
		  break;

		  case 'Паничище':
			worktime = '<br /><span style="font-weight: normal; text-transform: lowercase">Работи Сряда, Четвърък, Петък, Събота, Неделя</span>';
		  break;

	  }
		
	  $('#n' + this.id).css('background', '#ffff99');
	  container.fadeIn();
	  $('#box-resort').html($('#n' + this.id).html() + worktime);
	  $('#box-comment').html($('#comment_' + id).html());
	  
  }, function(){
	
	  $('#n' + this.id).css('background', '#ffffff');	
	  container.hide();
  
  });  
});     

function videoSubmit() {
    document.getElementById('uploadInfo').style.display='';
}

function popPage(width, height, scrollbar, name) {
	
	var theURL = 'http://www.proamsports.bg/'+name;
	
	
	newWindow =
	window.open(theURL,'newWindow','toolbar=no,menubar =no,resizable=yes,scrollbars='+scrollbar+',status=no,location =no,width='+width+',height='+height);
}

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Невалиден E-mail адрес!")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Невалиден E-mail адрес!")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Невалиден E-mail адрес!")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Невалиден E-mail адрес!")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Невалиден E-mail адрес!")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Невалиден E-mail адрес!")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Невалиден E-mail адрес!")
		    return false
		 }
		 
		 return true;				
	}

function popCam(theURL, w, h) {
	newWindow = window.open(theURL,'newWindow','toolbar=0,menubar=0,resizable=yes,scrollbars=1,status=0,location=0,width='+w+',height='+h+'');
}
