//get request value from url
function Request(par)
{
	var thisLocation;
	var tmpStr1="";
	var Arr2=new Array();
	var expKey;
	var outString;
	lct=window.location.toString();
	lct=unescape(unescape(lct));
	lct=lct.replace("[|L]","\/")
	lct=lct.replace("[|R]","\\")
	var tmpArr1=lct.split("?");
	for (i=1;i<tmpArr1.length;i++)
	{
		tmpStr1+=tmpArr1[i]+"?";
	}
	tmpStr1=tmpStr1.substr(0,tmpStr1.length-1)
	Arr2=tmpStr1.split("&");
	for (i=0;i<Arr2.length;i++)
	{
		expKey=eval("/^"+par+"\\s*\\=/");
		if (expKey.test(Arr2[i]))
		{
			
			outString=Arr2[i].replace(expKey,"");
			outString=outString.replace(/\%20/g," ");
			return outString;
		}

	}
	return "";
}
function HandChangeVersion( productObj, versionObj) {
	var ctArr = productObj.options
	for ( i = 0 ; i < ctArr.length ; i++ )
	{
		if (ctArr[i].selected == true)
		{
			populateData( i, versionObj );
		}
	}
}
function populateData( name,myselect ) 
{ 
	var arrayData = new Array();
	//SyncBee
	arrayData[0]='1|1|1';
	arrayData[1]='1|2|2';

	//TotalShredder USB
	arrayData[2]='2|1|1';

	//TotalRecovery USB 
	arrayData[3]='3|1|1';

	//TotalRecovery Pro
	
	arrayData[4]='4|7|7';

	//RestoreIT
	arrayData[5]='5|7|7';
	
	//TotalDeploy
	arrayData[6]='6|1.0|1.0';
	
	//FarStone Total Backup Recovery Advanced Server
	arrayData[7]='7|7|7';
	
	//FarStone Total Backup Recovery Advanced Workstation
	arrayData[8]='8|7|7';
	
	//FarStone Total Backup Recovery Server
	arrayData[9]='9|7|7';
	
	//FarStone Total Backup Recovery Small Business Server
	arrayData[10]='10|7|7';
	
	//FarStone Total Backup Recovery Suite for Storage
	arrayData[11]='11|7|7';

   //VirtualDrive Pro
	arrayData[12]='12|14|14';
	arrayData[13]='12|12|12';
	arrayData[14]='12|11|11';
	
	//VirtualDrive Network
	arrayData[15]='13|14|14';
	arrayData[16]='13|12|12';
	arrayData[17]='13|11|11';
	
	//TotalRecovery Express
	arrayData[18]='14|7|7';
	



select	= myselect ;
	//window.document.register.version; 
	string	= '';  
	count	= 0;  
	select.options.length = count;
	for( i = 0; i < arrayData.length; i++ ) { 
		string = arrayData[i].split( '|' ); 
		if( string[0] == name ) { 
			select.options[count++] = new Option( string[1] ); 			
			select.options[count-1].value = string[2] ; 
		} 
	}  
}
function SetSelectValue( ObjID , selectValue ) {
	var selectObj = document.getElementById(ObjID);
	var ctArr = selectObj.options
	for ( i = 0 ; i < ctArr.length ; i++ )
	{
		if (ctArr[i].value == selectValue)
		{
			ctArr[i].selected="true";
		}
	}
}
function CheckError( checkString , checkItem , showItem , showString )
{
	if ( checkString == "" )
	{
		//showItem.innerHTML = showString ;
		showItem.style.backgroundColor = "#F2f2f2" ;
		checkItem.focus() ;
		return true ;
	}
	else
	{
		//showItem.innerHTML = "" ;
		showItem.style.backgroundColor = "#FFFFFF" ;
		return false ;
	}
}

