/** Banners **/
function alertUser() {
	if(document.getElementById('txtCID').value == 1)
		alert("You have selected image type \"Logo\", \nUpon submission logo will be replaced if any uploaded earlier.");
}

function confirmFirst4Banner(id, cat_id) {
	if(confirm("Are you sure you want to delete this image ?")) {
			window.location = "banners.php?loadPage=banner_manage&delete_image=yes&id="+id+"&CatID="+cat_id;	
	}
}
/** Banners **/



function updateNewsStatus(id) {
	xmlHttp1 = createObject();	
	if (xmlHttp1==null) {
		alert ("Your browser does not support AJAX!");
		return;
  	} 
	document.getElementById("divStatus"+id).innerHTML="<img src='../images/ajax-loader.gif' width='16' height='16' />";	
	xmlHttp1.onreadystatechange=function() {
	if(xmlHttp1.readyState==4)	{
			 updated=xmlHttp1.responseText;	
			 title = "Disabled";
			 img = "cross.png";
			 if(updated == 1) {
				title = "Enabled";				 
			 	img = "tick.png";
			 }
			 document.getElementById("divStatus"+id).innerHTML="<img src='../images/admin/"+img+"' border='0' width='16' height='16' alt='"+title+"' title='"+title+"' />";															
		 }
    }
	xmlHttp1.open("GET","ajax.php?section=updateNewsStatus&id="+id,true);
	xmlHttp1.send(null); 
}


function updateMediaStatus(id) {
	xmlHttp1 = createObject();	
	if (xmlHttp1==null) {
		alert ("Your browser does not support AJAX!");
		return;
  	} 
	document.getElementById("divStatus"+id).innerHTML="<img src='../images/ajax-loader.gif' width='16' height='16' />";	
	xmlHttp1.onreadystatechange=function() {
	if(xmlHttp1.readyState==4)	{
			 updated=xmlHttp1.responseText;	
			 title = "Disabled";
			 img = "cross.png";
			 if(updated == 1) {
				title = "Enabled";				 
			 	img = "tick.png";
			 }
			 document.getElementById("divStatus"+id).innerHTML="<img src='../images/admin/"+img+"' border='0' width='16' height='16' alt='"+title+"' title='"+title+"' />";															
		 }
    }
	xmlHttp1.open("GET","ajax.php?section=updateMediaStatus&id="+id,true);
	xmlHttp1.send(null); 
}

/*
function updateStatus(id) {
	xmlHttp1 = createObject();	
	if (xmlHttp1==null) {
		alert ("Your browser does not support AJAX!");
		return;
  	} 
	document.getElementById("divStatus"+id).innerHTML="<img src='../images/ajax-loader.gif' width='16' height='16' />";	
	xmlHttp1.onreadystatechange=function() {
	if(xmlHttp1.readyState==4)	{
			 updated=xmlHttp1.responseText;	
			 title = "Disabled";
			 img = "cross.png";
			 if(updated == 1) {
				title = "Enabled";				 
			 	img = "tick.png";
			 }
			 document.getElementById("divStatus"+id).innerHTML="<img src='../images/admin/"+img+"' border='0' width='16' height='16' alt='"+title+"' title='"+title+"' />";															
		 }
    }
	xmlHttp1.open("GET","ajax.php?section=updateStatus&id="+id,true);
	xmlHttp1.send(null); 
}



function updateFeatured(id) {
	xmlHttp1 = createObject();	
	if (xmlHttp1==null) {
		alert ("Your browser does not support AJAX!");
		return;
  	} 
	document.getElementById("divFeatured"+id).innerHTML="<img src='../images/ajax-loader.gif' width='16' height='16' />";	
	xmlHttp1.onreadystatechange=function() {
	if(xmlHttp1.readyState==4)	{
			 updated=xmlHttp1.responseText;	
			 title = "Not Featured";
			 img = "cross.png";
			 if(updated == 1) {
				title = "Featured";				 
			 	img = "tick.png";
			 }
			 document.getElementById("divFeatured"+id).innerHTML="<img src='../images/admin/"+img+"' border='0' width='16' height='16' alt='"+title+"' title='"+title+"' />";															
		 }
    }
	xmlHttp1.open("GET","ajax.php?section=updateFeatured&id="+id,true);
	xmlHttp1.send(null); 
}

*/

function updateSite() {
	xmlHttp1 = createObject();	
	if (xmlHttp1==null) {
		alert ("Your browser does not support AJAX!");
		return;
  	} 
	document.getElementById("divLiveSite").innerHTML="<img src='../images/ajax-loader.gif' width='16' height='16' />";	
	xmlHttp1.onreadystatechange=function() {
	if(xmlHttp1.readyState==4)	{
			 updated=xmlHttp1.responseText;	
			 title = "Site is not Live";
			 img = "cross.png";
			 if(updated == 1) {
				title = "Site is Live";				 
			 	img = "tick.png";
			 }
			 document.getElementById("divLiveSite").innerHTML="<img src='../images/admin/"+img+"' border='0' width='16' height='16' alt='"+title+"' title='"+title+"' />";															
			 //document.getElementById("divLiveSite").innerHTML=updated;
		 }
    }
	xmlHttp1.open("GET","ajax.php?section=updateSite",true);
	xmlHttp1.send(null); 
}


function checkNums(event) 
 {
 
 if(navigator.appName != "Microsoft Internet Explorer" )
 {
  if( (event.which >= 48 && event.which <= 57) || (event.which == 8 ) || (event.which == 32 )  || (event.which==0) )
	   {
	     return; 
		}
  else
   { 
  		return false;
  	}
 }
 else
 {
    if( (event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode == 32 ) || (event.keyCode == 8 ) )
	   {
	     return; 
	}
  else { 
    return false;
  }
	}
 }
 


function toogleCats() {
	window.location = "gallery.php?setting=image-gallery&CatID="+document.getElementById('cats').value;
}

function confirmFirst(id, cat_id) {
	if(confirm("Are you sure ?")) {
			window.location = "categories.php?loadPage=gallery_manage&delete_image=yes&id="+id+"&CatID="+cat_id;	
			//window.location = "includes/uc-setting.php?setting=image-gallery&delete_image=yes&id="+id+"&CatID="+cat_id;
	}
}



function confirmPageDelete(id, menu_name) {
	under_menu = "";
	if(menu_name!="") under_menu = "\nThis page is related to "+menu_name+", will be deleted as well.";
	if(confirm("Are you sure you want to delete this page ?"+under_menu)) {
			window.location = "menus.php?cur=list_pages&action=delete&pid="+id;	
	}
}
