function checkItcart()
{ // функция проверки полей формы

  if (document.forms.qorder.name.value != ""){} else
  {
    alert("\nПоле \"Имя\" не заполенно. \n\nПожалуйста, введите Ваше имя!");
    document.forms.qorder.name.focus();
    return false;
  }

  if (document.forms.qorder.email.value != "")
  {} else
  {
    alert("\nПоле \"email\" не заполенно. \n\nПожалуйста, введите email!");
    document.forms.qorder.email.focus();
    return false;
  }

  var phone=document.forms.qorder.phone.value;

  if (phone != "")
  {
    if(phone.length<7 || phone.length>20)
    {
        alert("\nНомер введен неверно. \n\nПожалуйста, введите правильный номер телефона!");
        document.forms.qorder.phone.focus();
        return false;
    }
  } else
  {
    alert("\nПоле \"Телефон\" не заполенно. \n\nПожалуйста, введите Ваш телефон!");
    document.forms.qorder.phone.focus();
    return false;
  }

  if (document.forms.qorder.direction.value != "")
  {} else
  {
    alert("\n Не выбрано направление отдыха, выбирете пожалуйста нужное направление");
    document.forms.qorder.direction.focus();
    return false;
  }



if(($('deliver_0').checked=='0') && ($('deliver_1').checked=='0') && ($('deliver_2').checked=='0') && ($('deliver_3').checked=='0') && ($('deliver_4').checked=='0') && ($('deliver_5').checked=='0'))
{
  alert("Не выбран способ доставки");
  return false;
}
else
{
  if($('deliver_0').checked!='1')
  {
    if (document.forms.qorder.city.value != "")
    {} else
    {
      alert("\nПоле \"Город\" не заполенно. \n\nПожалуйста, введите Ваш город!");
      document.forms.qorder.city.focus();
      return false;
    }

    if (document.forms.qorder.street.value != "")
    {} else
    {
      alert("\nПоле \"Улица\" не заполенно. \n\nПожалуйста, введите Вашу улицу!");
      document.forms.qorder.street.focus();
      return false;
    }

    if (document.forms.qorder.house.value != "")
    {}
    else
    {
      alert("\nПоле \"Улица\" не заполенно. \n\nПожалуйста, введите Вашу улицу!");
      document.forms.qorder.house.focus();
      return false;
    }
  }
}
}

function preventSelection(element){
var preventSelection = false;
function addHandler(element, event, handler){
if (element.attachEvent)
element.attachEvent('on' + event, handler);
else
if (element.addEventListener)
element.addEventListener(event, handler, false);
}

function removeSelection(){
if (window.getSelection) { window.getSelection().removeAllRanges(); }
else if (document.selection && document.selection.clear)
document.selection.clear();
}

function killCtrlA(event){
var event = event || window.event;
var sender = event.target || event.srcElement;
if (sender.tagName.match(/INPUT|TEXTAREA/i))
return;
var key = event.keyCode || event.which;
if (event.ctrlKey && key == 'A'.charCodeAt(0))  // 'A'.charCodeAt(0) можно заменить на 65
{
removeSelection();
if (event.preventDefault)
event.preventDefault();
else
event.returnValue = false;
}
}
// не даем выделять текст мышкой
addHandler(element, 'mousemove', function(){
if(preventSelection)
removeSelection();
});
addHandler(element, 'mousedown', function(event){
var event = event || window.event;
var sender = event.target || event.srcElement;
preventSelection = !sender.tagName.match(/INPUT|TEXTAREA/i);
});
// борем dblclick
// если вешать функцию не на событие dblclick, можно избежать
// временное выделение текста в некоторых браузерах
addHandler(element, 'mouseup', function(){
if (preventSelection)
removeSelection();
preventSelection = false;
});
// борем ctrl+A
// скорей всего это и не надо, к тому же есть подозрение
// что в случае все же такой необходимости функцию нужно
// вешать один раз и на document, а не на элемент
addHandler(element, 'keydown', killCtrlA);
addHandler(element, 'keyup', killCtrlA);
}


