

function MM_preloadImages() { //v3.0
  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() { //v3.0
  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) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  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 MM_validateForm() { //validate form by id
  var i,p,q,nm,id,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.id; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is a required field.\n'; }
  } if (errors) alert('Please correct the following error(s):\n'+errors);
  document.MM_returnValue = (errors == '');
}

function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

function validatezip(zipcode) {// validate destination zipcode
	
  var str1 = "000x001x002x003x006x007x008x009x419x517x518x519x568x569x589x694x695x696x697x698x699x839x866x867x868x869x886x887x888x899x967x968x969x995x996x997x998x999x"
  var s = str1.indexOf(zipcode.substr(0,3));
  if(zipcode.length<5)
  {	
  	window.alert("Zipcode must be 5 digits");
	cart1form.zipcode.focus();
  }	
  else
  { 
	if(s>=0)
	  {
	    window.alert("Delivery is unavailable to the destination zipcode entered");
		cart1form.zipcode.focus();	
	  }
  }		

}

function protectmail() { //encrypt email address
  var name = "enquiries";
  var address = "homelea.info";
  var link = "Email: enquiries@homelea.info";
  var subject = "General enquiry";
  document.write('<a  title="Send us an email" href="mailto:' + name + '@' + address + '?subject=' + subject + '">' + link + '</a>');
}

function homeprotectmail() { //encrypt email address
  var name = "enquiries";
  var address = "homelea.info";
  var link = "Email: enquiries@homelea.info";
  var subject = "General enquiry";
  document.write('<a title="Send us an email" href="mailto:' + name + '@' + address + '?subject=' + subject + '">' + link + '</a>');
}

function linksprotectmail() { //encrypt email address
  var name = "links";
  var address = "knm-websolutions.co.uk";
  var link = "links@knm-websolutions.co.uk";
  var subject = "Link enquiry - Homelea.info";
  document.write('<a title="Email a link enquiry" href="mailto:' + name + '@' + address + '?subject=' + subject + '">' + link + '</a>');
}


function changeValues(which) {
  document.sizecalc.ID1.selectedIndex = which;
  document.sizecalc.ID2.selectedIndex = which;
  document.sizecalc.ID3.selectedIndex = which;
  document.sizecalc.ID4.selectedIndex = which;
  document.sizecalc.ID5.selectedIndex = which;
  document.sizecalc.ID6.selectedIndex = which;
  document.sizecalc.ID7.selectedIndex = which;

}

function protectmail2() { //encrypt email address
  var name = "admin";
  var address = "knm-websolutions.co.uk";
  var link = "";
  var subject = "Change&nbsp;Email&nbsp;request&nbsp;for&nbsp;Jukedock.co.uk&nbsp;Admin";
  document.write('<a class="email" href=mailto:' + name + '@' + address + '?subject=' + subject + '><img src="images/p2.gif" alt="Click here to email support" border="0" /></a>');
}

function protectmail3() { //encrypt email address
  var name = "admin";
  var address = "knm-websolutions.co.uk";
  var link = "";
  var subject = "Raise&nbsp;a&nbsp;support&nbsp;request&nbsp;for&nbsp;Jukedock.co.uk&nbsp;Admin";
  document.write('<a class="email" href=mailto:' + name + '@' + address + '?subject=' + subject + '><img src="images/p2.gif" alt="Click here to email support" border="0" /></a>');
}

//characters remaining box
function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}

//verify for netscape/mozilla
var isNS4 = (navigator.appName=="Netscape")?1:0;

function EW_checkMyForm(EW_this) {
	if (!EW_hasValue(EW_this.userid, "TEXT" )) {
		if  (!EW_onError(EW_this, EW_this.userid, "TEXT", "Please enter user ID"))
			return false; 
	}
	if (!EW_hasValue(EW_this.passwd, "PASSWORD" )) {
		if (!EW_onError(EW_this, EW_this.passwd, "PASSWORD", "Please enter password"))
			return false; 
	}
	return true;
}


