//Standard Reset doesn't work because data is reloaded

//Reset function for feedback
 function resetfb()
 {
 document.fdback.orionServerVersion.value="1.0.02";
 document.fdback.orionClientVersion.value="1.0.02";
 document.fdback.javaVersion.value="1.4.2";
 document.fdback.otherJava.value="";
 document.fdback.progLang.value="Java";
 //document.fdback.os.value="Windows";

 document.fdback.otherOrnSerVsn.value="";
 document.fdback.otherOrnClient.value="";

 document.fdback.osClient.value="Windows";
 document.fdback.osServer.value="Windows";
 //document.fdback.osClientVersion.value="";
document.fdback.osVersion.value="";
 
 document.fdback.name.value="";
 document.fdback.email.value="";
 document.fdback.company.value="";
 document.fdback.login.value="";
 document.fdback.ratingExp.value=" ";
 document.fdback.exp.value="";
 document.fdback.ratingPricing.value="";
 document.fdback.pricing.value="";
 document.fdback.ratingQuality.value="";
 document.fdback.quality.value="";
 document.fdback.ratingDoc.value="";
 document.fdback.doc.value="";
 document.fdback.strengths.value="";
 document.fdback.keyFeature.value="";
 document.fdback.alternative.value="";
 //document.fdback.concerns.value="";
// document.fdback.confidence.value="";
 document.fdback.addComments.value="";
 }
 
 
 

//Reset function for probsubm
 function resetps()
 {
 document.probsub.orionVsn.value="1.0.02";
 document.probsub.otherVersion.value="";
 document.probsub.javaVersion.value="1.4.2";
 document.probsub.otherJava.value="";
 document.probsub.progLang.value="Java";
 document.probsub.os.value="Windows";
 document.probsub.osVersion.value="";
 document.probsub.name.value="";
 document.probsub.email.value="";
 document.probsub.company.value="";
 document.probsub.login.value="";
 document.probsub.probSyn.value="";
 document.probsub.probDesc.value="";
 document.probsub.severity.value="Critical - Show Stopper";
 document.probsub.addInfo.value="";
 document.probsub.probRepro.value="";
 document.probsub.bugFile.value="";
 }	
 
 //Reset function for contact
 function resetct()
{
document.contact.contactTarget[0].checked=true;
document.contact.name.value="";
document.contact.company.value="";
document.contact.email.value="";
document.contact.phone.value="";
document.contact.topic.value="";
document.contact.message.value="";
}

//Reset function for htb
 function resethtb()
{
document.datacollect.name.value="";
document.datacollect.company.value="";
document.datacollect.email.value="";
document.datacollect.phone.value="";
document.datacollect.OSUser.value="";
document.datacollect.OSMachine.value="";
document.datacollect.edition.value="Pro";
document.datacollect.q.value="";
document.datacollect.price.value="";
document.datacollect.ecommerce.value="Yes";
document.datacollect.promo.value="";
document.datacollect.server.value="No";
}

//Reset function for taf
function resettaf()
{
document.tellfriend.collName.value="";
document.tellfriend.collEmail.value="";
document.tellfriend.message.value="";
document.tellfriend.name.value="";
document.tellfriend.email.value="";
}

//Validate for special terms
function validatespecial()
{

}

//Validate for orion decline
function validatedcl()
{
var declinefield=document.declineterms.reason.value;
if(declinefield=="")
{
	alert("You have left the comments field blank.");
	document.declineterms.reason.focus();
	return false;
}
}