//следующая картинка
function set_photo(id)
{
		var url = 'prot_func.inc.php';
    var div='photo';
    $(div).innerHTML = "<center><img src='./images/loading.gif' align=absmiddle></center>";
    //id=$("photo_id").value;
		var pars = 'id=' + id + '&mode=set_photo';
		var myAjax = new Ajax.Request(
					url,
					{method: 'post', parameters: pars, onComplete: showResponse}
					);

    function showResponse(originalRequest)
    {
		  //put returned XML in the textarea
		  $(div).innerHTML = originalRequest.responseText;
      //alert(originalRequest.responseText);
    }
}
//следующая картинка
//предыдующая картинка
function prev_photo()
{
		var url = 'prot_func.inc.php';
    var div='photo';
    $(div).innerHTML = "<center><img src='./images/loading.gif' align=absmiddle></center>";
    //id=$("photo_id").value;
		var pars = 'mode=prev_photo';
		var myAjax = new Ajax.Request(
					url,
					{method: 'post', parameters: pars, onComplete: showResponse}
					);

    function showResponse(originalRequest)
    {
		  //put returned XML in the textarea
		  $(div).innerHTML = originalRequest.responseText;
      //alert(originalRequest.responseText);
    }
}
//предыдующая картинка
//следующая картинка
function next_photo()
{
		var url = 'prot_func.inc.php';
    var div='photo';
    $(div).innerHTML = "<center><img src='./images/loading.gif' align=absmiddle></center>";
    //id=$("photo_id").value;
		var pars = 'mode=next_photo';
		var myAjax = new Ajax.Request(
					url,
					{method: 'post', parameters: pars, onComplete: showResponse}
					);

    function showResponse(originalRequest)
    {
		  //put returned XML in the textarea
		  $(div).innerHTML = originalRequest.responseText;
      //alert(originalRequest.responseText);
    }
}
//следующая картинка

//Смена превьюшек
function change_preview(id)
{
		var url = 'preview.inc.php';
    var div='preview';
    $(div).innerHTML = "<center><img src='./images/loading.gif' align=absmiddle></center>";
		var pars = 'id=' + id + '&mode=script';
		var myAjax = new Ajax.Request(
					url,
					{method: 'post', parameters: pars, onComplete: showResponse}
					);

    function showResponse(originalRequest)
    {
		  //put returned XML in the textarea
		  $(div).innerHTML = originalRequest.responseText;
      //alert(originalRequest.responseText);
    }
}
//Смена превьюшек

function leftmenu_2(imgid,status)
{
  if(status==1)clas="lmenu_2";else clas="lmenu_2_on";
  //alert($(imgid).className);
  document.getElementById(imgid).className=clas;
  $(imgid).className=clas;

}

function leftmenu_1(imgid,status)
{
  if(status==1)clas="lmenu_1";else clas="lmenu_1_on";
  //alert($(imgid).className);
  document.getElementById(imgid).className=clas;
  $(imgid).className=clas;

}

function ShowPhoto(path,w,h,name)
{
  h+=30;
  v=window.open ('', 'view', 'scrolling=no,height='+h+',width='+w);
  with (v.document)
{
 open ();
  write('<html><head><title>'+name+'</title></head><body topmargin=0 leftmargin=0 marginheight=0 marginwidth=0     bgcolor="#f0eeff"><table cellspacing="0" cellpadding="0" border="0"><tr><td align><img src="'+path+'"     border=0></td></tr><tr><td align="center" valign="middle" height="30"><a href="javascript:;" onClick="window.close()"><font color="000000">[ закрыть окно ]</font></a></td></tr></table></body></html>');
  close ();
}
	return false;
}