//coco new add 2009-10-23
function CheckPhoneRegular( checkString , checkItem , showItem , showString ) {
	if ( checkString == "" ) {
		return true ;
	}
	var ph ;
	ph = /^[0-9]{0,15}$/ ;
	if ( ph.test(checkString) ) {
		showItem.style.backgroundColor = "#FFFFFF" ;
		return false ;
	}
	else {
		//showItem.innerHTML = showString ;
		showItem.style.backgroundColor = "#F2f2f2" ;
		checkItem.focus() ;
		return true ;
	}
}
//coco new add end

function CheckEmailRegular( checkString , checkItem , showItem , showString ) {
	if ( checkString == "" ) {
		return true ;
	}
	var re ;
	re = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/ ;
	if ( re.test(checkString) ) {
		showItem.style.backgroundColor = "#FFFFFF" ;
		return false ;
	}
	else {
		//showItem.innerHTML = showString ;
		showItem.style.backgroundColor = "#F2f2f2" ;
		checkItem.focus() ;
		return true ;
	}
}

function ReplyInfo( replyForm )
{
	with ( replyForm )
	{
		if ( CheckError(result.value,result,messageresult,"Please enter a reply") == true )
		{
			return false ;
		}
		var selectnumber = select.value ;
		var i , s;
		var filearray = new Array( );
		var filename ;
		for (i = 0; i < selectnumber; i++) 
		{
			eval("s=strFile"+i);
			filearray = s.value.split("\\");
			filename = filearray[filearray.length - 1] ;
			if ( chkExtendName(filename) == true )
			{
				filenametype.innerHTML = "please select the correct file type" ;
				s.focus();
				return false ;
			}
		}
	}
	return true ;
}

function newuserAnswerInfo( registerForm )
{
	var errorFlag = false;
	with ( registerForm ) {		
		if ( CheckError(fName.value,fName,messageFirstName,"Please enter your first name") == true ) {			
			fName_label.style.color="#FF0000";
			errorFlag = true ;
		}
		else
		{
			fName_label.style.color="";
		}
		if ( CheckError(lName.value,lName,messageLastName,"Please enter your last name") == true ) {
			lName_label.style.color="#FF0000";
			errorFlag = true ;
		}
		else
		{
			lName_label.style.color="";
		}
		
		if ( CheckError(email.value,email,messageEmail,"Please enter your e-mail address") == true ) {
			email_label.style.color="#FF0000";
			errorFlag = true ;
		}
		else
		{
			email_label.style.color="";
		}
		if ( CheckEmailRegular(email.value,email,messageEmail,"Please enter your e-mail address") == true ) {
			email_label.style.color="#FF0000";
			errorFlag = true ;
		}
		else
		{
			email_label.style.color="";
		}
		
		if ( CheckError(No_Of_Employees.value,No_Of_Employees,messageproduct,"Please enter your first name") == true ) {			
			No_Of_Employees_label.style.color="#FF0000";
			errorFlag = true ;
		}
		else
		{
			No_Of_Employees_label.style.color="";
		}
		
		
		if ( CheckError(subject.value,subject,messagesubject,"Please enter your last name") == true ) {
			subject_label.style.color="#FF0000";
			errorFlag = true ;
		}
		else
		{
			subject_label.style.color="";
		}
		
		if ( CheckError(descriptionadd.value,descriptionadd,messagedescriptionadd,"Please enter your e-mail address") == true ) {
			descriptionadd_label.style.color="#FF0000";
			errorFlag = true ;
		}
		else
		{
			descriptionadd_label.style.color="";
		}
	}
	if ( errorFlag ) {
		errorInfo.innerHTML = "Please make sure you have entered the correct information in all highlighted fields.";
		return false;
	}
	else {
		return true ;
	}
}


