// JavaScript Document
function doNav(theUrl) {
	document.location.href = theUrl;
}
function changeCursor(tableRow, highLight) {
	if (highLight) {
		tableRow.style.cursor="pointer";
	}
}
function accountHover(tableRow, highLight) {
	if (highLight) {
		tableRow.className = "accounthover";
		tableRow.style.cursor="pointer";
	} else {
		tableRow.className = "account";
	}
}
function pageNumHover(tableRow, highLight) {
	if (highLight) {
		tableRow.className = "pagenumbersred";
		tableRow.style.cursor="pointer";
	} else {
		tableRow.className = "pagenumbers";
	}
}
var loader = new Image();
loader.src = 'images/loader_red.gif';
function pleaseWait(table,row,cell) {
	//var button = document.getElementById('submitbutton');
	var x=document.getElementById(table).rows[row].cells;
	x[cell].innerHTML='<img src="images/loader_red.gif" align="absbottom"> Please Wait...';
	//button.style.color="#999999";
	//button.disabled=true;
}
function deleteUser(id) {
	if(confirm('Are you sure you want to delete this user?')) {
		doNav('admin_users.php?action=process&section=delete&id='+id);
	}
}
function deleteParagraph(id,page) {
	if(confirm('Are you sure you want to delete this paragraph?')) {
		doNav('page_info.php?action=process&section=delete&id='+id+'&return='+page);
	}
}
function deleteNews(id) {
	if(confirm('Are you sure you want to delete this piece of news?')) {
		doNav('news.php?action=process&section=delete&id='+id);	
	}
}
function deleteRotatingImage(id) {
	if(confirm('Are you sure you want to delete this rotating image?')) {
		doNav('rotating_images.php?action=process&section=delete&id='+id);	
	}
}
function deleteCategory(id) {
	if(confirm('Are you sure you want to delete this category and all products within it?')) {
		doNav('admin_products.php?action=process&section=deletecat&catid='+id);	
	}
}
function deleteProduct(id,catid) {
	if(confirm('Are you sure you want to delete this product?')) {
		doNav('admin_products.php?action=process&section=delete&id='+id+'&catid='+catid);	
	}
}
function deleteOptCat(id) {
	if(confirm('Are you sure you want to delete this option category?')) {
		doNav('admin_products.php?action=process&section=deleteoptcat&catid='+id);	
	}
}
function deleteOption(id,catid) {
	if(confirm('Are you sure you want to delete this option?')) {
		doNav('admin_products.php?action=process&section=deleteoption&id='+id+'&catid='+catid);	
	}
}
function deleteShipping(id) {
	var remove = confirm('Are you sure you want to delete this shipping option?');
	if(remove == true) {
		doNav('admin_products.php?action=process&section=deleteship&id='+id);	
	}
}
var fadeImage = function() {
	new Effect.Appear('fadephoto');
	new Effect.Fade('loadingDiv');
	}
function enlargeImg(img) {
	if(document.getElementById('fadephoto').style.display != 'none') {
		new Effect.Fade('fadephoto');
	}
	new Ajax.Request('ajax_photolarge.php?img='+img,
		 {
			method:'get',
			onLoading: function() {
				new Effect.Appear('loadingDiv');
			},
			onSuccess: function(text){
			  var response = text.responseText || "no response text";
			  document.getElementById('bigPhoto').innerHTML = response;
			  document.getElementById('bigImg').onload = fadeImage;
			},
			onFailure: function(){ alert('Something went wrong...') }
		  });
}