(function()
{
/*if not IE, do nothing*/
if(!document.uniqueID){return;};

/*Copy the default setInterval behavior*/
var nativeSetInterval = window.setInterval;
window.setInterval = function(fn,ms)
{
		var param = [];
		if(arguments.length<=2)
		{
			return nativeSetInterval(fn,ms);
		}
		else
		{
			for(var i=2;i<arguments.length;i+=1)
			{
				param[i-2] =  arguments[i];
			}


		}

		if(typeof(fn)=='function')
		{

			return (function (fn,ms,param)
			{
				var fo = function ()
				{
					fn.apply(window,param);
				};
				return nativeSetInterval(fo,ms);
			})(fn,ms,param);
		}
		else if(typeof(fn)=='string')
		{
			return  nativeSetInterval(fn,ms);
		}
		else
		{
			throw Error('setInterval Error\nInvalid function type');
		};
};

})()

/* Browser detection code by Kruglov */
isDOM=document.getElementById //DOM1 browser (MSIE 5+, Netscape 6, Opera 5+)
isOpera=isOpera5=window.opera && isDOM //Opera 5+
isOpera6=isOpera && window.print //Opera 6+
isOpera7=isOpera && document.readyState //Opera 7+
isMSIE=document.all && document.all.item && !isOpera //Microsoft Internet Explorer 4+
isMSIE5=isDOM && isMSIE //MSIE 5+
isNetscape4=document.layers //Netscape 4.*
isMozilla=isDOM && navigator.appName=="Netscape" //Mozilla или Netscape 6.*
/* End code */


/* Div scroll by Pimenov Dmitriy */
var timer;
var divWidth = 850;
var divHeight = 128;
var scrollWidth = 0;
var scrollHeight = 0;
var scrollSpeed = 3;
var scrollStep = 50;

if(isNetscape4 || isMozilla)
{
        scrollWidth = 18;
        scrollHeight = 18;
}
else
{
        scrollWidth = 16;
        scrollHeight = 16;
}

function myScrollStart(dir)
{
        if(dir == 'up')
        {
                timer=setInterval('myScrollUp()', scrollStep);
        }
        else
        {
                timer=setInterval('myScrollDown()', scrollStep);
        }
}

function myScrollStartu(dir)
{
        if(dir == 'left')
        {
                timer=setInterval('myScrollleft()', scrollStep);
        }
        else
        {
                timer=setInterval('myScrollright()', scrollStep);
        }
}

function myScrollUp()
{
        document.getElementById('divscroll').style.width = (divWidth+scrollWidth)+'px';
        document.getElementById('divscroll').style.overflow='auto';
        document.getElementById('divscroll').scrollTop-=scrollSpeed;
}

function myScrollDown()
{
        document.getElementById('divscroll').style.width = (divWidth+scrollWidth)+'px';
        document.getElementById('divscroll').style.overflow='auto';
        document.getElementById('divscroll').scrollTop+=scrollSpeed;
}

function myScrollTop()
{
        document.getElementById('divscroll').style.width = (divWidth+scrollWidth)+'px';
        document.getElementById('divscroll').style.overflow='auto';
        document.getElementById('divscroll').scrollTop=0;
}

function myScrollBottom()
{
        document.getElementById('divscroll').style.width = (divWidth+scrollWidth)+'px';
        document.getElementById('divscroll').style.overflow='auto';
        document.getElementById('divscroll').scrollTop=10000;
}

function myScrollleft()
{
        document.getElementById('divscroll').style.height = (divWidth+scrollHeight)+'px';
        document.getElementById('divscroll').style.overflow='auto';
        document.getElementById('divscroll').scrollLeft-=scrollSpeed;
}

function myScrollright()
{
        document.getElementById('divscroll').style.height = (divWidth+scrollHeight)+'px';
        document.getElementById('divscroll').style.overflow='auto';
        document.getElementById('divscroll').scrollLeft+=scrollSpeed;
}

function myScrollLeft()
{
        document.getElementById('divscroll').style.height = (divWidth+scrollHeight)+'px';
        document.getElementById('divscroll').style.overflow='auto';
        document.getElementById('divscroll').scrollLeft=0;
}

function myScrollRight()
{
        document.getElementById('divscroll').style.height = (divWidth+scrollHeight)+'px';
        document.getElementById('divscroll').style.overflow='auto';
        document.getElementById('divscroll').scrollLeft=10000;
}

function myScrollClear()
{
        clearInterval(timer);
}
/* End code */

