// JavaScript Document
// JavaScript Document
// All scripts used by Gainesville Coins -- combined into 1 file
function isEMailAddr(elem) {
//   var str = elem.value;
   var str = elem;
//   var re = /^[\w-]+(\/w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
   var re = /^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$/;
   if (!str.match(re)){
 //    alert("Verify the email address format.");
       return false ;
   } else {
       return true ;
   }
}
function focusElement (formName, elemName) {
  var elem = document.forms[formName].elements[elemName];
  elem.focus();
  elem.select ();
  }
//was Macromedia  
function DC_validateForm() { //v4.0
  var bPassed;
  var elem;
  var i,p,q,nm,test,num,min,max,errors='',args=DC_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; elem=DC_findObj(args[i]);
    if (elem) { nm=elem.name; if ((val=elem.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';
		if (!isEMailAddr(val)) errors+='- '+nm+' must contain a valid e-mail address.\n';
//		setTimeout ("focusElement('" + elem.form.name + "', '" + nm + "')", 0);
      } 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 required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  bPassed = (errors == '');
  document.MM_returnValue = bPassed;
  return bPassed;
}

//================== MACROMEDIA SCRIPTS ================================
// changed names from DC_ to DC_ because problems with templates updating with scripts external to template
function DC_swapImgRestore() { //v3.0
  var i,x,a=document.DC_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function DC_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.DC_p) d.DC_p=new Array();
    var i,j=d.DC_p.length,a=DC_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.DC_p[j]=new Image; d.DC_p[j++].src=a[i];}}
}

function DC_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=DC_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function DC_swapImage() { //v3.0
  var i,j=0,x,a=DC_swapImage.arguments; document.DC_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=DC_findObj(a[i]))!=null){document.DC_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//not sure if this is still being used
function DC_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=DC_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = DC_findObj(args[2])) != null && !img.DC_init) {
      img.DC_init = true; img.DC_up = args[3]; img.DC_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = DC_findObj(args[i])) != null) {
        if (!img.DC_up) img.DC_up = img.src;
        img.src = img.DC_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.DC_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = DC_findObj(args[i])) != null) {
      if (!img.DC_up) img.DC_up = img.src;
      img.src = (img.DC_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.DC_up);
      nbArr[nbArr.length] = img;

    }
  } else if (event == "out" ) {
    for (i=0; i < document.DC_nbOver.length; i++) {
      img = document.DC_nbOver[i]; img.src = (img.DC_dn) ? img.DC_dn : img.DC_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.DC_up; img.DC_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = DC_findObj(args[i])) != null) {
      if (!img.DC_up) img.DC_up = img.src;
      img.src = img.DC_dn = (args[i+1])? args[i+1] : img.DC_up;
      nbArr[nbArr.length] = img;
  } }
}

function DC_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
/* 
  ------------------------------------------------
  PopMenu Magic menu scripts
  Copyright (c) 2004-2005 Project Seven Development
  www.projectseven.com
  Version: 1.0.2
  ------------------------------------------------
*/
function P7_setPM(){ //v1.0 by PVII-www.projectseven.com
 var i,d='',h="<sty"+"le type=\"text/css\">",tA=navigator.userAgent.toLowerCase();if(window.opera){
 if(tA.indexOf("opera 5")>-1||tA.indexOf("opera 6")>-1){return;}}if(document.getElementById){
 for(i=1;i<20;i++){d+='ul ';h+="\n#p7PMnav "+d+"{position:absolute;left:-9000px;}";}
 document.write(h+"\n<"+"/sty"+"le>");}}P7_setPM();