//function confirmDEL(msg,url) { 

//var agree=confirm(""+msg+"");
//if (agree)
	
//	location.href= url ;
//else
//	return false ;
//}

function confirmDEL(msg,url) {
var agree = confirm(""+msg+"");
if  (agree == true)
location.href = url ;
}





function confirmSubmit2() { //confirm or cancel submit form

var agree=confirm("You are about to delete all associated records for this order number.\nAre you sure you wish to continue?");
if (agree)
	return true ;
else
	return false ;
}

function confirmSubmit3() { //confirm or cancel submit form

var agree=confirm("This will send a pre-formatted dispatch notice email.\nCheck recipient and order number are correct before continuing");
if (agree)
	return true ;
else
	return false ;
}

function confirmSubmit4() { //confirm or cancel submit form

var agree=confirm("You are about to permanently delete this message.\nAre you sure you wish to continue?");
if (agree)
	return true ;
else
	return false ;
}

function confirmSubmit5() { //confirm or cancel submit form

var agree=confirm("Your details will be sent to the default email address we hold on\nfile for your account, if you wish to change this address please\ncancel and email admin to submit a change of email request.");
if (agree)
	return true ;
else
	return false ;
}

function makeEnable()
{
var x=document.forms.delform
x[1].disabled=false
}

function makeDisable()
{
var x=document.forms.delform
x[1].disabled=true
}	

function checkform() {
 var x=document.forms.delform
if (x[2].checked==true)
 x[1].disabled=false; 
 else 
 x[1].disabled=true;
 	
}

function checkform2() {
 var x=document.forms.invoice
if (x[2].checked==true)
 x[3].style.visibility="visible"; 
 else 
 x[3].style.visibility="hidden";
 	
}

function checkform3() {
 var x=document.forms.choosemsg
if (x[1].checked==true)
 x[2].checked=false;
}

function checkform4() {
 var x=document.forms.choosemsg
if (x[2].checked==true)
 x[1].checked=false;
}

function checkform99() {
 var x=document.forms.forgot
if (x[1].checked==true)
 x[0].disabled=false; 
 else 
 x[0].disabled=true;
 	
}

function checkinput99() {
 var x=document.forms.forgot
if (x[1].checked==true)
 x[0].disabled=false; 
 else 
 x[0].disabled=true;
 	
}

var popUpWin=0;
function popUpWindow(URLStr, right, top, width , height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbars=yes,resizable=no,copyhistory=no,width='+500+',height='+320+',right='+right+', top='+top+',screenX='+right+',screenY='+top+'');
}

function addToFavorites() {
var urlAddress = "http://userarea.knm-websolutions.co.uk/srvcp/"; 
var pageName = "KNM server control panel";  
if (window.external) { window.external.AddFavorite(urlAddress,pageName) 
} else { alert("Sorry your browser doesn't support this function."); 
} }

function PopUpWindow(w,h) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;

	window.open('', 'ChatWindow2', 'toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0,width=700,height=360,top=5,left=5')
}

function onUnloadPage()
{
if (document.all){
if ((window.event.clientX < 0) && (window.event.clientY < 0)) //X button is clicked
{
//call your logout page
//window.open('logout.asp', '', "features");

//or silent logout
logout = new Image();
logout.src="loguseroff.asp";
}
}
}

function go()
{
	box = document.forms[0].opt;
	destination = box.options[box.selectedIndex].value;
	if (destination) location.href = destination;
}

function passwordfocus()
{
document.login.PASSWORD.focus();
}

function userfocus()
{
document.login.USER.focus();
}

function goto()
{
window.location = "managelogins.asp";
}

function goto2()
{
window.location = "listspamALL.asp";
}

function reloadiframe()
{
myiframe.location.reload(true);
}

function actionban(pagesrc,detail)
{
window.open(pagesrc);
//logout = new Image();
//logout.src= pagesrc ;
//alert(detail);
}

