function checkOrder()
{
 
  if(document.user_profile.userid.value=="")
  {
				
  				var field_name   = new Array("first_name","last_name","username","password","cpassword","company","address","phone","email","country_id");
    		var display_name = new Array("First Name","Last Name","Username","Password","Confirm Password","Company","Address","Phone","Email","Processing Country");
    		var count_array  = 10;
    		
    		if(check_fields('user_profile',field_name,display_name,count_array))
    		{		        
    		   if(checkEmail(document.user_profile.email.value))
  				   {             
       				   if(document.user_profile.password.value==document.user_profile.cpassword.value)
       	      {    
       	           if(document.user_profile.attachment1.value=="" && document.user_profile.attachment2.value=="" && document.user_profile.attachment3.value=="")
       	           {
       	              alert("Please Upload Attachment");
       	              return false ;
       	           }
       	           checkDuplicateUsernameEdit(document.user_profile.userid.value, document.user_profile.username.value) ;
       	      }
       	      else
       	      {
       	      	    alert("Password Mismatch");
       	      	    return false ;
       	      }                            
  				   }
   				  else
   				 	{	
   								    document.user_profile.email.focus();
   									   return false; 
   				  } 
    		}
    		else
    		{ 			return false ; 		}
  		
   }
   else
   {
      var field_name1   = new Array("country_id");
    		var display_name1 = new Array("Country");
    		var count_array1  = 1;
    		
    		if(check_fields('user_profile',field_name1,display_name1,count_array1))
    		{	
            if(document.user_profile.attachment1.value=="" && document.user_profile.attachment2.value=="" && document.user_profile.attachment3.value=="")
	           {
	              alert("Please Upload Attachment");
	              return false ;
	           }
	           
	           document.user_profile.submit();
    		}
    		else
    		{ 			return false ; 		}
   }
}	



function displayUpload(num)
{
    if(document.user_profile.number.value>3)
    {
       document.getElementById('file2').style.display = "none" ;
       document.getElementById('file3').style.display = "none" ;
       document.user_profile.number.value = 1 ;
       alert("Number of Documents Cannot Be Greater Than 3");
    }
     
    if(document.user_profile.number.value==1)
    {
       document.getElementById('file2').style.display = "none" ;
       document.getElementById('file3').style.display = "none" ;
    }
    else if(document.user_profile.number.value==2)
    {
       document.getElementById('file2').style.display = "block" ;
       document.getElementById('file3').style.display = "none" ;
    }
    else if(document.user_profile.number.value==3)
    {
       document.getElementById('file2').style.display = "block" ;
       document.getElementById('file3').style.display = "block" ;
    }
}




function displayOther(id)
{
    if(document.getElementById('op'+id+'_6').checked==true)
    {
       document.getElementById('other_'+id).disabled = false;
    }
    else
    {
       document.getElementById('other_'+id).value    = "";
       document.getElementById('other_'+id).disabled = true;
    }
}

function displayOtherShipping(id)
{
    if(document.getElementById('op'+id+'_4').checked==true)
    {
       document.getElementById('other_'+id).disabled = false;
    }
    else
    {
       document.getElementById('other_'+id).value    = "";
       document.getElementById('other_'+id).disabled = true;
    }
}