// #####################################################################
// defines the browser DOM
// #####################################################################

userAgent = navigator.userAgent;
var NN=0;
var IE=0;
var DOM=0;
if (userAgent.search('MSIE')>=0) {
	IE=1;
} else {
	NN = 1; 
	if (parseInt(navigator.appVersion)>4) {
  		NN=0;IE=1;DOM=1;
	};
};

// #####################################################################
// makes a hidden div layer visible
// #####################################################################

var openDiv = '';

function showMe(div) {
	if (openDiv) {
		hideMe(openDiv);
	}
	openDiv = div;
	if (DOM) {
		document.getElementById(div).style.visibility = 'visible';
		document.getElementById(div).style.display = 'block';
	} else if (IE) {
		document.all[div].style.visibility = 'visible';
		document.all[div].style.display = 'block';
	} else if (NN) {
	    document.div.visibility = 'show';
		document.div.display = 'block';
	}
} // end function
	
// #####################################################################
// hides a visible div layer
// ####################################################################
function hideMe(div) {
	if (DOM) {
		document.getElementById(div).style.visibility = 'hidden';
		document.getElementById(div).style.display = 'none';
	} else if (IE) {
		document.all[div].style.visibility = 'hidden';
		document.all[div].style.display = 'none';
	} else if (NN) {
		document.div.visibility = 'hide';
		document.div.display = 'none';
	}
} // end function



// #####################################################################
// highlights the active table row
// #####################################################################
function clrRow(src, newColor) {
	src.bgColor = newColor;
}

function showOrders(URL) {
	window.location = URL;
}

function thisEmpty() {

}



function thisPopup(URL, name, left, top, width, height, scrollbars) {
	var standardSetting = 'toolbar=0, location=1, directories=0, status=1, scrollbars=' + scrollbars;
	var customSetting = 'menubar=1, resizable=1, width=' + width + ', height=' + height;
	var positioning = 'left=' + left + ', top =' + top;
	// create window
	closePopup();
	oxl_win = window.open(URL, name, + '\'' + standardSetting + ', ' + customSetting + ', ' + positioning + '\'');
	oxl_win.focus();
}


function closePopup() {
	if (window.oxl_win) {
		window.oxl_win.close();
	}
}



// pop up to define which shopping list item is placed in
function historyOrder(order_id) {
	var left = 50;
	var top = 50;
	var URL = "history_order.php?order_id="+order_id;
	var width = 650;
	var height = 550;
	var scrollbars = 1;
	thisPopup(URL, name, left, top, width, height, scrollbars);
}

var paypalClicked = false;
function paypalWindow(form) {
	var left = 50;
	var top = 50;
	var URL = '';
	var width = 800;
	var height = 580;
	var scrollbars = 1;
	thisPopup(URL, 'paypal', left, top, width, height, scrollbars);
	document.forms[form].submit();
	paypalClicked = true;
	if (form == "paypalCheckout") {
		self.location.href="index.php?fcall=paypalEnd";
	}
	return false;	
}

function checkPaypalStatus() {
	if (paypalClicked) {
		return true;
	} else {
		alert("please pay via one of our payment facilities before proceeding");
		return false;
	}
}


function paypalRedirect() {
	window.resizeTo(300, 300);
	opener.location.href = "index.php?fcall=showNewInvoice";
}

function closePaypalWindow() {
	self.close();
}

function setSpecialDelivery(value)
{
	document.location.href="index.php?fcall=setSpecialDelivery&flag="+value;

}




 
 