function P7_initPM(){ //v1.0 by PVII-www.projectseven.com
 var i,g,tD,tA,tU,pp,lvl,tn=navigator.userAgent.toLowerCase();if(window.opera){
 if(tn.indexOf("opera 5")>-1||tn.indexOf("opera 6")>-1){return;}}else if(!document.getElementById){return;}
 p7PMp=arguments;p7PMct=new Array;tD=document.getElementById('p7PMnav');if(tD){tA=tD.getElementsByTagName('A');
 for(i=0;i<tA.length;i++){tA[i].p7PMcl=p7PMct.length;p7PMct[p7PMct.length]=tA[i];g=tA[i].parentNode.getElementsByTagName("UL");
 tA[i].p7PMsub=(g)?g[0]:false;ev=tA[i].getAttribute("onmouseover");if(!ev||ev=='undefined'){tA[i].onmouseover=function(){
 P7_PMtrig(this);};}ev=tA[i].getAttribute("onfocus");if(!ev||ev=='undefined'){tA[i].onfocus=function(){P7_PMtrig(this);};}
 if(tA[i].p7PMsub){pp=tA[i].parentNode;lvl=0;while(pp){if(pp.tagName&&pp.tagName=="UL"){lvl++;}pp=pp.parentNode;}
 tA[i].p7PMlv=lvl;}}tD.onmouseout=P7_PMclose;P7_PMopen();}
}
function P7_PMtrig(a){ //v1.0 by PVII-www.projectseven.com
 var b,t;if(document.p7PMt){clearTimeout(document.p7PMt);}document.p7PMa=1;b=(a.p7PMsub)?'P7_PMshow(':'P7_PMtg(';
 t='document.p7PMt=setTimeout("'+b+a.p7PMcl+')",160)';eval (t);
}
function P7_PMshow(a,bp){ //v1.0.2 by PVII-www.projectseven.com
 var u,lv,oft,ofr,uw,uh,pp,aw,ah,adj,mR,mT,wW=0,wH,w1,w2,w3,sct,pw,lc,pwv,xx=0,yy=0,wP=true;
 var iem=(navigator.appVersion.indexOf("MSIE 5")>-1)?true:false,dce=document.documentElement,dby=document.body;document.p7PMa=1;
 if(!bp){P7_PMtg(a);}u=p7PMct[a].p7PMsub;if(u.p7pmax&&u.p7pmax==1){return;}u.p7pmax=1;lv=(p7PMp[0]==1&&p7PMct[a].p7PMlv==1)?true:false;
 p7PMct[a].className=p7PMct[a].className.replace("p7PMtrg","p7PMon");oft=parseInt(p7PMp[3]);ofr=parseInt(p7PMp[4]);
 uw=u.offsetWidth;uh=u.offsetHeight;pp=p7PMct[a];aw=pp.offsetWidth;ah=pp.offsetHeight;while(pp){xx+=(pp.offsetLeft)?pp.offsetLeft:0;
 yy+=(pp.offsetTop)?pp.offsetTop:0;if(window.opera||navigator.userAgent.indexOf("Safari")>-1){
 if(p7PMct[a].p7PMlv!=1&&pp.nodeName=="BODY"){yy-=(pp.offsetTop)?pp.offsetTop:0;}}pp=pp.offsetParent;}
 if(iem&&navigator.userAgent.indexOf("Mac")>-1){yy+=parseInt(dby.currentStyle.marginTop);}adj=parseInt((aw*ofr)/100);mR=(lv)?0:aw-adj;
 adj=parseInt((ah*oft)/100);mT=(lv)?0:(ah-adj)*-1;w3=dby.parentNode.scrollLeft;if(!w3){w3=dby.scrollLeft;}w3=(w3)?w3:0;
 if(dce&&dce.clientWidth){wW=dce.clientWidth+w3;}else if(dby){wW=dby.clientWidth+w3;}if(!wW){wW=0;wP=false;}wH=window.innerHeight;
 if(!wH){wH=dce.clientHeight;if(!wH||wH<=0){wH=dby.clientHeight;}}sct=dby.parentNode.scrollTop;if(!sct){sct=dby.scrollTop;if(!sct){
 sct=window.scrollY?window.scrollY:0;}}pw=xx+mR+uw;if(pw>wW&&wP){mR=uw*-1;mR+=10;if(lv){mR=(wW-xx)-uw;}}lc=xx+mR;if(lc<0){mR=xx*-1;}
 pw=yy+uh+ah+mT-sct;pwv=wH-pw;if(pwv<0){mT+=pwv;if(uh>wH){mT=(yy+ah-sct)*-1;}}u.style.marginLeft=mR+'px';u.style.marginTop=mT+'px';
 if(p7PMp[2]==1){if(!iem){P7_PManim(a,20);}}u.className="p7PMshow";
}
function P7_PMhide(u){ //v1.0 by PVII-www.projectseven.com
 var i,tt,ua;u.p7pmax=0;u.className="p7PMhide";ua=u.parentNode.firstChild;ua.className=ua.className.replace("p7PMon","p7PMtrg");
}
function P7_PMtg(a,b){ //v532 alpha by PVII-www.projectseven.com
 var i,u,tA,tU,pp;tA=p7PMct[a];pp=tA.parentNode;while(pp){if(pp.tagName=="UL"){break;}pp=pp.parentNode;}if(pp){
 tU=pp.getElementsByTagName("UL");for(i=tU.length-1;i>-1;i--){if(b!=1&&tA.p7PMsub==tU[i]){continue;}else{P7_PMhide(tU[i]);}}}
}
function P7_PMclose(evt){ //v1.0 by PVII-www.projectseven.com
 var pp,st,tS,m=true;evt=(evt)?evt:((event)?event:null);st=document.p7PMa;if(st!=-1){if(evt){
 tS=(evt.relatedTarget)?evt.relatedTarget:evt.toElement;if(tS){pp=tS.parentNode;while(pp){if(pp&&pp.id&&pp.id=="p7PMnav"){m=false;
 document.p7PMa=1;break;}pp=pp.parentNode;}}if(m){document.p7PMa=-1;if(document.p7PMt){clearTimeout(document.p7PMt);}
 document.p7PMt=setTimeout("P7_PMclr()",360);}}}
}
function P7_PMclr(){ //v1.0 by PVII-www.projectseven.com
 var i,tU,tUU;document.p7PMa=-1;tU=document.getElementById('p7PMnav');if(tU){tUU=tU.getElementsByTagName("UL");if(tUU){
 for(i=tUU.length-1;i>-1;i--){P7_PMhide(tUU[i]);}}}
}
function P7_PManim(a,st){ //v1.0 by PVII-www.projectseven.com
 var g=p7PMct[a].p7PMsub,sp=30,inc=20;st=(st>=100)?100:st;g.style.fontSize=st+"%";if(st<100){st+=inc;setTimeout("P7_PManim("+a+","+st+")",sp);}
}
function P7_PMmark(){document.p7PMop=arguments;}
function P7_PMopen(){ //v1.0 by PVII-www.projectseven.com
 var i,x,tA,op,pp,wH,tA,aU,r1,k=-1,kk=-1,mt=new Array(1,'','');if(document.p7PMop){mt=document.p7PMop;}op=mt[0];if(op<1){return;}
 tA=document.getElementById('p7PMnav').getElementsByTagName("A");wH=window.location.href;r1=/index\.[\S]*/i;for(i=0;i<tA.length;i++){
 if(tA[i].href){aU=tA[i].href.replace(r1,'');if(op>0){if(tA[i].href==wH||aU==wH){k=i;kk=-1;break;}}if(op==2){if(tA[i].firstChild){
 if(tA[i].firstChild.nodeValue==mt[1]){kk=i;}}}if(op==3 && tA[i].href.indexOf(mt[1])>-1){kk=i;}if(op==4){for(x=1;x<mt.length;x+=2){
 if(wH.indexOf(mt[x])>-1){if(tA[i].firstChild&&tA[i].firstChild.data){if(tA[i].firstChild.data==mt[x+1]){kk=i;break;}}}}}}}k=(kk>k)?kk:k;
 if(k>-1){pp=tA[k].parentNode;while(pp){if(pp.nodeName=="LI"){pp.firstChild.className="p7PMmark"+" "+pp.firstChild.className;}
 pp=pp.parentNode;}}if(kk>-1){document.p7PMad=1;}P7_PMadma();P7_PMadmb();
}
function P7_PMadma(){ //v1.0 by PVII-www.projectseven.com
 var s,ss,i,j,a,g,b,c,d,t,h,tA,b,tP,r1,r2,tI,bA,aA,tB=new Array(),bC='',x=0,ur=1,mt=document.p7PMad;g=document.getElementById("p7PMnav");
 b=document.getElementById("pmmcrumb");if(g&&b){c=b.getElementsByTagName("A");if(c&&c[0]){tP=c[0].parentNode.childNodes;r1=/<a/i;r2=/\/a>/i;
 tI=c[0].parentNode.innerHTML;j=tI.search(r1);bA=tI.substring(0,j);j=tI.search(r2);aA=tI.substring(j+3);bC+=(bA)?bA:'';s=(aA)?aA:' &gt ';
 if(!c[0].id||c[0].id!="pmmcn"){if(c[0].href!=window.location.href){tB[0]=c[0];x++;ur=2;}}tA=g.getElementsByTagName("A");for(i=0;i<tA.length;i++){
 if(tA[i].className.indexOf("p7PMmark")>-1){tB[x]=tA[i];x++;}}for(i=0;i<tB.length;i++){ss=(i>0)?s:'';a=(i==tB.length-1)?0:1;
 d=(i==0&&c[0].id)?'id="'+c[0].id+'" ':' ';t=tB[i].firstChild.nodeValue;if(a==1||mt==1||x<ur){bC+=ss+'<a '+d+'hr'+'ef="'+tB[i].href+'">'+t+'</a>';
 }else{bC+=ss+t;}}if(mt==1||i<ur){ss=(i>0)?s:'';bC+=ss+document.title;}c[0].parentNode.innerHTML=bC;}}
}
function P7_PMadmb(){ //v1.0 by PVII-www.projectseven.com
 var h='',g,i,tA,b,m=false;g=document.getElementById("p7PMnav");b=document.getElementById("pmmnext");if(g&&b){tA=g.getElementsByTagName("A");
 for(i=tA.length-1;i>-1;i--){if(tA[i].className.indexOf("p7PMmark")>-1){m=true;break;}}if(m){if(i<tA.length-1){i++;}else{i=0;}
 while(tA[i].href==window.location.href+"#"||tA[i].href=="javascript:;"){i++;if(i>tA.length-1){
 i=0;break;}}b.href=tA[i].href;b.innerHTML=tA[i].firstChild.nodeValue;}}	
}
//============= DIGITAL CALM, INC. ======================================
//**** SLIDE SHOW SCRIPTS *********
function switchImage(imgName, imgSrc) 
{
  if (document.images)
  {
    if (imgSrc != "none")
    {
      document.images[imgName].src = imgSrc;
    }
  }
}
// * Dependencies * 
// this function requires the following snippets:
// JavaScript/images/switchImage
//
// BODY Example:
// <body onLoad="mySlideShow1.play(); mySlideShow2.play();">
// <img src="../common/originalImage1.gif" name="slide1">
// <img src="../common/originalImage2.gif" name="slide2">
//
// SCRIPT Example:
// var mySlideList1 = ['image1.gif', 'image2.gif', 'image3.gif'];
// var mySlideShow1 = new SlideShow(mySlideList1, 'slide1', 3000, "mySlideShow1");
// var mySlideList2 = ['image4.gif', 'image5.gif', 'image6.gif'];
// var mySlideShow2 = new SlideShow(mySlideList2, 'slide2', 1000, "mySlideShow2");
function SlideShow(slideList, image, speed, name)          
{
  this.slideList = slideList;
  this.image = image;
  this.speed = speed;
  this.name = name;
  this.current = 0;
  this.timer = 0;
}
SlideShow.prototype.play = SlideShow_play;  
function SlideShow_play()       
{
  with(this)
  {
    if(current++ == slideList.length-1) current = 0;
    switchImage(image, slideList[current]);
    clearTimeout(timer);
    timer = setTimeout(name+'.play()', speed);
  }
}
//**** IMPROVED SLIDE SHOW SCRIPTS *********
function switchImage2(imgName, imgSrc, imgAlt, imgWidth, imgHeight, titleID, LinkID, sLink) 
{
  var oTitle;
  if (document.images)
  {
    if (imgSrc != "none")
    {
      document.images[imgName].src = imgSrc;
	  document.images[imgName].width = imgWidth;
	  document.images[imgName].height = imgHeight;
	  document.images[imgName].alt = imgAlt;
	  oTitle = document.getElementById (titleID);
	  oTitle.innerHTML = imgAlt + "<br><a href='" + sLink + "'>Click here for more info ...</a>";
	  oLink = document.getElementById (LinkID);
      oLink.href = sLink;
    }
  }
}
// * Dependencies * 
// this function requires the following snippets:
// JavaScript/images/switchImage
//
// BODY Example:
// <body onLoad="mySlideShow1.play(); mySlideShow2.play();">
// <img src="../common/originalImage1.gif" name="slide1">
// <img src="../common/originalImage2.gif" name="slide2">
//
// SCRIPT Example:
// var mySlideList1 = ['image1.gif', 'image2.gif', 'image3.gif'];
// var mySlideShow1 = new SlideShow(mySlideList1, 'slide1', 3000, "mySlideShow1");
// var mySlideList2 = ['image4.gif', 'image5.gif', 'image6.gif'];
// var mySlideShow2 = new SlideShow(mySlideList2, 'slide2', 1000, "mySlideShow2");
function SlideShow2(slideList, image, speed, name, titleid, linkid)
{
  this.slideList = slideList;
  this.image = image;
  this.speed = speed;
  this.name = name;
  this.current = 0;
  this.timer = 0;
  this.titleid = titleid;
  this.linkid = linkid;
}
SlideShow2.prototype.play = SlideShow2_play;  
function SlideShow2_play()
{
  var sTemp
  with(this)
  {
    if(current++ == slideList.length-1) current = 0;
	sTemp = slideList [current];
	var aTemp = sTemp.split ("|");
//	alert ("aTemp=" + sTemp);
    switchImage2(image, aTemp[0], aTemp[1], aTemp[2], aTemp[3], titleid, linkid, aTemp[4]);
    clearTimeout(timer);
    timer = setTimeout(name+'.play()', speed);
  }
}

