// Support Script (746)
function AddToValidateArray(strElementName)
{
    var strName = strElementName

    if (!document.ValidateArray) 
    {
        document.ValidateArray = new Array
    }

    document.ValidateArray[document.ValidateArray.length] = strName
}

// Support Script (582)
function ValidateNonBlank()
{
  var msg = "";
  var val = this.getText();  

  if (StripChars(" \n\t\r",val).length == 0)
  {
    if (Trim(this.ErrorMsg) != "")
      msg = "Required field. " + this.ErrorMsg
    else
      msg = "Required field. Please enter an appropriate value."
  }

  return msg;
}

// Support Script (747)
function StripChars(theFilter,theString)
{
	var strOut,i,curChar

	strOut = ""
	for (i=0;i < theString.length; i++)
	{		
		curChar = theString.charAt(i)
		if (theFilter.indexOf(curChar) < 0)	// if it's not in the filter, send it thru
			strOut += curChar		
	}	
	return strOut
}

function AllInRange(x,y,theString)
{
	var i, curChar
	
	for (i=0; i < theString.length; i++)
	{
		curChar = theString.charAt(i)
		if (curChar < x || curChar > y) //the char is not in range
			return false
	}
	return true
}


function reformat (s)
{
    var arg;
    var sPos = 0;
    var resultString = "";

    for (var i = 1; i < reformat.arguments.length; i++) {
       arg = reformat.arguments[i];
       if (i % 2 == 1) 
           resultString += arg;
       else 
       {
           resultString += s.substring(sPos, sPos + arg);
           sPos += arg;
       }
    }
    return resultString;
}

function Trim(theString)
{
 var i,firstNonWhite

 if (StripChars(" \n\r\t",theString).length == 0 ) return ""

	i = -1
	while (1)
	{
		i++
		if (theString.charAt(i) != " ")
			break	
	}
	firstNonWhite = i
	//Count the spaces at the end
	i = theString.length
	while (1)
	{
		i--
		if (theString.charAt(i) != " ")
			break	
	}	

	return theString.substring(firstNonWhite,i + 1)

}
// Support Script (576)
function ValidateEMail()
{
   var msg = "";
   var val = this.getText();
   var msgInvalid = "Please enter a valid e-mail address\n(a valid e-mail address contains the @ character)";

  	var theLen = StripChars(" ",val).length
	  if (theLen == 0)	
		  if (!this.Required) return ""		
		  else return "Required field.  " + msgInvalid

   if (val.indexOf("@",0) < 0) 
   {
      msg = msgInvalid 
   }
   return msg;
}

// Support Script (751)
function PopulateWith(TheList, Items)
{
  var iCount = TheList.getCount();
  for (var i=0; i<iCount; i++)
    if (TheList.elementID)
      TheList.elementID.options[0] = null;
    else
      alert("bad or wrong DE for country population");

  i = 0;
  iCount = Items.length;
 	for (i=0; i<iCount; i++)
    TheList.addOption(Items[i], i, "");

  TheList.setSelectedByPosition(0);
}
// Support Script (587)
function ValidateDropDown()
{
  msg = "";
  var iPos = this.getSelectedPosition();
  if (iPos<=0)
  {
    msg = "Please make a selection."
  }

  return msg;
}
// Support Script (738)
function getForm()
{
	var f;
	if (document.forms && document.forms[0])
	{
		// This is the case where there are only hidden form elements in an
		// all 4.0 browser page and Comm is hitting the page - and all IE cases.
		f = document.forms[0];
	}

	if (f == null)
	{
		if ((document.layers) && (document.layers.length > 0))
		{
			var d;
			iLayer = 0;
			while (true)
			{
				d = document.layers[iLayer].document.layers[0].document;
				if (d.forms && d.forms[0]) // normal case
				{
					f = d.forms[0];
					break;
				}
				iLayer = iLayer + 2;
			
				if (document.layers[iLayer] == null)
					break;
			}
		}
	}

	if (f == null)
		alert("Form not submitted - internal error: Drumbeat can not find Form object in DOM. There may not be a form on this page.");

	return f;
}

// Support Script (745)
function subAwithBinC(a,b,c)
{

	var i = c.indexOf(a);
	var l = b.length;

	while (i != -1)	{
		c = c.substring(0,i) + b + c.substring(i + a.length,c.length);
  i += l
		i = c.indexOf(a,i);
	}
	return c;

}
// Support Script (740)
function Validate(stopOnFailure)
{
	var ErrorMsg = "";
	var i
	var msg
	var tofocus = true;
	var ErrorMsg = "";
	
	// Go through the Validate Array that may or may not exist
	// and call the Validate function for all elements that have one.
	if (document.ValidateArray)
	{
		for (i = 0; i < document.ValidateArray.length; i ++)
		{
			msg = eval( document.ValidateArray[i] + ".Validate()")
			if (msg != "")
			{
				ErrorMsg += "\n\n" + document.ValidateArray[i] + ":  " + msg;
				if (tofocus) 
				{
					eval(document.ValidateArray[i] + ".focus()")
					tofocus = false;
				}
				
				if (stopOnFailure == "1") return ErrorMsg;
			}
  	}
  }
	return ErrorMsg;
}

