// JavaScript Document
function init()
{
	
	var toolbarxml = '<?xml version="1.0" encoding="utf-8"?>';
    toolbarxml += '<toolbar id="toolbarthis.uid" title="Grid" height="23" width="110" image_directory="imagedir">'; 
    toolbarxml += '<items>';
    toolbarxml += '</items>';
    toolbarxml += '</toolbar>';
    nitobi.grid.toolbarDoc = nitobi.xml.createXmlDoc(toolbarxml);
	
	var myGrid = nitobi.initGrid('myGrid');
	
	
}


function edit(eventArgs)
{
	    var myRow = eventArgs.cell.getRow();
		
		var myMasterGrid = nitobi.getComponent('myGrid');
		var resturant_id = myMasterGrid.getCellObject(myRow,0).getValue();
		url1='view_restaurant.php?resturant_id='+resturant_id;
		window.open(url1,'edit_resturant',"toolbar=yes,location=yes, directories=no, status=yes, menubar=no,scrollbars=yes, resizable=yes, width=800, height=600");
		//location.href= url1;
		myMasterGrid.refresh()
		return true;

}

function mydelete(eventArgs)
{
	    var myRow = eventArgs.cell.getRow();
		
		var myMasterGrid = nitobi.getComponent('myGrid');
		var resturant_id = myMasterGrid.getCellObject(myRow,0).getValue();
		url1='delete_restaurant.php?resturant_id='+resturant_id;
		//view(url1);
		window.open(url1,'delete_restaurant',"toolbar=yes,location=yes, directories=no, status=yes, menubar=no,scrollbars=yes, resizable=no, width=600, height=600");
		//location.href=url1;
		myMasterGrid.Refresh()
		return true;

}

function showdetails()

{
	var myMasterGrid = nitobi.getComponent('myGrid');
	var serkey=document.getElementById('search1').value;
	var seruser=document.getElementById('user1').value;
	myMasterGrid.getDataSource().setGetHandlerParameter('usr',seruser);

	myMasterGrid.getDataSource().setGetHandlerParameter('key',serkey);
	myMasterGrid.dataBind();
}


function showhide()
{
	
 if(document.getElementById('rtype').checked == true)
 {
 	 document.getElementById('paid').style.display = "";
	 document.getElementById('nonpaid').style.display = "none";
    }
 
 if(document.getElementById('rtype1').checked == true)
 {
  	 document.getElementById('nonpaid').style.display = "";
	 document.getElementById('paid').style.display = "none";
	 
  }
}

function showimage(eventArgs)
{
	    var myRow = eventArgs.cell.getRow();
		
		var myMasterGrid = nitobi.getComponent('myGrid');
		var resturant_id = myMasterGrid.getCellObject(myRow,0).getValue();
		url1='show_resturant_image.php?resturant_id='+resturant_id;
		//view(url1);
		window.open(url1,'show_image','height=300,width=500');
		//location.href=url1;
		myMasterGrid.Refresh()
		return true;

}


function showReview(resturant_id)
{
		//view(url1);
		var url1="add_reviews.php?resturant_id="+resturant_id;
		
		window.open(url1,null,"toolbar=yes,location=yes, directories=no, status=yes, menubar=no,scrollbars=yes, resizable=yes, width=800, height=600");
//document.getElementById('review').style.display = "";
}


function deleteResturant(resturant_id)
 {
	if(window.confirm('Are you sure you want to change the status of this restaurant?'))
	{
	location.href = 'delete_restaurant.php?resturant_id='+resturant_id;
	}
 }

function addfavorite(resturant_id)
 {
	if(window.confirm('Are you sure you want to Add this restaurant as your favorite?'))
	{
	location.href = 'favourite_restaurant.php?resturant_id='+resturant_id;
	}
 }


function editComments(review_id)
 {
	//alert(review_id);
	url1='../edit_comments.php?cid='+review_id;
		//view(url1);
		window.open(url1,'edit_comments',"toolbar=yes,location=yes, directories=no, status=yes, menubar=no,scrollbars=yes, resizable=yes, width=800, height=800");
		return true;
 }


function editComment(review_id)
 {
	//alert(review_id);
	url1='edit_comments.php?cid='+review_id;
		//view(url1);
		window.open(url1,'edit_comments',"toolbar=yes,location=yes, directories=no, status=yes, menubar=no,scrollbars=yes, resizable=YES, width=800, height=600");
		return true;
 }





