function MM_preloadImages() { 
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
  if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { 
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { 
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function navValidator(bottomNav)
{
  if (bottomNav.forumid.selectedIndex == 0)
  {
  alert("The first \"forumid\" option is not a valid selection. Please choose one of the other options.");
  bottomNav.forumid.focus();
  return (false);
  }
  return (true);
}

function PopUp(mypage) {
var w = 500
var h = 400
var myname = 'newwindow'
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,noresize'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { 
win.window.focus(); 
}
if (!myname.opener) myname.opener = self;
}

function callPopupWindow() {
var w = 300
var h = 230
var thename = 'newwindow'
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',menubar=no,scrollbars=no,noresize'
win = window.open("", thename, winprops)
win.document.write("<html>")
win.document.write("<head>")
win.document.write("<title>Structured Training - Profile Your Visit</title>")
win.document.write("<link rel='stylesheet' type='text/css' href='style.css'>")
win.document.write("</head>")
win.document.write("<body bgcolor='#c0bce0'>")
win.document.write("<table border='0' width='100%' cellpadding='5'>")
win.document.write("<tr bgcolor='#382868'><td align='center'><b>Profile Your Visit</b></td></tr>")
win.document.write("<tr>")
win.document.write("<td width='50%' class='maincell'>")
win.document.write("Thankyou for submitting your details. <br><br><b>structured-training.com</b> has now been personalised according to your profile, making your visit more relevant to you. You can change your profile at any time by clicking on the 'Amend Your Profile' button shown on the home page.")
win.document.write("</td>")
win.document.write("</tr>")
win.document.write("<tr bgcolor='#382868'><td align='center'><a href='javascript:window.close()'><img src='lower_graphics/button_close.gif' border='0'></a></td></tr>")
win.document.write("</table>")
win.document.write("</body>")
win.document.write("</html>")
if (parseInt(navigator.appVersion) >= 4) {
win.window.focus();
}
if (!thename.opener) thename.opener = self;
}

function popUp(thePage,pageName,w,h,scroll) {
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2;
  winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
  win = window.open(thePage, pageName, winprops)
  if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
  if (!pageName.opener) pageName.opener = self;}

function rightPopUp(thePage,pageName,w,h,scroll) {
  var winl = screen.width - w - 10
  var wint = screen.height - h - 60
  winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no'
  win = window.open(thePage, pageName, winprops)
  if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
  if (!pageName.opener) pageName.opener = self;}


function detailsPopUp(mypage) {
var w = 500
var h = 400
var myname = 'newwindow'
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=yes,status=no,noresize'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
if (!myname.opener) myname.opener = self;}

function cartPopUp(mypage) {
var w = 250
var h = 200
var myname = 'newwindow'
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=no,noresize'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
if (!myname.opener) myname.opener = self;}

function add2Cart(pageURL,w,h)  
{
var winName = 'DisplayWindow'
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',toolbar=no,location=no,directories=no,status=no,scrollbars=no,noresize'
NewWindow = window.open(pageURL, winName, winprops)
if (parseInt(navigator.appVersion) >= 4) { NewWindow.window.focus(); }
}

function checkKeyword(keywordsearch){
  if (keywordsearch.keyword.value == ""){
  alert("Please enter a keyword")
  keywordsearch.keyword.focus()
  return false
  }
}

function checkSelect(theform){
  if (selectCategory.category.value == ""){
  alert("Please select a Category")
  selectCategory.category.focus()
  return false
  }
}

function checkSubCat(theform){
  if (selectSubCategory.subCategory.value == ""){
  alert("Please select a Subcategory")
  selectSubCategory.subCategory.focus()
  return false
  }
}

function RUSure() {
  if(confirm("Are you sure you want to delete the contents of your Shopping Basket?")){
    return true
  }
  else {
    return false
  }
}

function emptyBasket() {   
  if(alert("Your Shopping Basket is currently empty")){
    return false
  }
}

function DeleteSure() {
  if(confirm("Are you sure you want to delete the selected item(s) from the Database?")){
    return true
  }
  else  {
    return false
  }
}
