function MM_checkPlugin(plgIn, theURL, altURL, autoGo) { //v4.0
  var ok=false; document.MM_returnValue = false;
  with (navigator) if (appName.indexOf('Microsoft')==-1 || (plugins && plugins.length)) {
    ok=(plugins && plugins[plgIn]);
  } else if (appVersion.indexOf('3.1')==-1) { //not Netscape or Win3.1
    if (plgIn.indexOf("Flash")!=-1 && window.MM_flash!=null) ok=window.MM_flash;
    else if (plgIn.indexOf("Director")!=-1 && window.MM_dir!=null) ok=window.MM_dir;
    else ok=autoGo; }
  if (!ok) theURL=altURL; if (theURL) window.location=theURL;
}

//popup for product
var id;
function popup_show_product(id) {
window.open('prod_details.php?prodid=' + id, 'popup_product', config='height=500, width=400, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no');
}

//shopping list
var prodid;
function popup_product(prodid) {
window.open('shopping_list_popup.php?prodid=' + prodid, 'popup_shopping_list', config='height=415, width=385, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no');	
}

function popup_close() {	
	window.close();
}

function popup_terms() {
	window.open('terms_conditions.php', 'popup_terms', config='height=500, width=400, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no');
}

function Lvl_openWin(u,n,w,h,l,t,c,f) { //v2.2 4LevelWebs
  var x=((screen.width-w)/2);if(c==1){l=x;t=(screen.height-h)/2;}if(c==2){l=x}
	f+=',top='+t+',left='+l;LvlWin=window.open(u,n,f);LvlWin.focus();
}

function showadd(){
	var s = '';
	s += document.addform.title.value + ' ';
	s += document.addform.first_name.value + ' ' + document.addform.last_name.value + '<br />';	
	if (document.addform.house_number.value == '') {
		s += document.addform.house_name.value + '<br />';
		s += document.addform.street.value + '<br />';
	} else if (document.addform.house_name.value == '') {
		s += document.addform.house_number.value + ' ' + document.addform.street.value + '<br />';
	} else if ( (!(document.addform.house_number.value == '')) && (!(document.addform.house_name.value == '')) ) {
		s += document.addform.house_name.value + '<br />' + document.addform.house_number.value + ' ' + document.addform.street.value + '<br />'
	} else {
	}
	if (!(document.addform.area.value == '')) {
		s += document.addform.area.value + '<br>';
	}
	s += document.addform.town.value + '<br />' + document.addform.county.value + '<br />' + document.addform.postcode.value + "<br />";
	document.getElementById("addbox").innerHTML=s;
}

function popup_external(exturl) {
	window.open('' + exturl + '', 'popup_ext', config='');
}

function createFlash (width,height,flash_url,downloadurl) {
	
	if (downloadurl == '') {
		var downloadurl = 'http://www.macromedia.com/go/getflashplayer';
	} else {
		
	}
	
	var flashlogo = '';
	
	flashlogo += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + width + '" height="' + height + '">';
	flashlogo += '<param name="movie" value="' + flash_url + '">';
	flashlogo += '<param name="quality" value="high">';
	flashlogo += '<embed src="' + flash_url + '" quality="high" pluginspage="'+ downloadurl +'" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '"></embed>';
	flashlogo += '</object>';

	document.write(flashlogo);
}

function checklogin() {
	if (document.frmlogin.username.value == "") {
		alert('no username');
	} else if (document.frmlogin.password.value == "") {
		alert('no password');
	} else {
		document.frmlogin.submit();
	}
}