function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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_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_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 WindowDisclaimer(url) {
	windowHandle = window.open(url,"popup","width=500,height=400,left=520,top=170");
}

function WindowDisclaimerComstock(url) {
	windowHandle = window.open(url,"popup2","scrollbars=yes,width=250,height=200,left=520,top=170");
}

function backward(){
if (which>0){
window.status=''
which--
document.images.photoslider.src=photos[which];
what--
document.rotater.slideNUM.value=text[what];
where--
document.rotater.description.value=description[where];
//how--
//document.value=place[how];

}

else window.status='Start of gallery'
}

function forward(){
if (which<photos.length-1){
which++
document.images.photoslider.src=photos[which];
what++
document.rotater.slideNUM.value=text[what];
where++
document.rotater.description.value=description[where];
//how++
//document.value=place[how];
}

else window.status='End of gallery'
}

function openImageWindow(URL, windowName, windowFeatures) {
var URL=place[how]
  newWindow=window.open(URL, windowName, windowFeatures);
}


function backwardText(){
if (which>0){
window.status=''
which--
document.images.photoslider.src=photos[which];
where--
document.images.exec.src=execTXT[where];

}
}

function forwardText(){
if (which<photos.length-1){
which++
document.images.photoslider.src=photos[which];
where++
document.images.exec.src=execTXT[where];

}
else window.status='End of gallery'
}

/*****************************************************************
*                                                                *
*   Information Request Form Validation                          *       
*   (investor_relations/information.asp)                         *
*                                                                *
*****************************************************************/

function validateInfoRequestForm(objForm){

  var blnFormOk = true;
  var strContactBy;
  
  var blnMailReq = false;
  var blnListReq = false;
  var blnAddressOk = false;

  //check name
  if(blnFormOk && objForm.txtName.value == ''){
    alert('Please tell us your name.');
    objFocus = objForm.txtName;
    blnFormOk = false;
  }
   

  //check for at least one requested document or mailing list
  if(objForm.checkboxqrtly.checked || objForm.checkboxannualr.checked || objForm.checkboxcip.checked || objForm.checkboxother.checked){
    blnMailReq = true;
  }
  
  if(blnFormOk && !(blnMailReq || blnListReq)){
    alert('Please select a document to receive')
    objFocus = objForm.checkboxqrtly;
    blnFormOk = false;
  }
  
  //if mail request then check for valid mailing address
  blnAddressOk = (objForm.txtAddress.value != '') && (objForm.txtCity.value != '') && (objForm.txtProvince.value != '') && (objForm.txtPostal.value != '') && (objForm.txtCountry.value != '');

  if(blnFormOk && blnMailReq && !blnAddressOk){
    var strAddressFields = new Array('txtAddress', 'txtCity', 'txtProvince', 'txtPostal', 'txtCountry');
    
    //loop through each address field to determine where to set focus
    for(i=0;i<strAddressFields.length;i++){
      if(objForm[strAddressFields[i]].value == ''){
        objFocus = objForm[strAddressFields[i]];
        i = strAddressFields.length;
      }
    }
    alert('You have requested that we mail you, please tell us your complete mailing address.\n(Include the the following: address, city, province, postal/zip, and country)')
    blnFormOk = false;
  }

  
  //if email check for email address
  if(objForm.txtEmail.value != ''){
	var strMatch = objForm.txtEmail.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
	if(blnFormOk && objForm.checkboxemail.checked && !strMatch){
		alert('You have requested that we email you, please enter a valid email address.');
		objFocus = objForm.txtEmail;
		blnFormOk = false;
	}
  }
   
   
  //if other selected check for something in other field
  if(blnFormOk && objForm.checkboxother.checked && (objForm.txtOther.value == '')){
    alert('Please specify what you would like to receive.');
    
    objFocus = objForm.txtOther;
    blnFormOk = false;
  }
  
 
  //check for maximum length of comments field
  if(blnFormOk && (objForm.txtComments.value.length > 500)){
    alert('The comments field is limited to 500 characters, please shorten your comments.');
    objFocus = objForm.txtEmail;
    blnFormOk = false;
  }

 
 if(blnFormOk && (objForm.checkboxemail.checked) && (objForm.txtEmail.value == '')){
	alert('You have specified to be added to our email distribution list. Please specify your email address.');
	objFocus = objForm.txtEmail;
	blnFormOk = false;
 }
  if(!blnFormOk)objFocus.focus();
	
  return blnFormOk;
}
