// JavaScript Document
 function check()
  {	   
      var Value = document.form1.support.options[document.form1.support.selectedIndex].text;  
	  if (document.form1.first_name.value=='')
	  {
		  alert ('Required:First Name');
		  document.form1.first_name.focus();
		  return false;
	  }
	  if (document.form1.last_name.value=='')
	  {
		  alert ('Required:Last Name');
		  document.form1.last_name.focus();
		  return false;
	  }		   
	  if (document.form1.Email.value=='')
	  {
		      alert ('Required:Contact E-mail');
			  document.form1.Email.focus();
			  return false;
	  }
	  var str = document.form1.Email.value;   
      if(str.length!=0){   
      reg=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;   
      if(!reg.test(str)){   
        alert("Please input your valid E-mail Address,Thanks!");
	    document.form1.Email.focus();
		return false;   
      }  		  
      }       	  
      if (Value == '-Select one-')
      {
      	 alert ('Required:Support Issue');
      	 return false;      	
      }	  
	  
	  
	  
	  
	  if (Value=='Registration Key')
	  {   		   
	      if (document.form1.reg_email.value=='')
	      {
		      alert ('Required:Registration Email');
			  document.form1.reg_email.focus();
			  return false;
	      }          
	      var str = document.form1.reg_email.value;   
          if(str.length!=0){   
          reg=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;   
          if(!reg.test(str)){   
           alert("Please input your valid Registration Email Address,Thanks!");
	       document.form1.reg_email.focus();
		   return false;   
           }  		  
           }       	  	      
		  
		  if (document.form1.pos_email.value=='')
	      {
		      alert ('Required:Other possible Emails');
			  document.form1.pos_email.focus();
			  return false;
	      }
	     
		  var str = document.form1.pos_email.value;   
          if(str.length!=0){   
          reg=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;   
          if(!reg.test(str)){   
           alert("Please input your valid Other possible Email Address,Thanks!");
	       document.form1.pos_email.focus();
		   return false;   
           }  		  
           }   
		  
		  if (document.form1.order.value=='')
	      {
		      alert ('Required:Order Reference No');
			  document.form1.order.focus();
			  return false;
	      }		
		  
		  if (document.form1.purchased.value=='')
	      {
		      alert ('Required:Purchased products');
			  document.form1.purchased.focus();
			  return false;
	      }	 
		  if (document.form1.date.value=='')
	      {
		      alert ('Required:Purchased Date');
			  document.form1.date.focus();
			  return false;
	      }
		  if (document.form1.address.value=='')
	      {
		      alert ('Required:Address input in orders');
			  document.form1.address.focus();
			  return false;
	      }		  	    
		  if (document.form1.description.value=='')
	      {
		      alert ('Required:Detailed description');
			  document.form1.description.focus();
			  return false;
	      }		   		    
      }// end value = Registration Key
     if (Value=='Presale questions')
	 {
	      var presale = document.form1.presale.options[document.form1.presale.selectedIndex].text;
		  if (presale == '-Select one-')
		  {
		      alert ('Required:Choose a presale topic');
			  return false;
		  }
		  if (document.form1.description_presale.value=='')
		  {
		     alert ('Required:Detailed description'); 
			 document.form1.description_presale.focus();
			 return false;
		  }
	 }//end Value=='Presale questions'
    
	 if (Value=='Business Cooperation')
	 {	 
	      var business = document.form1.business.options[document.form1.business.selectedIndex].text;
		  if (business == '-Select one-')
		  {
		      alert ('Required:Start business with Website');
			  return false;
		  }
		  if (document.form1.company.value=='')
		  {
             alert ('Required:Your company or organization'); 
			 document.form1.company.focus();
			 return false;		      
		  }
		  if (document.form1.url.value=='' || document.form1.url.value=='http://')
		  {
             alert ('Required:Your web site URL'); 
			 document.form1.url.focus();
			 return false;		      
		  }
		  if (document.form1.telephone.value=='')
		  {
             alert ('Required:Telephone'); 
			 document.form1.telephone.focus();
			 return false;		      
		  }	
		  if (document.form1.description_business.value=='')
		  {
             alert ('Required:Detailed description'); 
			 document.form1.description_business.focus();
			 return false;		      
		  }	
	 }
	 if (Value=='Technical Support')
	 {
		  if (document.form1.version.value=='')
		  {
             alert ('Required:The version you are using'); 
			 document.form1.version.focus();
			 return false;		      
		  }		  	  	  		  
		  var system = document.form1.system.options[document.form1.system.selectedIndex].text;
		  if (system == '-Select one-')
		  {
		     alert ('Required:Your operating system'); 
			 return false;
		  }
		  var browser = document.form1.browser.options[document.form1.browser.selectedIndex].text;
		  if (browser == '-Select one-')
		  {   
		     alert ('Required:Your Browser'); 
			 return false;		     
		  }
		  if (document.form1.description_support.value=='')
		  {
             alert ('Required:Detailed description'); 
			 document.form1.description_support.focus();
			 return false;		      
		  }
	    var flag=0
        for(i=0;i<document.form1.reg_cus.length;i++)
          if(document.form1.reg_cus[0].checked==true){
	      flag=1
          break
          }
          if (flag==1)
		  {
		     if (document.form1.reg_email_1.value=='')
			 {
                 alert ('Required:Registration Email'); 
			     document.form1.reg_email_1.focus();
			     return false;			    
			 }
		     var str = document.form1.reg_email_1.value;   
             if(str.length!=0){   
             reg=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;   
             if(!reg.test(str)){   
             alert("Please input your valid Registration Email Address,Thanks!");
	         document.form1.pos_email.focus();
		      return false;   
             }  		  
             }   
		  }	  
	 }//end Value=='Technical Support'
	 
	 if (Value=='Feedback and Suggestions')
	 {
	    var topic_feed = document.form1.topic_feed.options[document.form1.topic_feed.selectedIndex].text;  
		if (topic_feed == '-Select one-')
		{
		    alert ('Required:Choose a topic');			
		    return false;
		}
		if (document.form1.description_feed.value=='')
		{
             alert ('Required:Detailed description'); 
			 document.form1.description_feed.focus();
			 return false;	
		}
	 }	// end  Value=='Feedback and Suggestions'
	
	 if (Value=='Filling a Complaint')
	 {
	    var complain = document.form1.complain.options[document.form1.complain.selectedIndex].text;  
		if (complain == '-Select one-')
		{
		    alert ('Required:Complain about');			
		    return false;
		}
		if (document.form1.description_fill.value=='')
		{
             alert ('Required:Detailed description'); 
			 document.form1.description_fill.focus();
			 return false;	
		}
	 }	// end  Value=='Filling a Complaint'
	
	 if (Value=='Other issues')
	 {
		if (document.form1.description_other.value=='')
		{
             alert ('Required:Detailed description'); 
			 document.form1.description_other.focus();
			 return false;	
		}
	 }	//end Value=='Other issues' 
	 
  }//end function 
   
   
