<!--

/*

addRemoveClass:

check if there is already a class applied and add the new one preceeded by a space if that is the case:
a - defines the action you want the function to perform.
o - the object in question.
c1 - the name of the first class
c2 - the name of the second class

Possible actions are:

swap - replaces class c1 with class c2 in object o.
add - adds class c1 to the object o.
remove - removes class c1 from the object o.
check - test if class c1 is already applied to object o and returns true or false. 

*/

function addRemoveClass(a,o,c1,c2)
{
  switch (a){
    case 'swap':
      o.className=!addRemoveClass('check',o,c1)?o.className.replace(c2,c1): o.className.replace(c1,c2);
    break;
    case 'add':
      if(!addRemoveClass('check',o,c1)){o.className+=o.className?' '+c1:c1;}
    break;
    case 'remove':
      var rep=o.className.match(' '+c1)?' '+c1:c1;
      o.className=o.className.replace(rep,'');
    break;
    case 'check':
      return new RegExp('\\b'+c1+'\\b').test(o.className)
    break;
  }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
	var str = new String(features);
	var hStartPos, hEndPos, hVal 
	var wStartPos, wEndPos, wVal	
	var x, y
	
	if((str.indexOf("height") >= 0)&&(str.indexOf("width") >= 0)) {
		hStartPos = str.indexOf("height");	
		hEndPos = str.indexOf(",", hStartPos);
		hVal = str.substring(hStartPos + 7, hEndPos);
	
		wStartPos = str.indexOf("width");	
		wEndPos = str.indexOf(",", wStartPos);
		wVal = str.substring(wStartPos + 6, wEndPos);
	
		x = (screen.availWidth / 2) - (wVal / 2)
		y = (screen.availHeight / 2) - (hVal / 2)
		
		var newWin = window.open(theURL,winName,features);
		newWin.moveTo(x, y);
	}
	else {
		window.open(theURL,winName,features);
	}
}


// fieldList is comma separated, no whitespace
function chkReqdFields(formName, fieldList) {
	var arrFields;
	var i = 0
//	alert('Checking ' + formName);

	arrFields = fieldList.split(',');
	for(i = 0; i<arrFields.length; i++) {
		//alert('Checking ' + arrFields[i]);
		if(isWhitespace(eval('document.forms["' + formName + '"].' + arrFields[i] + '.value'))) {
			alert("Please fill in all required fields.");
			return false;
		}
	}
	return true;
}


function fieldsetOver() {
	var fieldsets = document.getElementsByTagName('fieldset');
	for (i=0;i<fieldsets.length;i++) {
		fieldsets[i].onmouseover=function() {
		this.className+="over";
		}
		fieldsets[i].onmouseout = function(){
            this.className = this.className.replace(/\bover\b/, "");
        }
   }
   fieldsets=null;
}

	
	function stripe() {
    if (!document.getElementsByTagName) return;
		var tables = document.getElementsByTagName("table");
		for (var h=0; h < tables.length; h++) {
			var table = tables[h];
			var trs = table.getElementsByTagName("tr");
			for (var i = 0; i < trs.length; i += 2) {
				addRemoveClass('add',trs[i],'even');
			}
		}
  }

function externalLinks() {
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
}
}
  
window.onload=function(){
 stripe();
 fieldsetOver();
 externalLinks();
}

function moveToNextField(firstField,secondField,fieldLength){
	var field1 = document.getElementById(firstField)
	var field2 = document.getElementById(secondField)
	if(field1.value.length == fieldLength){
		field2.focus();
		field2.select();
	}
}

function OpenCertDetails()
{
thewindow =window.open('https://www.thawte.com/cgi/server/certdetails.exe?code=usgold307-1', 'anew',config='height=400,width=516,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,directories=no,status=yes');
}