//Register
function validatereg()
{
var namefield=document.register.fname.value;
if(namefield=="")
{
	alert("Please enter your first name");
	document.register.fname.focus();
	return false;
}
var namefield=document.register.lname.value;
if(namefield=="")
{
	alert("Please enter your last name");
	document.register.lname.focus();
	return false;
}
var companyfield=document.register.company.value;
if(companyfield=="")
{
	alert("Please enter your Company name");
	document.register.company.focus();
	return false;
}
if(!email(document.register.email.value))
{
	document.register.email.focus();
	return false
}
if(!document.register.altemail.value=="")
{
	if(!email(document.register.altemail.value))
	{
		document.register.altemail.focus();
		return false
	}
}
if(!phone(document.register.phone.value))
{
	document.register.phone.focus();
	return false
}
if(!document.register.altphone.value=="")
{
	if(!phone(document.register.altphone.value))
	{
		document.register.altphone.focus();
	return false
	}
}
var urlfield=document.register.url.value;
var validUrl = /^((http|https|ftp):\/\/)?(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i;
var isValid=(validUrl.test(urlfield));
if(isValid==false&&urlfield!=""&&urlfield!="http://")
{
	alert("There is a problem with the format of your website url.");
	document.register.url.focus();
	return false;
}
return true;
}



//Feedback
function validatefb()
{

var osVersionfield=document.fdback.osVersion.value;
if(osVersionfield=="")
{
	alert("Please input the Version/Service pack of the Operating System you are using.");
	document.fdback.osVersion.focus();
	return false;
}
var namefield=document.fdback.name.value;
if(namefield=="")
{
	alert("Please input your name.");
	document.fdback.name.focus();
	return false;
}
var loginfield=document.fdback.login.value;
if(loginfield=="")
{
	alert("Please input your User login.");
	document.fdback.login.focus();
	return false;
}
if(!email(document.fdback.email.value))
{
	document.fdback.email.focus();
	return false
}
var companyfield=document.fdback.company.value;
if(companyfield=="")
{
	alert("Please input the name of your Company.");
	document.fdback.company.focus();
	return false;
}
var orionClientVersionfield=document.fdback.orionClientVersion.value;
var orionServerVersionfield=document.fdback.orionServerVersion.value;
var otherOrnSerVsnfield = document.fdback.otherOrnSerVsn.value;
if(orionServerVersionfield == "other" && otherOrnSerVsnfield =="")
{
	alert ("Please input other Orion Server Version.");
	document.fdback.otherOrnSerVsn.focus();
	return false;
}

var otherOrnClientfield = document.fdback.otherOrnClient.value;
if(orionClientVersionfield == "other" && otherOrnClientfield =="")
{
	alert ("Please input other Orion Client Version.");
	document.fdback.otherOrnClient.focus();
	return false;
}

var javafield=document.fdback.javaVersion.value;
var otherJavafield=document.fdback.otherJava.value;
//alert(document.fdback.otherJava.value);
//alert(otherJavafield  + "         aa");

if(javafield == "other" && otherJavafield == "")
{
	alert ("Please input the version of Java SDK you are using.");
	document.fdback.otherJava.focus();
	return false;
}

}

//Contact Us
function validatect()
{
var namefield=document.contact.name.value;
var topicfield=document.contact.topic.value;
var phonefield=document.contact.phone.value;
var companyfield=document.contact.company.value;
var emailfield=document.contact.email.value;
var messagefield=document.contact.message.value;
if(phonefield==""|topicfield==""|namefield==""|companyfield==""|emailfield==""|messagefield=="")
{
	alert("Please complete all fields.");
	return false;
}
if(!email(document.contact.email.value))
{
	document.contact.email.focus();
	return false
}
if(!phone(document.contact.phone.value))
{
	document.contact.phone.focus();
	return false
}
}


//Tell a Friend
function validatetaf()
{
if(!email(document.tellfriend.collEmail.value))
{
	document.tellfriend.collEmail.focus();
	return false
}
if(!email(document.tellfriend.email.value))
{
	document.tellfriend.email.focus();
	return false
}
}

//Problem Submission
function validateps()
{
//var orionfield=document.probsub.orionVsn.value;
var orionVsnfield=document.probsub.otherVersion.value;
if(orionfield=="Other"&&orionVsnfield=="")
{
	alert ("Please input the version of EasyLicenser you are using.");
	document.probsub.otherVersion.focus();
	return false;
}
var javafield=document.probsub.javaVersion.value;
var javaVsnfield=document.probsub.otherJava.value;
if(javafield=="other"&&javaVsnfield=="")
{
	alert ("Please input the version of Java SDK you are using.");
	document.probsub.otherJava.focus();
	return false;
}
var osVersionfield=document.probsub.osVersion.value;
if(osVersionfield=="")
{
	alert("Please input the Version/Service pack of the Operating System you are using.");
	document.probsub.osVersion.focus();
	return false;
}
var namefield=document.probsub.name.value;
if(namefield=="")
{
	alert("Please input your name.");
	document.probsub.name.focus();
	return false;
}

if(!email(document.probsub.email.value))
{
	document.probsub.email.focus();
	return false
}

var companyfield=document.probsub.company.value;
if(companyfield=="")
{
	alert("Please input the name of your Company.");
	document.probsub.company.focus();
	return false;
}
var loginfield=document.probsub.login.value;
if(loginfield=="")
{
	alert("Please input your login name.");
	document.probsub.login.focus();
	return false;
}
}



//Questionnaire
function validatequ()
{
var namefield=document.questionnaire.name.value;
if(namefield=="")
{
	alert("Please enter your name");
	document.questionnaire.name.focus();
	return false;
}
var companyfield=document.questionnaire.company.value;
if(companyfield=="")
{
	alert("Please enter your Company name");
	document.questionnaire.company.focus();
	return false;
}
if(!email(document.questionnaire.email.value))
{
	document.questionnaire.email.focus();
	return false
}
if(!phone(document.questionnaire.phone.value))
{
	document.questionnaire.phone.focus();
	return false
}
if(!document.questionnaire.altPhone.value=="")
{
	if(!phone(document.questionnaire.altPhone.value))
	{
		document.questionnaire.altPhone.focus();
	return false
	}
}
var urlfield=document.questionnaire.url.value;
var validUrl = /^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i;
var isValid=(validUrl.test(urlfield));
if(isValid==false&&urlfield!=""&&urlfield!="http://")
{
	alert("There is a problem with the format of your website url.");
	document.questionnaire.url.focus();
	return false;
}
var hearfield=document.questionnaire.hearabout.value;

var otherHearfield=document.questionnaire.otherHear.value;
if(hearfield=="trade"&&otherHearfield=="")
{
	alert("Please enter the name of the trade magazine in which you read about our products");
	document.questionnaire.hearabout.focus();
	return false;
}
if(hearfield=="other"&&otherHearfield=="")
{
	alert("Please tell us where you heard about our products");
	document.questionnaire.hearabout.focus();
	return false;
}
var hearfield=document.questionnaire.hearabout.value;
var otherHearfield=document.questionnaire.otherHear.value;
if(hearfield=="web"&&otherHearfield=="")
{
	alert("Please enter the name of the search engine you used to find us");
	document.questionnaire.hearabout.focus();
	return false;
}
var langfield=document.questionnaire.otherLang.checked;
var otherLangfield=document.questionnaire.inOtherLang.value;
if(langfield==true&&otherLangfield=="")
{
	alert("Please enter the name of the language/environment you use");
	document.questionnaire.inOtherLang.focus();
	return false;
}
var appsfield=document.questionnaire.otherApps.checked;
var otherAppsfield=document.questionnaire.inOtherApps.value;
if(appsfield==true&&otherAppsfield=="")
{
	alert("Please enter the type of application you are developing");
	document.questionnaire.inOtherApps.focus();
	return false;
}
var osfield=document.questionnaire.otherOS.checked;
var otherOSfield=document.questionnaire.inOtherOS.value;
if(osfield==true&&otherOSfield=="")
{
	alert("Please enter the name of the platform that you use");
	document.questionnaire.inOtherOS.focus();
	return false;
}
return true;
}

//email cannot be blank
function email(emailfield)
{
if(emailfield=="")
{
	alert("Please input email address.");
	return false;
}
var validEmail=/^\w(\.?[-\w])*@\w(\.?[-\w])*\.[a-z]{2,4}$/i;
var isValid=(validEmail.test(emailfield));
if(isValid==false)
{
	alert("There is a problem with the format of the email address.");
	return false;
}
return true;
}

//email can be blank
function emailif(emailfield)
{
var validEmail=/^\w(\.?[-\w])*@\w(\.?[-\w])*\.[a-z]{2,4}$/i;
var isValid=(validEmail.test(emailfield));
if(isValid==true||emailfield=="")
{
return true;
}
else
{
	alert("There is a problem with the format of the email address.");
	return false;
}
}

function phone(phonefield)
{
if(phonefield=="")
{
	alert("Please input your phone number.");
	return false;
}
var validPhone=/^(\+)?(\d{1,3} ?)?(\(\d{1,5}\)|\d{1,5})( ?|[-])\d{3}( ?|[-])\d{0,7}( ?(x|xtn|ext|extn|extension)?\.? ?\d{1,5})?$/i;
var isValid=(validPhone.test(phonefield));
if(isValid==false)
{
	alert("There is a problem with the format of your phone number.");
	return false;
}
return true;
}


//Dreamweaver functions
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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

// JavaScript Document

