 function intnext(force,page)
 {
  var req = new Subsys_JsHttpRequest_Js();
  req.onreadystatechange = function()
  {
   if (req.readyState == 4)
   {
    if (req.responseJS)
    {
      document.getElementById("tdbigleft").innerHTML = req.responseText;
    }
   }
  }
  req.caching = false;
  req.open('GET', 'func.php?do=intnavi', true);
  req.send({ q: page , test:303 });
  document.getElementById("tdbigleft").innerHTML = '<div style="margin-top:50%;padding-left:50%"><img src="/photo/_img/indicate.gif"></div>';
  document.getElementById("leftbar").src = '/alyarma/_img/ratingAll.gif';
 }

 function smsnext(force,page)
 {
  var req = new Subsys_JsHttpRequest_Js();
  req.onreadystatechange = function()
  {
   if (req.readyState == 4)
   {
    if (req.responseJS)
    {
      document.getElementById("tdbigright").innerHTML = req.responseText;
    }
   }
  }
  req.caching = false;
  req.open('GET', 'func.php?do=smsnavi', true);
  req.send({ q: page , test:303 });
  document.getElementById("tdbigright").innerHTML = '<div style="margin-top:50%;padding-left:50%"><img src="/photo/_img/indicate.gif"></div><br><br><br>';
 }
 function big(force,photo,page)
 {
  var req = new Subsys_JsHttpRequest_Js();
  req.onreadystatechange = function()
  {
   if (req.readyState == 4)
   {
    if (req.responseJS)
    {
      document.getElementById("tdbigleft").innerHTML = req.responseText;
    }
   }
  }
  req.caching = false;
  req.open('GET', 'func.php?do=big', true);
  req.send({ q: photo , page: page, test:303 });

  document.getElementById("tdbigleft").innerHTML = '<div style="margin-top:50%;padding-left:50%"><img src="/photo/_img/indicate.gif"></div><br><br><br>';
  document.getElementById("leftbar").src = '/photo/_img/ratingBig.gif';
 }

 function rait(photo,now,с_now,c_mes)
 {
  var req = new Subsys_JsHttpRequest_Js();
  req.onreadystatechange = function()
  {
   if (req.readyState == 4)
   {
    if (req.responseJS)
    {
	  document.getElementById(с_now).innerHTML = (req.responseJS.now||'undefined');
      document.getElementById(photo).innerHTML = (req.responseJS.res||'undefined');
      document.getElementById(c_mes).innerHTML = (req.responseJS.mes||'undefined');
      document.getElementById("c_int").innerHTML = (req.responseJS.int||'undefined');
    }
   }
  }
  req.caching = false;
  req.open('GET', 'func.php?do=rait', true);
  req.send({ q: photo , now: now, test:303});

  document.getElementById(photo).innerHTML = '<img src="/photo/_img/indicatq.gif">';
 }

var glob = 1;
function select_block_com(way,foto)
{
	if(glob == 1){
    	var id=way;
    	var block=document.getElementById('addblock1');
		block.style.display='block';
		glob=2;
		show_comments(foto,1);
    }
    else{
    	var block=document.getElementById('addblock1');
		block.style.display='none';
		glob=1;
    }

}

function show_comments(foto,page)
 {
  var req = new Subsys_JsHttpRequest_Js();
  req.onreadystatechange = function()
  {
   if (req.readyState == 4)
   {
    if (req.responseJS)
    {
      document.getElementById("comm_count").innerHTML = (req.responseJS.total||"undefined");
      document.getElementById("comm_list").innerHTML = (req.responseText||'undefined');
    }
   }
  }
  req.caching = false;
  req.open('GET', 'func.php?do=getcomm', true);
  req.send({ q: foto , page: page, test:303});

  document.getElementById("comm_list").innerHTML = '<img src="/photo/_img/indicatq.gif" style="padding-top:20px; padding-left:50%;" align="center" >';
 }

function save_comment(data){

 	if(add_new_comment.comm_name.value == ""){
 		alert("Введите свое имя!");
 		return false;
 	}
    if(add_new_comment.comm_cod.value == ""){
 		alert("Введите код подтверждения!");
 		return false;
 	}
	if(add_new_comment.comm_text.value == ""){
 		alert("Введите комментарий!");
 		return false;
 	}

 	var req = new Subsys_JsHttpRequest_Js();
  	req.onreadystatechange = function()
  	{
   		if (req.readyState == 4)
   		{
    		if (req.responseJS)
    		{
      			if(req.responseJS.q=="ok"){
      				show_comments(add_new_comment.photo_id.value,1);
      			}
      			document.getElementById("add_button").innerHTML = (req.responseJS.report||"undefined");
    		}
   		}
    }
    req.caching = false;
    req.open('GET', 'func.php?do=comm', true);
    req.send({ q: 1 ,photo_id:add_new_comment.photo_id.value,comm_name:add_new_comment.comm_name.value,compare:add_new_comment.compare.value,comm_cod:add_new_comment.comm_cod.value,comm_text:add_new_comment.comm_text.value, test:303});
    document.getElementById("add_button").innerHTML = '<img src="/photo/_img/indicatq.gif">';
}
