function NewWindow(mypage, myname, 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
//winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
newWindow = window.open(mypage, "newWindow", winprops);
//newWindow.document.open();
//newWindow.document.write('<html><title>'+myname+'</title><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0"'); 
//if (parseInt(navigator.appVersion) >= 4) { newWindow.window.focus(); }
//newWindow.document.write('</body></html>');
//newWindow.document.close();
//newWindow.focus();
}

function NewWindow2(mypage, myname, scroll) {
var winl = (screen.width) / 2;
var wint = (screen.height) / 2;
winprops = 'height='+screen.height+',width='+screen.width+',top='+wint+',left='+winl+',scrollbars='+scroll
newWindow = window.open(mypage, "newWindow");
}
function PicWindow(imageName,comment,scrbar) {
	if (scrbar=="") {
		scrbar="0";
	}
//	if (imageWidth=="") {
		imageWidth=640;
//	}
//	if (imageHeight=="") {
		imageHeight=500;
//	}
//	if (bgcolor=="") {
		bgcolor="000000";
//	}
	var alt = comment + " - AbbeyRoadOnTheRiver.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Click screen to CLOSE -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
	var hugger="hug image";
	var hugMargin=0;
	var adj=10
	var w = screen.width;
	var h = screen.height;
	var byFactor=1;

	if(w<740){
	  var lift=0.90;
	}
	if(w>=740 & w<835){
	  var lift=0.91;
	}
	if(w>=835){
	  var lift=0.93;
	}
	if (imageWidth>w){	
	  byFactor = w / imageWidth;			
	  imageWidth = w;
	  imageHeight = imageHeight * byFactor;
	}
	if (imageHeight>h-adj){
	  byFactor = h / imageHeight;
	  imageWidth = (imageWidth * byFactor);
	  imageHeight = h; 
	}
	   
	var scrWidth = w-adj;
	var scrHeight = (h*lift)-adj;

	if (imageHeight>scrHeight){
  	  imageHeight=imageHeight*lift;
	  imageWidth=imageWidth*lift;
	}

	var posLeft=0;
	var posTop=0;

	if (hugger == "hug image"){
	  if (hugMargin == ""){
	    hugMargin = 0;
	  }
	  var scrHeightTemp = imageHeight - 0 + 2*hugMargin;
	  if (scrHeightTemp < scrHeight) {
		scrHeight = scrHeightTemp;
	  } 
	  var scrWidthTemp = imageWidth - 0 + 2*hugMargin;
	  if (scrWidthTemp < scrWidth) {
		scrWidth = scrWidthTemp;
	  }
	  
	  if (scrHeight<100){scrHeight=100;}
	  if (scrWidth<100){scrWidth=100;}

	  posTop =  ((h-(scrHeight/lift)-adj)/2);
	  posLeft = ((w-(scrWidth)-adj)/2);
 	}

	if (imageHeight > (h*lift)-adj || imageWidth > w-adj){
		imageHeight=imageHeight-adj;
		imageWidth=imageWidth-adj;
	}
	posTop = parseInt(posTop);
	posLeft = parseInt(posLeft);		
	scrWidth = parseInt(scrWidth); 
	scrHeight = parseInt(scrHeight);
	
	var agt=navigator.userAgent.toLowerCase();
	if (agt.indexOf("opera") != -1){
	  var args= new Array();
	  args[0]='parent';
	  args[1]=imageName;
	  var i ; document.MM_returnValue = false;
	  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	} else {
	newWindow = window.open("popup.htm","newWindow","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop+",scrollbars="+scrbar);
	newWindow.document.open();
	//newWindow.document.write('<html><title>'+alt+'</title><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+bgcolor+' onBlur="self.close()" onClick="self.close()">');  
	newWindow.document.write('<html><title>'+alt+'</title><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+bgcolor+' >');  


//	newWindow.document.write('<table border="0" cellspacing="0" cellpadding="0" width="200"><tr><td align="left">');
//	newWindow.document.write('<a href="#" onclick="picSwitch(-1);" onmouseover="MM_swapImage(&acute;backButton&acute;,&acute;&acute;,&acute;/images/buttonBackRoll.gif&acute;);" onmouseout="MM_swapImgRestore();">');
//	newWindow.document.write('<img src="/images/buttonBack.gif" width=45 height=16 border="0" name=backButton></a></td><td id=thepics align=center><font face=verdana,arial size=1>');
//	newWindow.document.write('<script language="JavaScript">document.write (pic + &acute; of &acute; + maxPics);</script></td>');
//	newWindow.document.write('<td align="right"><a href="#" onclick="picSwitch(1);" onmouseover="MM_swapImage(&acute;nextButton&acute;,&acute;&acute;,&acute;/images/buttonNextRoll.gif&acute;);" onmouseout="MM_swapImgRestore();">');
//	newWindow.document.write('<img src="/images/buttonNext.gif" width="45" height="16" alt="" border="0" name="nextButton"></a></td></tr></table>');


	newWindow.document.write('<table width='+imageWidth+' border="0" cellspacing="0" cellpadding="0" align="center" height='+scrHeight+' ><tr><td align=center valign=middle>');
	//newWindow.document.write('<img src="'+imageName+'" width='+imageWidth+' height='+imageHeight+' alt="Click screen to CLOSE" >'); 
	newWindow.document.write('<img src="'+imageName+'" alt="Click screen to CLOSE this window" >'); 
	newWindow.document.write('</td></tr></table></body></html>');
	newWindow.document.close();
	newWindow.focus();
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

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_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_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,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.name; 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') {
        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 (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

// This used to diplay message then expand and fade
function position_at_top(){
  if (document.layers)
    document.msgx.top=pageYOffset;
  if (document.all){
    msgx.innerHTML='<font face="'+fontface+'" color="'+fontcolor+'">'+themessage+'</font>'
    setTimeout("msgx.style.top=document.body.scrollTop",100)
  }
}

function expand(){
  if (document.layers){
    document.msgx.document.write('<div align=center style="font-size:'+fontsize+'px"><font face="Arial" color="red" >'+themessage+'</font></div>')
    document.msgx.document.close()
  }
  if (document.all)
    msgx.style.fontSize=fontsize+'px';
  fontsize+=5;
  if (fontsize>endsize){
    if (document.layers)
      setTimeout("document.msgx.visibility='hide'",appearfor);
    if (document.all)
      setTimeout("msgx.style.visibility='hidden'",appearfor);
    return;
  }
  else
    setTimeout("expand()",50);
}
// END -  diplay message then expand and fade


//<!-- Begin
var mikExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\!\'\"\;\:\?\,\.\<\>\{\}\=\|]/;
function dodacheck(val) {
var strPass = val.value;
var strLength = strPass.length;
var lchar = val.value.charAt((strLength) - 1);
if(lchar.search(mikExp) != -1) {
var tst = val.value.substring(0, (strLength) - 1);
val.value = tst;
   }
}
function doanothercheck(form) {
if(form.value.length < 1) {
alert("Please enter something.");
return false;
}
if(form.value.search(mikExp) == -1) {
alert("Correct Input");
return false;
}
else {
alert("Sorry, but the following characters\n\r\n\r@ $ % ^ & * # ( ) [ ] \\ { + } ` ~ =  | \n\r\n\rare not allowed!\n");
form.select();
form.focus();
return false;
}
alert("Correct Input");
return false;
}
//  End -->

function jumpRadio(form)	{
		var radiolink = form.options[form.selectedIndex].value;
		if(radiolink != "") {
			NewWindow(radiolink, '_maccaradio', '430', '175', 'no'); return false;
		}
		return true;
}

function submitForm(s)  {
s.value = "  Sending...  ";
return true;
}


