// JavaScript Document
function doLogin(){
	var user = document.getElementById("user").value;
	var pass = document.getElementById("pass").value;
	document.getElementById("login").innerHTML ='<img src=images/loading.gif>';
	getDataReturnText('news/do_login.php?user='+user+'&&pass='+pass,displayErr);
	getDataReturnText('news/news_render_list.php?page=1',displayNews);
	showLogin();
	
}

function logout(){
	getDataReturnText('news/do_login.php?logout=1',displayLogout);
}

function showLogin(){
	getDataReturnText('news/news_login.php',displayLogin);
//	getDataReturnText('news/news_render_list.php?page=1',displayNews);
	
}

function pageRefer(page){
	
	getDataReturnText('news/news_render_list.php?page='+page,displayNews);
	
}


function deletenews(id, h){
	var  $dl = confirm("Do you want to delete >> " +h);
	if ($dl) {
			getDataReturnText('news/delete.php?n_id='+id,displayNews);
			getDataReturnText('news/news_render_list.php?page=1',displayNews);
	}
}


function displayErr(text){
	document.getElementById("ERR").innerHTML = text;
}
function displayNews(text){
		document.getElementById("news").innerHTML ='<img src=images/loading.gif>';
	document.getElementById("news").innerHTML = text;
}

function displayLogin(text){
	document.getElementById("login").innerHTML = text;
}

function displayLogout(text){
	document.getElementById("logout").innerHTML = text;
	getDataReturnText('news/news_render_list.php?page=1',displayNews);
}


function popup_details(w){
  	        window.open(w,"popup_details","toolbar=no,location=no,directories=no,menubar=no,resizable=no,scrollbars=no,status=no,width=560,height=604");
	 }
function popup_admin(w){
  	        window.open(w,"popup_admin","toolbar=no,location=no,directories=no,menubar=no,resizable=no,scrollbars=no,status=no,width=550,height=550");
	 }
	 

/*
Auto center window script- Eric King (http://redrival.com/eak/index.shtml)
Permission granted to Dynamic Drive to feature script in archive
For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/


function zoomPainting(page){
 window.open(page,"PaintngDetails","toolbar=no,location=no,directories=no,menubar=no,resizable=yes,scrollbars=no,status=no,width=500,height=650");
}