//***** DIGITAL CALM Scripts for Coin Searches
function process_coinsearch () {
  var sDenom, sGrade, sDate, sMint, sNew, sParam;
  var sSvc;										// 1.18.07
  var sQuote = '"';
  sDenom = document.searchcoins.denom.value;
  sGrade = document.searchcoins.grade.value;
  sDate = document.searchcoins.coindate.value;
  sMint = document.searchcoins.mint.value;
  sNew = document.searchcoins.recent.value;
  sSvc = document.searchcoins.svc.value;		// 1.18.07
  sParam = "";
  if (sDenom.length > 0) {
    sParam = "?Denom=" + sDenom; + "&Type=" }
  if (sGrade != " ") {
    if (sParam.length > 0) {
	  sParam = sParam + "&Grade=" + sGrade; }
	else {
	  sParam = "?Grade=" + sGrade; }
	}
  if (sDate.length > 0) {
    if (sParam.length > 0) {
	  sParam = sParam + "&coindate=" + sDate; }
	else {
	  sParam = "?coindate=" + sDate; }
	}
  if (sMint != " ") {
    if (sParam.length > 0) {
	  sParam = sParam + "&Mint=" + sMint; }
	else {
	  sParam = "?Mint=" + sMint; }
	}
  if (document.searchcoins.recent.checked) {   
//  if (sNew != " ") {
    if (sParam.length > 0) {
	  sParam = sParam + "&New=" + sNew; }
	else {
	  sParam = "?New=" + sNew; }
	}  
//  alert ("Search Param is " + sParam);
  if (sSvc != " ") {							// 1.18.07
    if (sParam.length > 0) {					// 1.18.07
	  sParam = sParam + "&Svc=" + sSvc; }		// 1.18.07
	else {										// 1.18.07
	  sParam = "?Svc=" + sSvc; }				// 1.18.07
	}											// 1.18.07
//  sParam="?Denom="  + sDenom  + "&Type=&Grade=" + sGrade + "&Date=" + sDate + "&Mint=" + sQuote + sMint + sQuote;
  document.searchcoins.action = "q.asp" + sParam;
//  document.searchcoins.submit ();  	   
}
function process_modcoinsearch () {
//  alert("In process_modcoinsearch");
  var sDesign, sGrade, sDate, sMint, sNew, sParam;
  var sSvc;										// 1.18.07
  var sQuote = '"';
  sDesign = document.searchmodcoins.moddsgn.value;
  sGrade = document.searchmodcoins.modgrade.value;
  sDate = document.searchmodcoins.modyr.value;
//  sMint = document.searchmodcoins.modmint.value;
  sNew = document.searchmodcoins.recent.value;
  sSvc = document.searchmodcoins.modsvc.value;		// 1.18.07
  sParam = "";
  if (sDesign.length > 0) {
    sParam = "?moddsgn=" + sDesign; }
  if (sGrade != " ") {
    if (sParam.length > 0) {
	  sParam = sParam + "&modgrade=" + sGrade; }
	else {
	  sParam = "?modgrade=" + sGrade; }
	}
  if (sDate.length > 0) {
    if (sParam.length > 0) {
	  sParam = sParam + "&modyr=" + sDate; }
	else {
	  sParam = "?modyr=" + sDate; }
	}
//  if (sMint != " ") {
//    if (sParam.length > 0) {
//	  sParam = sParam + "&modmint=" + sMint; }
//	else {
//	  sParam = "?modmint=" + sMint; }
//	}
  if (document.searchmodcoins.recent.checked) {   
//  if (sNew != " ") {
    if (sParam.length > 0) {
	  sParam = sParam + "&show=" + sNew; }
	else {
	  sParam = "?show=" + sNew; }
	}  
//  alert ("Search Param is " + sParam);
  if (sSvc != " ") {							// 1.18.07
    if (sParam.length > 0) {					// 1.18.07
	  sParam = sParam + "&modsvc=" + sSvc; }		// 1.18.07
	else {										// 1.18.07
	  sParam = "?modsvc=" + sSvc; }				// 1.18.07
	}											// 1.18.07
//  sParam="?Denom="  + sDenom  + "&Type=&Grade=" + sGrade + "&Date=" + sDate + "&Mint=" + sQuote + sMint + sQuote;
  document.searchmodcoins.action = "mq/" + sParam;
//  document.searchcoins.submit ();  	   
}
function process_combosearch () {
  //this processes a combination Rare/Modern Coin search form
  var bRare, sDenom, sGrade, sDate, sMint, oNew, sParam;
  var sSvc;										// 1.18.07
  var sQuote = '"';
  bRare = document.getElementById("rare").checked;
  if (bRare) {	  //Rare Coin Search
	  sDenom = document.getElementById("denom").value;
	  sGrade = document.getElementById("grade").value;
	  sDate = document.getElementById("coindate").value;
	  sMint = document.getElementById("mint").value;
	  oNew = document.getElementById("recent");
	  sSvc = document.getElementById("svc").value;		// 1.18.07
	  sParam = "";
	  if (sDenom.length > 0) {
		sParam = "?Denom=" + sDenom; + "&Type=" }
	  if (sGrade != " ") {
		if (sParam.length > 0) {
		  sParam = sParam + "&Grade=" + sGrade; }
		else {
		  sParam = "?Grade=" + sGrade; }
		}
	  if (sDate.length > 0) {
		if (sParam.length > 0) {
		  sParam = sParam + "&coindate=" + sDate; }
		else {
		  sParam = "?coindate=" + sDate; }
		}
	  if (sMint != " ") {
		if (sParam.length > 0) {
		  sParam = sParam + "&Mint=" + sMint; }
		else {
		  sParam = "?Mint=" + sMint; }
		}
	  if (oNew.checked) {   
	//  if (sNew != " ") {
		if (sParam.length > 0) {
		  sParam = sParam + "&New=" + oNew.value; }
		else {
		  sParam = "?New=" + oNew.value; }
		}  
	//  alert ("Search Param is " + sParam);
	  if (sSvc != " ") {							// 1.18.07
		if (sParam.length > 0) {					// 1.18.07
		  sParam = sParam + "&Svc=" + sSvc; }		// 1.18.07
		else {										// 1.18.07
		  sParam = "?Svc=" + sSvc; }				// 1.18.07
		}											// 1.18.07
	//  sParam="?Denom="  + sDenom  + "&Type=&Grade=" + sGrade + "&Date=" + sDate + "&Mint=" + sQuote + sMint + sQuote;
	  document.combosearch.action = "q.asp" + sParam;
   } else {	//modern search
	  sDenom = document.getElementById("moddsgn").value;
	  sGrade = document.getElementById("modgrade").value;
	  sDate = document.getElementById("modyr").value;
	//  sMint = document.searchmodcoins.modmint.value;
	  oNew = document.getElementById("show");
	  sSvc = document.getElementById("modsvc").value;		// 1.18.07
	  sParam = "";
	  if (sDenom.length > 0) {
		sParam = "?moddsgn=" + sDenom; }
	  if (sGrade != " ") {
		if (sParam.length > 0) {
		  sParam = sParam + "&modgrade=" + sGrade; }
		else {
		  sParam = "?modgrade=" + sGrade; }
		}
	  if (sDate.length > 0) {
		if (sParam.length > 0) {
		  sParam = sParam + "&modyr=" + sDate; }
		else {
		  sParam = "?modyr=" + sDate; }
		}
	//  if (sMint != " ") {
	//    if (sParam.length > 0) {
	//	  sParam = sParam + "&modmint=" + sMint; }
	//	else {
	//	  sParam = "?modmint=" + sMint; }
	//	}
	  if (oNew.checked) {   
	//  if (sNew != " ") {
		if (sParam.length > 0) {
		  sParam = sParam + "&show=" + oNew.value; }
		else {
		  sParam = "?show=" + oNew.value; }
		}  
	//  alert ("Search Param is " + sParam);
	  if (sSvc != " ") {							// 1.18.07
		if (sParam.length > 0) {					// 1.18.07
		  sParam = sParam + "&modsvc=" + sSvc; }		// 1.18.07
		else {										// 1.18.07
		  sParam = "?modsvc=" + sSvc; }				// 1.18.07
		}											// 1.18.07
	//  sParam="?Denom="  + sDenom  + "&Type=&Grade=" + sGrade + "&Date=" + sDate + "&Mint=" + sQuote + sMint + sQuote;
	  document.combosearch.action = "mq.asp" + sParam;
   };
//  alert ("Search Params: " + sParam); 
  document.combosearch.submit ();
}
function process_worldcoin (slink) {
  document.searchworld.action = "/2005/worldgold_history/" + slink;
  document.searchworld.submit ();
} 

function f_refresh() 
  {
//    alert("updating prices");
    location.reload();
  }  

function toggle_search (searchtype) {
	var rareblock = document.getElementById("raresrch");
	var modblock = document.getElementById("modsrch");
	if (searchtype == "0") {	//show rare search
	  modblock.style.display = "none";
	  rareblock.style.display = "inline";
	} else {					//show modern search
	  rareblock.style.display = "none";
	  modblock.style.display = "inline";
    };
   }
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Cat Arriola :: http://astrodiva.journalspace.com */
function fixImgs(whichId, maxW) {
//	alert ("fixing image size for '" + whichId + "' to width = " + maxW);
var pix;
  if (whichId.length != "") {
    pix=document.getElementById(whichId).getElementsByTagName('img');
    for (i=0; i<pix.length; i++) {
	// DC:  remove any currently placed attributes -- in case of update
	  pix[i].removeAttribute("width");
	  pix[i].removeAttribute("height");
	// end DC
      w=pix[i].width;
      h=pix[i].height;
      if (w > maxW) {
        f=1-((w - maxW) / w);
        pix[i].width=w * f;
        pix[i].height=h * f;
      }
    }
  }
}
