var bookmarkurl="http://www.more.ua"
var bookmarktitle="More.ua - Все о Крыме"
function bookmark()
{
    var ver = navigator.appName;
    var num = parseInt(navigator.appVersion);
    if ((ver == "Microsoft Internet Explorer")&&(num >= 4)) {
    	window.external.AddFavorite(bookmarkurl,bookmarktitle);
    }else{
		if (window.sidebar){
			window.sidebar.addPanel(bookmarktitle, bookmarkurl, "")
		}else{
    		alert("Press CTRL+D");
    	}
    }
}
function checkDates(date_from, date_to)
{
	re = /(\d\d)-(\d\d)-(\d\d\d\d)/;
	if ( match_from = date_from.match(re) ){
    	day_from 	= match_from[1];
    	month_from  = match_from[2];
    	year_from	= match_from[3];
    	date_from   = year_from.concat(month_from, day_from);
    }else{
    	return false;
    }
	if ( match_to = date_to.match(re) ){
    	day_to		= match_to[1];
    	month_to	= match_to[2];
    	year_to		= match_to[3];
    	date_to		= year_to.concat(month_to, day_to);
	}else{
		return false;
	}
	if ( day_from.length == 2 && month_from.length == 2 && year_from.length == 4 &&
		 day_to.length == 2 && month_to.length == 2 && year_to.length == 4 &&
		 date_from < date_to )
	{
		oDateFrom = new Date(Date.parse(month_from.concat('/', day_from, '/', year_from)));
		oDateTo   = new Date(Date.parse(month_to.concat('/', day_to, '/', year_to)));
		if ( (oDateFrom.getMonth() + 1) == month_from &&
   			  oDateFrom.getDate() 	    == day_from &&
//   			  oDateFrom.getYear()       == year_from &&
			 (oDateTo.getMonth() + 1) 	== month_to &&
   			  oDateTo.getDate() 	    == day_to
//   			 && oDateTo.getYear()       	== year_to
   			  )
   		{
			return true;
		}
		else
		{
			return false;
		}
	}
	return false;
}
function CheckTheDates()
{
    if (document.main_form.d1.value=='' && document.main_form.d2.value=='') return true;
    if (!checkDates(document.main_form.d1.value, document.main_form.d2.value)){
       alert("Введите, пожалуйста, правильные даты.");
       document.main_form.d1.focus();
       return false;
    }
}

function checkdate()
{
    if (!checkDates(document.form1.str_date_from.value, document.form1.str_date_to.value)){
       alert("Введите, пожалуйста, правильные даты.");
       document.form1.str_date_from.focus();
       return false;
    }
}
function confirmLink(theQuery)
{
    var is_confirmed = confirm(theQuery+' ?');
    return is_confirmed;
}


$(document).ready (
	function ()
	{
        $("#orderform").click(function(){

            oderform = window.open(this.href, 'Заявка на бронирование', 'width=660, height=570, scrollbars=0, resizable=1');
            oderform.focus();
			return false;
		});
    });
$(document).ready(function() {
    $(".comm").addClass("hide");
    $("h6").click(function() {
        $(".comm").toggleClass("hide");
    });


});

function CloseOrderWindow(url){
  if (opener){
    if (opener.closed)
      window.open(url, "");
    else if (opener.location.href.search(url) == -1)
      opener.location.href = url;
    self.close();
    return false;
  }
  return true;
}