function ChangeImg() {
 if(document.images) {
  eval("document."+ChangeImg.arguments[0]+
  ".src=('"+ChangeImg.arguments[1]+"')");
 }
}
function showMenu(obj, menuID, align){
    //debugger;
    menuStack[currentStackIndex].className=obj.className;
    obj.className="MenuHot";
    clearTimeout(timer);
    pTop=0;
    pLeft=0;
    var currentMenuID=getParentDivID(obj);
    hideAllTo(currentMenuID);
    var menu=document.all? document.all(menuID) : document.getElementById(menuID);
    //window.alert("menuID : "+typeof(menuID)+"\nmenu : "+typeof(menu)+"\ndoc.all : "+document.all+"\ndoc.all(menuID) : "+typeof(document.all(menuID))+"\t\n"+document.getElementById(menuID)+"\nisTrue : "+document.getElementById(menuID).tagName);
    if (menu==undefined) return;
    menuStack[++currentStackIndex]=new menuItem(menuID);
    getAbsolutPosition(obj);
    menu.style.top=pTop;
    if (align==undefined){
        menu.style.left=pLeft+obj.offsetWidth;
        menu.style.display="block";
        }
    else
    {
        window.alert();
        menu.style.visibility="hidden";
        menu.style.display="block";
        menu.style.left=pLeft-menu.offsetWidth;
        menu.style.visibility="visible";
        }
    }

function show_hide(elmnt)
{
 document.getElementById(elmnt).style.display=(document.getElementById(elmnt).style.display != 'block' ? 'block' : 'none');
}

function sMenu(obj, menu, align)
{

  pTop=0;
  pLeft=0;
  getAbsolutPosition(obj);
  if (align=="left")
  {
    //window.alert(menu);
    //document.getElementById(menu).offsetWidth=obj.offsetWidth='px';
    //document.getElementById(menu).style.left=pLeft - 250 + 'px';
    document.getElementById(menu).style.left=pLeft - obj.offsetWidth + 'px';
    //document.getElementById(menu).style.left=pLeft - document.getElementById(menu).offsetWidth+'px';
    document.getElementById(menu).style.top=pTop+'px';
    document.getElementById(menu).style.display = 'block';
  }
  else if (align=="down")
  {
    document.getElementById(menu).style.left=pLeft-9+'px';
    document.getElementById(menu).style.top=pTop+obj.offsetHeight+'px';
    document.getElementById(menu).style.display = 'block';
  }
  else
  {
    pTop=pTop-5+'px';
    //document.getElementById(menu).style.left=pLeft+obj.offsetWidth+'px';
    document.getElementById(menu).style.left=100+'px';
    document.getElementById(menu).style.top=pTop;
    document.getElementById(menu).style.display = 'block';
  }
}

function getAbsolutPosition(obj)
{
  //      debugger;
  pObj=obj.offsetParent;
  //window.alert(obj.tagName);
  //window.alert(pObj.tagName);
  if (pObj.tagName!="BODY")
  {
    getAbsolutPosition(pObj)
  }
  pTop=pTop+obj.offsetTop;
  pLeft=pLeft+obj.offsetLeft;
}

function hMenu(obj, menu)
{
  //obj.className="menul3";
  document.getElementById(menu).style.display = 'none';
}

function showdate()
{
  today=new Date();// Build an array initializer
  function isnArray()
  {
    argnr=isnArray.arguments.length
    for (var i=0;i<argnr;i++)
    {
      this[i+1] = isnArray.arguments[i];
    }
  }
  // And months and day arrays
  var isnMonths=new   isnArray("Января","Февраля","Марта","Апреля","Мая","Июня","Июля","Августа","Сентября","Октября","Ноября","Декабря");
  var thisyear = today.getFullYear(); // varies in JavaScript and JScript

  var isnDays=new   isnArray("Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота");
  var thisday = today.getDay(); // varies in JavaScript and JScript

  document.write(" "+isnDays[today.getDay()+1]+",  "+today.getDate()+" "+isnMonths[today.getMonth()+1]+"  "+thisyear+" г.")
}

