/*
Page:           comments_order.js
Created:        Sep'25 2008
Last Mod:       Sep'25 2008
Handles actions and requests for Glass rating
--------------------------------------------------------- 
Created : Arulkumar.V
--------------------------------------------------------- */




var xmlhttp=null;
try  {
  // Firefox, Opera 8.0+, Safari
  xmlhttp=new XMLHttpRequest();
} catch (e)  {
  // Internet Explorer
  try	{
	xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
  }  catch (e)	{
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
}

function commentsOrderDelete(BASE_URL,clubid,dayid,comment_id) {
	if(confirm("Are you sure you want to delete your comment?")) {
		var order = "";
		if(document.getElementById("hidd_order")) {
			order = document.getElementById("hidd_order").value;	
		}
		if(order=="") {
			order = "comment_id";		
		}
		document.getElementById('loading').innerHTML = '<div class="loading"></div>';
		xmlhttp.open('get', BASE_URL+'ajax_includes/ajax_comments_order.php?action=delete&comment_id='+comment_id+'&clubid='+clubid+'&dayid='+dayid+'&order='+order);
		//xmlhttp.onreadystatechange = handleResponse(clubid,dayid,commentid) ;
		xmlhttp.onreadystatechange = commenthandleResponse2;
		xmlhttp.send(null);	
	}
}

function commentsOrder(BASE_URL,clubid,dayid,order) {
	if(document.getElementById("hidd_order")) {
		document.getElementById("hidd_order").value = order;	
	}
	//alert('ajax_includes/ajax_comments_rating.php?clubid='+clubid+'&dayid='+dayid+'&commentid='+commentid+'&rating=UP');
	document.getElementById('loading').innerHTML = '<div class="loading"></div>';
    xmlhttp.open('get', BASE_URL+'ajax_includes/ajax_comments_order.php?clubid='+clubid+'&dayid='+dayid+'&order='+order);
    //xmlhttp.onreadystatechange = handleResponse(clubid,dayid,commentid) ;
	xmlhttp.onreadystatechange = commenthandleResponse2;
    xmlhttp.send(null);	
}

function commentsOrderListDelete(BASE_URL,clubid,dayid,comment_id) {	
	if(confirm("Are you sure you want to delete your comment?")) {
		var order = "";
		if(document.getElementById("hidd_order")) {
			order = document.getElementById("hidd_order").value;	
		}
		if(order=="") {
			order = "comment_id";		
		}
		//alert('ajax_includes/ajax_comments_rating.php?clubid='+clubid+'&dayid='+dayid+'&commentid='+commentid+'&rating=UP');
		document.getElementById('loading').innerHTML = '<div class="loading"></div>';
		xmlhttp.open('get', BASE_URL+'ajax_includes/ajax_comments_order_list.php?action=delete&comment_id='+comment_id+'&clubid='+clubid+'&dayid='+dayid+'&order='+order);
		//xmlhttp.onreadystatechange = handleResponse(clubid,dayid,commentid) ;
		xmlhttp.onreadystatechange = commenthandleResponse3;
		xmlhttp.send(null);
	}
}


function commentsOrderList(clubid,dayid,order) {	
	if(document.getElementById("hidd_order")) {
		document.getElementById("hidd_order").value = order;	
	}
	//alert('ajax_includes/ajax_comments_rating.php?clubid='+clubid+'&dayid='+dayid+'&commentid='+commentid+'&rating=UP');
	//alert('ajax_includes/ajax_comments_rating.php?clubid='+clubid+'&dayid='+dayid+'&commentid='+commentid+'&rating=UP');
	document.getElementById('loading').innerHTML = '<div class="loading"></div>';
    xmlhttp.open('get', 'ajax_includes/ajax_comments_order_list.php?clubid='+clubid+'&dayid='+dayid+'&order='+order);
    //xmlhttp.onreadystatechange = handleResponse(clubid,dayid,commentid) ;
	xmlhttp.onreadystatechange = commenthandleResponse3;
    xmlhttp.send(null);	
}

function commentsOrderListURL(BASE_URL,clubid,dayid,order) {	
	if(document.getElementById("hidd_order")) {
		document.getElementById("hidd_order").value = order;	
	}
	//alert('ajax_includes/ajax_comments_rating.php?clubid='+clubid+'&dayid='+dayid+'&commentid='+commentid+'&rating=UP');
	//alert('ajax_includes/ajax_comments_rating.php?clubid='+clubid+'&dayid='+dayid+'&commentid='+commentid+'&rating=UP');
	document.getElementById('loading').innerHTML = '<div class="loading"></div>';
    xmlhttp.open('get', BASE_URL+'ajax_includes/ajax_comments_order_list.php?clubid='+clubid+'&dayid='+dayid+'&order='+order);
    //xmlhttp.onreadystatechange = handleResponse(clubid,dayid,commentid) ;
	xmlhttp.onreadystatechange = commenthandleResponse3;
    xmlhttp.send(null);	
}

function commentsOrderListDetails(clubid,dayid) {
	//var order = 'comment_id';
	var order = 'comment_id';
	//alert('ajax_includes/ajax_comments_rating.php?clubid='+clubid+'&dayid='+dayid+'&commentid='+commentid+'&rating=UP');
	//document.getElementById('loading').innerHTML = '<div class="loading"></div>';
    xmlhttp.open('get', 'ajax_includes/ajax_comments_order_list.php?clubid='+clubid+'&dayid='+dayid+'&order='+order);
    //xmlhttp.onreadystatechange = handleResponse(clubid,dayid,commentid) ;
	xmlhttp.onreadystatechange = commenthandleResponse4;
    xmlhttp.send(null);	
}
function commentsOrderListDetailsAdd(BASE_URL,clubid,dayid) {
	
	
	
	if(TextValidate(document.frm_comment.txt_comments,"the comments")==false) {
		document.frm_comment.txt_comments.focus();		
		return false;	
	}
	document.getElementById('loadingAdd').innerHTML = '<div class="loading"></div>';
	//var name  	  = document.frm_comment.txt_name.value;
	var comments  = document.frm_comment.txt_comments.value;
	//document.frm_comment.txt_name.value = '';
	document.frm_comment.txt_comments.value = '';
	var order = 'full';
	//alert('ajax_includes/ajax_comments_rating.php?clubid='+clubid+'&dayid='+dayid+'&commentid='+commentid+'&rating=UP');
	//document.getElementById('loading').innerHTML = '<div class="loading"></div>';
    xmlhttp.open('get', BASE_URL+'ajax_includes/ajax_comments_order_listAdd.php?clubid='+clubid+'&dayid='+dayid+'&order='+order+'&comments='+comments);
    //xmlhttp.onreadystatechange = handleResponse(clubid,dayid,commentid) ;
	xmlhttp.onreadystatechange = commenthandleResponse4Add;
    xmlhttp.send(null);	
}
function commentsOrderListAdd(BASE_URL,clubid,dayid) {
	
	
	if(TextValidate(document.frm_comment.txt_comments,"the comments")==false) {
		document.frm_comment.txt_comments.focus();		
		return false;	
	}
	document.getElementById('loadingAdd').innerHTML = '<div class="loading"></div>';
	//var name  	  = document.frm_comment.txt_name.value;
	var comments  = document.frm_comment.txt_comments.value;
	//document.frm_comment.txt_name.value = '';
	document.frm_comment.txt_comments.value = '';
	
	var order = 'comment_id';
	//alert('ajax_includes/ajax_comments_rating.php?clubid='+clubid+'&dayid='+dayid+'&commentid='+commentid+'&rating=UP');
	//document.getElementById('loading').innerHTML = '<div class="loading"></div>';
    xmlhttp.open('get', BASE_URL+'ajax_includes/ajax_comments_order_listAdd.php?clubid='+clubid+'&dayid='+dayid+'&order='+order+'&comments='+comments);
    //xmlhttp.onreadystatechange = handleResponse(clubid,dayid,commentid) ;
	xmlhttp.onreadystatechange = commenthandleResponse5Add;
    xmlhttp.send(null);	
}



function commenthandleResponse3() {
  if(xmlhttp.readyState == 4){
		if (xmlhttp.status == 200){
       		document.getElementById('loading').innerHTML = '';
			var responsetext = xmlhttp.responseText;
			
			document.getElementById('usercomment2').innerHTML=responsetext;
			
		}
    }
}

function commenthandleResponse2() {
  if(xmlhttp.readyState == 4){
		if (xmlhttp.status == 200){
       		document.getElementById('loading').innerHTML = '';
			var responsetext = xmlhttp.responseText;
			//response		=	responsetext.split('#');
			document.getElementById('usercomment').innerHTML=responsetext;
			
		}
    }
}
function commenthandleResponse4() {
  if(xmlhttp.readyState == 4){
		if (xmlhttp.status == 200){
       		//document.getElementById('loading').innerHTML = '';
			var responsetext = xmlhttp.responseText;
			//response		=	responsetext.split('#');
			//alert(response[0]);
			//alert(response[1]);
			document.getElementById('usercomment').innerHTML=responsetext;
			
		}
    }
}
function commenthandleResponse4Add() {
  if(xmlhttp.readyState == 4){
		if (xmlhttp.status == 200){
       		document.getElementById('loadingAdd').innerHTML = '';
			document.getElementById('addcomment').style.display = 'none';
			var responsetext = xmlhttp.responseText;
			//response		=	responsetext.split('#');
			//alert(response[0]);
			//alert(response[1]);
			document.getElementById('usercomment2').innerHTML=responsetext;
			
		}
    }
}
function commenthandleResponse5Add() {
  if(xmlhttp.readyState == 4){
		if (xmlhttp.status == 200){
       		document.getElementById('loadingAdd').innerHTML = '';
			document.getElementById('addcomment').style.display = 'none';
			var responsetext = xmlhttp.responseText;
			
			//response		=	responsetext.split('#');
			//alert(response[0]);
			//alert(response[1]);
			document.getElementById('usercomment').innerHTML=responsetext;
			
		}
    }
}




