var xmlHttp;
var xmlHttp1;
var xmlHttp4;
var xmlHttp2;
//////////////////////add comment/////////////////
function add_comment()
{
var id=document.comment.photo_id.value;
var comm=document.comment.msg.value;
var page_n=document.comment.paggnname.value;
if(comm=='')
{
alert("Por favor digite Comentário");
return ;
}
var coid=parseInt(document.comment.num_chk_comnt.value);
if(coid>0)
{

	alert("<?php echo a_You_are;?>");
	document.comment.msg.value='';
}else
{

xmlHttp1=GetXmlHttpObject();
if (xmlHttp1==null)
  {
  alert ("<?php echo a_browser_does_not_support_AJAX; ?>");
  return;
  } 

var url="look_comment.php";
url=url+"?id="+id+"&msg="+comm+"&page_n="+page_n;

xmlHttp1.onreadystatechange=comment_stateChanged;
xmlHttp1.open("GET",url,true);
xmlHttp1.send(null);
}
}
function comment_stateChanged() 
{ 

if (xmlHttp1.readyState==4)
{ 
var test_=xmlHttp1.responseText;
var text_array=test_.split("alada123");
document.getElementById("menu_ajax1").innerHTML=text_array[2];
document.getElementById("whole_image").innerHTML=text_array[1];
document.getElementById("commentindex").innerHTML=text_array[3];

//document.getElementById('cancel').value='';

}
}

/////////////////////////////////////////////////////////////end comment///////

//////////////////////post comment/////////////////

function add_comment1()
{
/*document.getElementById('posr_com_button').style.display='';*/

var id1=document.f3.contestId.value;
var comm1=document.f3.post_comm.value;
var user_id_u=document.f3.photo_userId.value;
var page_n=document.f3.paggnname.value;
if(comm1=='')
{
alert("Por favor digite Comentário");
return ;
}
if(user_id_u==1)
{
alert("<?php echo b_Sorry_its_your;?>");

document.f3.post_comm.value='';

/*document.getElementById('post_com').style.display='none';*/
return false;
}
var coid=parseInt(document.f3.num_chk_comnt.value);
if(coid>0)
{
	alert("<?php echo b_you_are_blocked;?>");
	document.f3.post_comm.value='';
  /*  document.getElementById('post_com').style.display='none';*/
}
else
{
/*document.getElementById('post_com').style.display='none';*/
xmlHttp2=GetXmlHttpObject();
if (xmlHttp2==null)
  {
  alert ("<?php echo a_browser_does_not_support_AJAX; ?>");
  return;
  } 
var url="add_comment.php";
url=url+"?id1="+id1+"&msg1="+comm1+"&page_n="+page_n;
xmlHttp2.onreadystatechange=comment1_stateChanged;
xmlHttp2.open("GET",url,true);
xmlHttp2.send(null);
}
}
function comment1_stateChanged() 
{ 
if (xmlHttp2.readyState==4)
{ 

var test_1=xmlHttp2.responseText;
document.getElementById("show_com").innerHTML=test_1;
document.getElementById('cancel').value='';
}
}
////////////////////////////////////////////////////////////end comment///////
function look_design(look_name)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("<?php echo a_browser_does_not_support_AJAX;?>");
  return;
  } 

var url="look_show.php";
url=url+"?look="+look_name;
xmlHttp.onreadystatechange=data1_stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 
function data1_stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
var test_=xmlHttp.responseText;
var text_array=test_.split("alada123");
document.getElementById("menu_ajax1").innerHTML=text_array[1];
document.getElementById("whole_image").innerHTML=text_array[0];
document.getElementById("commentindex").innerHTML=text_array[2];
var notes = new PhotoNoteContainer(document.getElementById('PhotoContainer'));
eval(text_array[3]);

}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
  xmlHttp=new XMLHttpRequest();
 }

catch (e)
  {
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }

  }
return xmlHttp;
}