function checkme(buttonname) {

var NewCount = 0

for (i=0; i<document.spamrelease.checkgroup.length; i++)

{
if (document.spamrelease.checkgroup[i].checked==true)
NewCount = (NewCount + 1)
}
if (NewCount >= 1)
{
var agree=confirm("You are about to "+buttonname+" "+NewCount+" message(s)\nAre you sure you wish to continue?");
if (agree)
	
	return true ;
else
	return false ;
}
else
alert('            **ERROR**\nYou must select at least one message');
return false;
}

function myrefresh() {
location.href='index.asp';
}

function dicmergeref() {
location.href='dictresult.asp?dictype=merge';
}

function diccreateref() {
location.href='dictresult.asp?dictype=create';
}

function silentmerge()
{
var d = new Date()
var when = (60 - (d.getMinutes()))
var agree= confirm("Messages will be merged to existing dictionary\nat next scheduled runtime ("+when+" minutes)");
if (agree)
location.href = "includes/dictmerge.asp" ;
else
	return false ;
}

function silentcreate()
{
var d = new Date()
var when = (60 - (d.getMinutes()))
var agree= confirm("New dictionary will be created from message archive\nat next scheduled runtime ("+when+" minutes)");
if (agree)
location.href = "includes/dictcreate.asp" ;
else
	return false ;
}

function mysitechoice(myformname) {
var sitename = document.forms[myformname].sitechoice.options[document.forms[myformname].sitechoice.selectedIndex].value ;
var pageurl = "index.asp?sitechoice="+sitename+"";
location.href =  pageurl ;
}

function menuexpand(menuid) {
var qstr = menuid
}

function custcheckme(buttonname) {

var NewCount = 0

for (i=0; i<document.custactions.checkgroup.length; i++)

{
if (document.custactions.checkgroup[i].checked==true)
NewCount = (NewCount + 1)
}
if (NewCount >= 1)
{
var agree=confirm("You are about to "+buttonname+" "+NewCount+" user(s)\nAre you sure you wish to continue?");
if (agree)
	
	return true ;
else
	return false ;
}
else
alert('            **ERROR**\nYou must select at least one message');
return false;
}

function CreateBookmarkLink() {
title = "Homelea Guest House B'ham";
url = "http://www.homelea.info/";

if (window.sidebar) { // Mozilla Firefox Bookmark
window.sidebar.addPanel(title, url,"");
}
else if( window.external ) { // IE Favorite
window.external.AddFavorite( url, title);
}
else if(window.sidebar&&window.sidebar.addPanel) { //Netscape
window.sidebar.addPanel(title,url,"");
}
else if(window.opera && window.print) { // Opera Hotlist
return true;
}
else {
alert("Sorry your browser doesn't support this function.");
}
}


function confirmentry(formname) { //confirm or cancel submit form
var name = document.forms[formname].Name.value;
var country = document.forms[formname].Country.value;
var email = document.forms[formname].Email.value;
var comments = document.forms[formname].Comments.value;
//comments = comments.replace(/(<([^>]+)>)/ig," ");
var weburl = document.forms[formname].weburl.value;
var pattern = /(<([^>]+)>)/i
var hashtml = pattern.test(comments)
if (hashtml)
{
alert('       **ERROR**\n  No HTML tags allowed\nPlease amend and retry');
return false;
}
else
var agree=confirm("Please review that your details are correct.\nYour Name: "+name+"\nYour Country: "+country+"\nYour Email: "+email+"\nWebsite: "+weburl+"\nComments: "+comments+"");
if (agree)
	return true ;
else
	return false ;
}

function confirmcontact(formname) { //confirm or cancel submit form
var email = document.forms[formname].Email.value;

var agree=confirm("Please confirm that your email address is correct.\nYour Email: "+email+" ?");
if (agree)
	return true ;
else
	return false ;
}

function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(52.451520, -1.771500), 12);
var point = new GLatLng(52.451520, -1.771500);
map.addOverlay(new GMarker(point));
}
}

//-->