function AnswerInfo( registerForm )
{
	var errorFlag = false;
	with ( registerForm ) {
		if ( CheckError(No_Of_Employees.value,No_Of_Employees,messageproduct,"Please enter your first name") == true ) {			
			No_Of_Employees_label.style.color="#FF0000";
			errorFlag = true ;
		}
		else
		{
			No_Of_Employees_label.style.color="";
		}
		
		
		if ( CheckError(subject.value,subject,messagesubject,"Please enter your last name") == true ) {
			subject_label.style.color="#FF0000";
			errorFlag = true ;
		}
		else
		{
			subject_label.style.color="";
		}
		
		if ( CheckError(descriptionadd.value,descriptionadd,messagedescriptionadd,"Please enter your e-mail address") == true ) {
			descriptionadd_label.style.color="#FF0000";
			errorFlag = true ;
		}
		else
		{
			descriptionadd_label.style.color="";
		}			
	}
	if ( errorFlag ) {
		errorInfo.innerHTML = "Please make sure you have entered the correct information in all highlighted fields.";
		return false;
	}
	else {
		return true ;
	}
}

function RegInfo( registerForm )
{
	var errorFlag = false;
	with ( registerForm ) {
		if ( CheckError(fName.value,fName,messageFirstName,"Please enter your first name") == true ) {
			//alert(fName_label.style.color);
			fName_label.style.color="#FF0000";
			errorFlag = true ;
		}
		else
		{
			fName_label.style.color="";
		}
		
		if ( CheckError(lName.value,lName,messageLastName,"Please enter your last name") == true ) {
			lName_label.style.color="#FF0000";
			errorFlag = true ;
		}
		else
		{
			lName_label.style.color="";
		}
		
		if ( CheckError(address1.value,address1,messageAddress1,"Please input Address1") == true ) {
			address1_label.style.color="#FF0000";
			errorFlag = true ;
		}
		else
		{
			address1_label.style.color="";
		}
		
		if ( CheckError(city.value,city,messageCity,"Please enter your city of residence") == true ) {
			city_label.style.color="#FF0000";
			errorFlag = true ;
		}
		else
		{
			city_label.style.color="";
		}
		
		if ( CheckError(zip.value,zip,messagePostal,"Please enter your zip code") == true ) {
			zip_label.style.color="#FF0000";
			errorFlag = true ;
		}
		else
		{
			zip_label.style.color="";
		}
		
		if ( CheckError(phone.value,phone,messagePhone,"Please enter your phone number") == true ) {
			phone_label.style.color="#FF0000";
			errorFlag = true ;
		}
		else
		{
			phone_label.style.color="";
		}
		
//		if(CheckPhoneRegular(phone.value,phone,messagePhone,"Please enter your phone number") == true )
//		{
//			zip_label.style.color="#FF0000";
//			errorFlag = true ;
//		}else{
//			zip_label.style.color="";
//		}
		
		if ( CheckError(email.value,email,messageEmail,"Please enter your e-mail address") == true ) {
		email_label.style.color="#FF0000";
		errorFlag = true ;
		}
		else
		{
			email_label.style.color="";
		}
		
		if ( CheckEmailRegular(email.value,email,messageEmail,"Please enter your e-mail address") == true ) {
			email_label.style.color="#FF0000";
			errorFlag = true ;
		}
		else
		{
			email_label.style.color="";
		}
	}
		
	if ( errorFlag ) {
		errorInfo.innerHTML = "Please make sure you have entered the correct information in all highlighted fields.";
		return false;
	}
	else {
		return true ;
	}
}
function UpdateInfo( registerForm )
{
	var errorFlag = false;
	with ( registerForm ) {
		if ( CheckError(fName.value,fName,messageFirstName,"Please enter your first name") == true ) {
			errorFlag = true ;
		}
		if ( CheckError(lName.value,lName,messageLastName,"Please enter your last name") == true ) {
			errorFlag = true ;
		}
		if ( CheckError(address1.value,address1,messageAddress1,"Please enter your address") == true ) {
			errorFlag = true ;
		}
		if ( CheckError(city.value,city,messageCity,"Please enter your city of residence") == true ) {
			errorFlag = true ;
		}
		if ( CheckError(zip.value,zip,messagePostal,"Please enter your zip code") == true ) {
			errorFlag = true ;
		}
		if ( CheckError(phone.value,phone,messagePhone,"Please enter your phone number") == true ) {
			errorFlag = true ;
		}
		if ( CheckError(email.value,email,messageEmail,"Please enter your e-mail address") == true ) {
			errorFlag = true ;
		}
		if ( CheckEmailRegular(email.value,email,messageEmail,"Please enter your e-mail address") == true ) {
			errorFlag = true ;
		}
	}
	if ( errorFlag ) {
		errorInfo.innerHTML = "Please make sure you have entered the correct information in all highlighted fields.";
		return false;
	}
	else {
		return true ;
	}
}
function TicketInfo( registerForm )
{
	var errorFlag = false;
	with ( registerForm ) {
		if ( CheckError(Products.value,Products,messageproduct,"Please select a product") == true ) {
			errorFlag = true ;
		}
		if ( CheckError(subject.value,subject,messagesubject,"Please enter a subject") == true ) {
			errorFlag = true ;
		}
	}
	if ( errorFlag ) {
		errorInfo.innerHTML = "Please enter all required information.";
		return false;
	}
	else {
		return true ;
	}
}