function showElementById(id)
{
	document.getElementById(id).style.display="";
}

function hideElementById(id)
{
	document.getElementById(id).style.display="none";
}
function showtext()
{
   var Value = document.form1.support.options[document.form1.support.selectedIndex].text;  
   if (Value=='-Select one-')
   {
     hideElementById('show_presale')
	 hideElementById('show_key')
	 hideElementById('show_business')
	 hideElementById('show_technica')
	 hideElementById('show_reg')
	 hideElementById('show_feed')
	 hideElementById('show_fill')
	 hideElementById('show_other')
	 hideElementById('lostkey')	 	  
   }
   
   if (Value=='Registration Key')
   {
      showElementById('show_key')
	  showElementById('lostkey')
	  hideElementById('show_presale')
	  hideElementById('show_business')
	  hideElementById('show_technica')
	  hideElementById('show_reg')
	  hideElementById('show_feed')
	  hideElementById('show_fill')
	  hideElementById('show_other')
   }
   
   if (Value == 'Presale questions')
   {
      showElementById('show_presale')
	  hideElementById('show_key')
	  hideElementById('show_business')
	  hideElementById('show_technica')
	  hideElementById('show_reg')
	  hideElementById('show_feed')	
	  hideElementById('show_fill')  
	  hideElementById('show_other')
	  hideElementById('lostkey')
   }
   
   if (Value == 'Business Cooperation')
   {
      showElementById('show_business')
      hideElementById('show_presale')
	  hideElementById('show_key')
	  hideElementById('show_technica')
	  hideElementById('show_reg')
	  hideElementById('show_feed')
	  hideElementById('show_fill')
	  hideElementById('show_other')
	  hideElementById('lostkey')
   }   
   
   if (Value == 'Technical Support')
   {
      showElementById('show_technica')
	  showElementById('show_reg')
      hideElementById('show_presale')
	  hideElementById('show_key')
	  hideElementById('show_business') 
	  hideElementById('show_feed')  
	  hideElementById('show_fill')
	  hideElementById('show_other')
	  hideElementById('lostkey')
   }  
   if (Value == 'Feedback and Suggestions')
   {
     showElementById('show_feed')
	 hideElementById('show_presale')
	 hideElementById('show_key')
	 hideElementById('show_business')
	 hideElementById('show_technica')
	 hideElementById('show_reg')
	 hideElementById('show_fill')  
	 hideElementById('show_other')
	 hideElementById('lostkey') 
   }
   if (Value == 'Filling a Complaint')
   {
     showElementById('show_fill')
     hideElementById('show_presale')
	 hideElementById('show_key')
	 hideElementById('show_business')
	 hideElementById('show_technica')
	 hideElementById('show_reg')
	 hideElementById('show_feed')  
	 hideElementById('show_other') 
	 hideElementById('lostkey')
   }   
   if (Value == 'Other issues')
   {
     showElementById('show_other') 
	 hideElementById('show_presale')
	 hideElementById('show_key')
	 hideElementById('show_business')
	 hideElementById('show_technica')
	 hideElementById('show_reg')
	 hideElementById('show_feed')
	 hideElementById('show_fill')
	 hideElementById('lostkey')  
   }   
}