function document_onLoad() {
Full_Name.Validate=ValidateNonBlank;
Full_Name.ErrorMsg = "Enter your name"
AddToValidateArray("Full_Name")
Email.Validate = ValidateEMail;
Email.Required = Number("1");
AddToValidateArray("Email")
var i = 0;
s = new Array(239);
s[i++] = "Select Country                       "
s[i++] = "Afghanistan"
s[i++] = "Albania"
s[i++] = "Algeria"
s[i++] = "American Samoa"
s[i++] = "Andorra"
s[i++] = "Angola"
s[i++] = "Anguilla"
s[i++] = "Antarctica"
s[i++] = "Antigua And Barbuda"
s[i++] = "Argentina"
s[i++] = "Armenia"
s[i++] = "Aruba"
s[i++] = "Australia"
s[i++] = "Austria"
s[i++] = "Azerbaijan"
s[i++] = "Bahamas"
s[i++] = "Bahrain"
s[i++] = "Bangladesh"
s[i++] = "Barbados"
s[i++] = "Belarus"
s[i++] = "Belgium"
s[i++] = "Belize"
s[i++] = "Benin"
s[i++] = "Bermuda"
s[i++] = "Bhutan"
s[i++] = "Bolivia"
s[i++] = "Bosnia and Herzegovina"
s[i++] = "Botswana"
s[i++] = "Bouvet Island"
s[i++] = "Brazil"
s[i++] = "British Indian Ocean Territory"
s[i++] = "Brunei"
s[i++] = "Bulgaria"
s[i++] = "Burkina Faso"
s[i++] = "Burundi"
s[i++] = "Cambodia"
s[i++] = "Cameroon"
s[i++] = "Canada"
s[i++] = "Cape Verde"
s[i++] = "Cayman Islands"
s[i++] = "Central African Republic"
s[i++] = "Chad"
s[i++] = "Chile"
s[i++] = "China"
s[i++] = "Christmas Island"
s[i++] = "Cocos (Keeling) Islands"
s[i++] = "Columbia"
s[i++] = "Comoros"
s[i++] = "Congo"
s[i++] = "Cook Islands"
s[i++] = "Costa Rica"
s[i++] = "Cote D'Ivoire (Ivory Coast)"
s[i++] = "Croatia (Hrvatska)"
s[i++] = "Cuba"
s[i++] = "Cyprus"
s[i++] = "Czech Republic"
s[i++] = "D.P.R. Korea"
s[i++] = "Dem Rep of Congo (Zaire)"
s[i++] = "Denmark"
s[i++] = "Djibouti"
s[i++] = "Dominica"
s[i++] = "Dominican Republic"
s[i++] = "East Timor"
s[i++] = "Ecuador"
s[i++] = "Egypt"
s[i++] = "El Salvador"
s[i++] = "Equatorial Guinea"
s[i++] = "Eritrea"
s[i++] = "Estonia"
s[i++] = "Ethiopia"
s[i++] = "Falkland Islands (Malvinas)"
s[i++] = "Faroe Islands"
s[i++] = "Fiji"
s[i++] = "Finland"
s[i++] = "France"
s[i++] = "French Guiana"
s[i++] = "French Polynesia"
s[i++] = "French Southern Territories"
s[i++] = "Gabon"
s[i++] = "Gambia"
s[i++] = "Georgia"
s[i++] = "Germany"
s[i++] = "Ghana"
s[i++] = "Gibraltar"
s[i++] = "Greece"
s[i++] = "Greenland"
s[i++] = "Grenada"
s[i++] = "Guadeloupe"
s[i++] = "Guam"
s[i++] = "Guatemala"
s[i++] = "Guinea"
s[i++] = "Guinea-Bissau"
s[i++] = "Guyana"
s[i++] = "Haiti"
s[i++] = "Heard and McDonald Islands"
s[i++] = "Honduras"
s[i++] = "Hong Kong SAR, PRC"
s[i++] = "Hungary"
s[i++] = "Iceland"
s[i++] = "India"
s[i++] = "Indonesia"
s[i++] = "Iran"
s[i++] = "Iraq"
s[i++] = "Ireland"
s[i++] = "Israel"
s[i++] = "Italy"
s[i++] = "Jamaica"
s[i++] = "Japan"
s[i++] = "Jordan"
s[i++] = "Kazakhstan"
s[i++] = "Kenya"
s[i++] = "Kiribati"
s[i++] = "Korea"
s[i++] = "Kuwait"
s[i++] = "Kyrgyzstan"
s[i++] = "Lao"
s[i++] = "Latvia"
s[i++] = "Lebanon"
s[i++] = "Lesotho"
s[i++] = "Liberia"
s[i++] = "Libya"
s[i++] = "Liechtenstein"
s[i++] = "Lithuania"
s[i++] = "Luxembourg"
s[i++] = "Macao"
s[i++] = "Macedonia"
s[i++] = "Madagascar"
s[i++] = "Malawi"
s[i++] = "Malaysia"
s[i++] = "Maldives"
s[i++] = "Mali"
s[i++] = "Malta"
s[i++] = "Marshall Islands"
s[i++] = "Martinique"
s[i++] = "Mauritania"
s[i++] = "Mauritius"
s[i++] = "Mayotte"
s[i++] = "Mexico"
s[i++] = "Macronesia"
s[i++] = "Moldova"
s[i++] = "Monaco"
s[i++] = "Mongolia"
s[i++] = "Montserrat"
s[i++] = "Morocco"
s[i++] = "Mozambique"
s[i++] = "Myanmar"
s[i++] = "Namibia"
s[i++] = "Nauru"
s[i++] = "Nepal"
s[i++] = "Netherlands"
s[i++] = "Netherlands Antilles"
s[i++] = "New Caledonia"
s[i++] = "New Zealand"
s[i++] = "Nicaragua"
s[i++] = "Niger"
s[i++] = "Nigeria"
s[i++] = "Niue"
s[i++] = "Norfolk Island"
s[i++] = "Northern Mariana Islands"
s[i++] = "Norway"
s[i++] = "Oman"
s[i++] = "Pakistan"
s[i++] = "Palau"
s[i++] = "Panama"
s[i++] = "Papua new Guinea"
s[i++] = "Paraguay"
s[i++] = "Peru"
s[i++] = "Philippines"
s[i++] = "Pitcairn"
s[i++] = "Poland"
s[i++] = "Portugal"
s[i++] = "Puerto Rico"
s[i++] = "Qatar"
s[i++] = "Reunion"
s[i++] = "Romania"
s[i++] = "Russia"
s[i++] = "Rwanda"
s[i++] = "Saint Kitts And Nevis"
s[i++] = "Saint Lucia"
s[i++] = "Saint Vincent And The Grenadines"
s[i++] = "Samoa"
s[i++] = "San Marino"
s[i++] = "Sao Tome and Principe"
s[i++] = "Saudi Arabia"
s[i++] = "Senegal"
s[i++] = "Seychelles"
s[i++] = "Sierra Leone"
s[i++] = "Singapore"
s[i++] = "Slovak Republic"
s[i++] = "Slovenia"
s[i++] = "Solomon Islands"
s[i++] = "Somalia"
s[i++] = "South Africa"
s[i++] = "South Georgia And The South Sandwich Islands"
s[i++] = "Spain"
s[i++] = "Sri Lanka"
s[i++] = "St Helena"
s[i++] = "St Pierre and Miquelon"
s[i++] = "Sudan"
s[i++] = "Suriname"
s[i++] = "Svalbard And Jan Mayen Islands"
s[i++] = "Swaziland"
s[i++] = "Sweden"
s[i++] = "Switzerland"
s[i++] = "Syria"
s[i++] = "Taiwan Region"
s[i++] = "Tajikistan"
s[i++] = "Tanzania"
s[i++] = "Thailand"
s[i++] = "Togo"
s[i++] = "Tokelau"
s[i++] = "Tonga"
s[i++] = "Trinidad And Tobago"
s[i++] = "Tunisia"
s[i++] = "Turkey"
s[i++] = "Turkmenistan"
s[i++] = "Turks And Caicos Islands"
s[i++] = "Tuvalu"
s[i++] = "Uganda"
s[i++] = "Ukraine"
s[i++] = "United Arab Emirates"
s[i++] = "United Kingdom"
s[i++] = "United States"
s[i++] = "United States Minor Outlying Islands"
s[i++] = "Uruguay"
s[i++] = "Uzbekistan"
s[i++] = "Vanuatu"
s[i++] = "Vatican City State (Holy See)"
s[i++] = "Venezuela"
s[i++] = "Vietnam"
s[i++] = "Virgin Islands (British)"
s[i++] = "Virgin Islands (US)"
s[i++] = "Wallis And Futuna Islands"
s[i++] = "Western Sahara"
s[i++] = "Yemen"
s[i++] = "Yugoslavia"
s[i++] = "Zambia"
s[i++] = "Zimbabwe"

PopulateWith(Country, s);
Country.Validate = ValidateDropDown;
AddToValidateArray("Country")
Comment.Validate=ValidateNonBlank;
Comment.ErrorMsg = "Enter your request/comment"
AddToValidateArray("Comment")
 }
function feedbacksent_onClick() {
// We do not call onSubmit() with this contract

var formObj = getForm()
if (formObj != null)
{
var addChar = "?" 
var j
var Result
var okToSubmit = false

if ("".length > 1)
{
    formObj.action = subAwithBinC(" ", "%20", "")
}

// We have to
// put the source in the query string so the generic database contracts
// still work.

// NOTE: this only works if the method of the form is POST

act = formObj.action
if (act.indexOf("?") != -1)
{    
    addChar = "&"
}

act += addChar + "feedbacksent=1"
formObj.action = act


if ("1" == "1")
{
    Result = Validate("0"); // don't stop on first error
    if (Result == "") okToSubmit = true;
    else alert("The form could not be submitted:" + Result);
}
else 
{
    okToSubmit = true
}


if (okToSubmit) formObj.submit();
}
 }
function _feedbacksent_onClick() { if (feedbacksent) return feedbacksent.onClick(); }