function RegInfoProduct( registerForm )
{

	var errorFlag = false;
	with ( registerForm ) {		
		
	if ( CheckError(No_Of_Employees.value,No_Of_Employees,messageproduct,"Please enter Product Name") == true ) {
		//alert(fName_label.style.color);
		No_Of_Employees_label.style.color="#FF0000";
		errorFlag = true ;
	}
	else
	{
		No_Of_Employees_label.style.color="";
	}
	
		
//	if ( CheckError(serialNumber.value,serialNumber,messagesn,"Please enter  Serial Number") == true ) {
//		//alert(fName_label.style.color);
//	
//		serialNumber_label.style.color="#FF0000";
//		errorFlag = true ;
//	}else{
//			
//		serialNumber_label.style.color="";
//	
//	}
	
	if ( CheckError(fName.value,fName,messageFirstName,"Please enter your first name") == true ) {
	
	fName_label.style.color="#FF0000";
	errorFlag = true ;
	}
	else
	{
		fName_label.style.color="";
	}
	
	if ( CheckError(lName.value,lName,messageLastName,"Please enter your last name") == true ) {
		
		lName_label.style.color="#FF0000";
		errorFlag = true ;
	}
	else
	{
		lName_label.style.color="";
	}			

	if ( CheckError(address1.value,address1,messageAddress1,"Please input Address1") == true ) {
		address1_label.style.color="#FF0000";
		errorFlag = true ;
	}
	else
	{
		address1_label.style.color="";
	}

	if ( CheckError(city.value,city,messageCity,"Please enter your city of residence") == true ) {
		city_label.style.color="#FF0000";
		errorFlag = true ;
	}
	else
	{
		city_label.style.color="";
	}

	if ( CheckError(zip.value,zip,messagePostal,"Please enter your zip code") == true ) {
		zip_label.style.color="#FF0000";
		errorFlag = true ;
	}
	else
	{
		zip_label.style.color="";
	}

	if ( CheckError(phone.value,phone,messagePhone,"Please enter your phone number") == true ) {
		phone_label.style.color="#FF0000";
		errorFlag = true ;
	}
	else
	{
		phone_label.style.color="";
	}
	
//			if ( CheckPhoneRegular(phone.value,phone,messagePhone,"Please enter your phone number") == true ) {
//				phone_label.style.color="#FF0000";
//				errorFlag = true ;
//			}
//			else
//			{
//				phone_label.style.color="";
//			}

	if ( CheckError(email.value,email,messageEmail,"Please enter your e-mail address") == true ) {
		email_label.style.color="#FF0000";
		errorFlag = true ;
	}
	else
	{
		email_label.style.color="";
	}

	if ( CheckEmailRegular(email.value,email,messageEmail,"Please enter your e-mail address") == true ) {
		email_label.style.color="#FF0000";
		errorFlag = true ;
	}
	else
	{
		email_label.style.color="";
	}			
	}
	if ( errorFlag ) {
		errorInfo.innerHTML = "Please make sure you have entered the correct information in all highlighted fields.";
		return false;
	}
	else {
		return true ;
	}
}