function fnAdd()
{
   var oNewItem = document.createElement("DIV");
   oNewItem.innerHTML = document.getElementById(".p.c.c").innerHTML;
   var oList = document.getElementById(".p.c.t");
   //oList.insertAdjacentElement("AfterBegin",oNewItem); //FF no
   //oNewItem.innerText = "List Item 0";
   oList.appendChild(oNewItem);
}
function fnAdd_1()
{
   var oNewItem = document.createElement("DIV");
   oNewItem.innerHTML = document.getElementById(".p.c.c_1").innerHTML;
   var oList = document.getElementById(".p.c.t_1");
   //oList.insertAdjacentElement("AfterBegin",oNewItem); //FF no
   //oNewItem.innerText = "List Item 0";
   oList.appendChild(oNewItem);
}
function fnAdd_2()
{
   var oNewItem = document.createElement("DIV");
   oNewItem.innerHTML = document.getElementById(".p.c.c_2").innerHTML;
   var oList = document.getElementById(".p.c.t_2");
   //oList.insertAdjacentElement("AfterBegin",oNewItem); //FF no
   //oNewItem.innerText = "List Item 0";
   oList.appendChild(oNewItem);
}
function fnResult()
{
 var row;
 var cell;
 var tbody = document.getElementById(".p.t");
 //var tbody = tblUpdate.childNodes[0];
 //tblUpdate.appendChild( tbody );
 for (var i=0; i<2; i++)
 {
   row = document.createElement( "TR" );
   //tbody.appendChild(row); //IE no
   row = tbody.insertRow(-1); //-1: finally
   for (var j=0; j<5; j++)
   {
     cell = document.createElement( "TD" );
     row.appendChild( cell );
     cell.innerHTML = "Row " + i + ", Cell " + j;
   }
 }
}
