// PhotoSpin Join Page Javascript
 function order_type(layer){
  if(document.getElementById){
    x = document.getElementById(layer);
    y = document.getElementById('poInfo');
    z = document.getElementById('poReq');
    s = document.getElementById('billReq');
  }else{
    x = document.all[layer];
    y = document.all['poInfo'];
    z = document.all['poReq'];
    s = document.all['billReq'];
  }
  if(document.join.paymentType.value == 'po'){
    x.style.display = 'none';
    y.style.display = 'inline';
    z.style.display = 'inline';
    s.style.display = 'inline';
  } else {
    x.style.display = 'inline';
    y.style.display = 'none';
    z.style.display = 'none';
    s.style.display = 'none';
  }
 }
 
 function show(layer){
  if(document.getElementById){
    document.getElementById(layer).style.display = 'inline';
  }else{
    document.all[layer].style.display = 'inline';
  }
 }
 function hide(layer){
    document.getElementById(layer).style.display = 'none';
 }
 function copy(){
	document.FrontPage_Form2.shipFirstName.value = document.FrontPage_Form2.billFirstName.value;
	document.FrontPage_Form2.shipLastName.value = document.FrontPage_Form2.billLastName.value;
	document.FrontPage_Form2.shipAddress.value = document.FrontPage_Form2.billAddress.value;
	document.FrontPage_Form2.shipCity.value = document.FrontPage_Form2.billCity.value;
	document.FrontPage_Form2.shipState.value = document.FrontPage_Form2.billState.value;
	document.FrontPage_Form2.shipZip.value = document.FrontPage_Form2.billZip.value;
	document.FrontPage_Form2.shipCountry.value = document.FrontPage_Form2.billCountry.value;
	document.FrontPage_Form2.shipPhone.value = document.FrontPage_Form2.billPhone.value;
	document.FrontPage_Form2.shipFax.value = document.FrontPage_Form2.billFax.value;
 }
 function defaults(){
  if(document.join.subscribe_ID.length == undefined || document.join.subscribe_ID.length == 0){
	  var most = 1;
  }else{
	  var most = document.join.subscribe_ID.length;
  }
  for(z=0;z<most;z++){
	if(most > 1){
		if(document.join.subscribe_ID[z].checked){
			var duck = document.join.subscribe_ID[z].value;
		}
	}else{
		if(document.join.subscribe_ID.checked){
			var duck = document.join.subscribe_ID.value;
		}
	}
  }
  if( duck <= 5 ){
		document.getElementById('shipping').style.display = 'none';
		document.getElementById('paying').style.display = 'inline';
  }
  /*Hide Shipping and Paying fields. These are free accounts */
  if( duck == 6 || duck == 10 || duck == 11 || duck == 12 || duck == 13 || duck == 15 || duck == 23 || duck == 27 || duck == 34 || duck == 38 || duck == 39 || duck == 41 || duck == 43 || duck == 48){
		document.getElementById('shipping').style.display = 'none';
		document.getElementById('paying').style.display = 'none';
  }
  /* Show Shipping fields and paying fields */
  if( duck == 7 || duck == 8 || duck == 9 || duck == 14 ){
		document.getElementById('shipping').style.display = 'inline';
		document.getElementById('paying').style.display = 'inline';
  }
  
  if(document.join.paymentType.value == 'po'){
    order_type('ccInfo');
  }
  //document.write(document.join.radio.length);
  //document.write(most);
 }
 
 
 function checkform(theForm)
{


  if (document.join.First_Name.value == "")
  {
    alert("Please enter a value for the \"First Name\" field.");
    document.join.First_Name.focus();
    return (false);
  }

  if (document.join.Last_Name.value == "")
  {
    alert("Please enter a value for the \"Last Name\" field.");
    document.join.Last_Name.focus();
    return (false);
  }

  if (document.join.eMail.value == "")
  {
    alert("Please enter a value for the \"eMail Address\" field.");
    document.join.eMail.focus();
    return (false);
  }

  if (document.join.Phone.value == "")
  {
    alert("Please enter a value for the \"Phone Number\" field.");
    document.join.Phone.focus();
    return (false);
  }

  if (document.join.username.value == "")
  {
    alert("Please enter a value for the \"Username\" field.");
    document.join.username.focus();
    return (false);
  }

  if (document.join.username.value.length > 30)
  {
    alert("Please enter at most 30 characters in the \"Username\" field.");
    document.join.username.focus();
    return (false);
  }

  if (document.join.billFirstName.value == "")
  {
    alert("Please enter a value for the \"Billing First Name\" field.");
    document.join.billFirstName.focus();
    return (false);
  }

  if (document.join.billLastName.value == "")
  {
    alert("Please enter a value for the \"Billing Last Name\" field.");
    document.join.billLastName.focus();
    return (false);
  }

  if (document.join.billAddress.value == "")
  {
    alert("Please enter a value for the \"Billing Address\" field.");
    document.join.billAddress.focus();
    return (false);
  }

  if (document.join.billCity.value == "")
  {
    alert("Please enter a value for the \"Billing City\" field.");
    document.join.billCity.focus();
    return (false);
  }

  if (document.join.billState.selectedIndex < 0)
  {
    alert("Please select one of the \"Billing State\" options.");
    document.join.billState.focus();
    return (false);
  }

  if (document.join.billState.selectedIndex == 0)
  {
    alert("The first \"Billing State\" option is not a valid selection.  Please choose one of the other options.");
    document.join.billState.focus();
    return (false);
  }

  if (document.join.billZip.value == "")
  {
    alert("Please enter a value for the \"Billing City\" field.");
    document.join.billZip.focus();
    return (false);
  }
  return (true);
}
 
 
 
 
 
 function verify(){
    var msg = "By Clicking OK You agree to the Terms of Use.";
    
  //  if (checkform("document.join")) {
    
    input_box=confirm(msg);
    if (input_box==true){ 
    
    document.join.action.value="Continue";
 
 
   document.join.submit();
    }
 //    }
 }
