<!--
//minor hack to initiate summin'

countryPulldownHasChanged = false;
previousPulldownValue = '';

vatCountries = new Array('Belgium','Germany','Denmark','Greece','Spain','Finland','France','Ireland','Italy','Luxembourg','The Netherlands','Portugal','Sweden');
vatCodes     = new Array('BE','DE','DK','EL','ES','FI','FR','IE','IT','LU','NL','PT','SE');

/* addaccomFormEvaluation.js
   
   Make sure that everything on the form that needs to be filled in is filled in
   with valid data.
   
*/








function verify(which) {
 /*if(which=='contactinitials') {
 s=document.editform.contactinitials.value
  if (s != "" && s.substr(0,1)!=" " && typeof s == "string") {
   document.splat_contactinitials.src = "http://images.pop2world.com/icons/greenCheckMark.gif";
  } else {
   document.splat_contactinitials.src = "http://images.pop2world.com/icons/redAsterisk.gif";
  }
 }
 if(which=='contactsurname') {
  s=document.editform.contactsurname.value
  if (s != "" &&  s.substr(0,1)!=" " && typeof s == "string") {
   document.splat_contactsurname.src = "http://images.pop2world.com/icons/greenCheckMark.gif";
  } else {
   document.splat_contactsurname.src = "http://images.pop2world.com/icons/redAsterisk.gif";
  }
 }*/
 if(which=='address1') {
  s=document.editform.address1.value
  if (s!="" && s.substr(0,1)!=" " && typeof s == "string") {
   document.splat_address1.src = "http://images.pop2world.com/icons/greenCheckMark.gif";
  } else {
   document.splat_address1.src = "http://images.pop2world.com/icons/redAsterisk.gif";
  }
 }
  if(which=='eventtitle') {
   s=document.editform.eventtitle.value
   if (s!="" && s.substr(0,1)!=" " && typeof s == "string") {
    document.splat_eventtitle.src = "http://images.pop2world.com/icons/greenCheckMark.gif";
   } else {
    document.splat_eventtitle.src = "http://images.pop2world.com/icons/redAsterisk.gif";
   }
  }
 /*if(which=='address2') {
  s=document.editform.address2.value
  if (s!= "" && s.substr(0,1)!=" " && typeof s == "string") {
   document.splat_address2.src = "http://images.pop2world.com/icons/greenCheckMark.gif";
  } else {
   document.splat_address2.src = "http://images.pop2world.com/icons/redAsterisk.gif";
  }
 }*/

// this is causing an error if 
// we are in a state within united states.
// that'll teach you to be breadbaskets.
if(which=='state') {
	a=document.location.href.substr(15, document.location.href.length);
	b=a.indexOf('.');
	c=a.substr(0, b);

	states = new Array ('alabama','alaska','arizona','arkansas','california','colorado','connecticut','washingtondc','delaware','florida',
	                    'georgia','hawaii','idaho','illinois','indiana','iowa','kansas','kentucky','louisiana','maine','maryland','massachusetts',
	                    'michigan','minnesota','mississippi','missouri','montana','nebraska','nevada','newhampshire','newjersey','newmexico','newyork',
	                    'northcarolina','northdakota','ohio','oklahoma','oregon','pennsylvania','rhodeisland','southcarolina','southdakota',
	                    'tennessee','texas','utah','vermont','virginia','washington','westvirginia','wisconsin','wyoming')
		
		for(i=0; i < states.length; i++) {
		   if(states[i] == c) {
		   	break;
		   } else {
		      s=document.editform.state.value
		      if (s!= "" && s.substr(0,1)!=" "  && typeof s == "string") {
		       document.splat_state.src = "http://images.pop2world.com/icons/greenCheckMark.gif";
		      } else {
		       document.splat_state.src = "http://images.pop2world.com/icons/redAsterisk.gif";
		      }
		   }
		 }

 }
 if(which=='towncity') {
  s=document.editform.towncity.value
  if ( s!= "" && s.substr(0,1)!=" " && typeof s == "string") {
   document.splat_towncity.src = "http://images.pop2world.com/icons/greenCheckMark.gif";
  } else {
   document.splat_towncity.src = "http://images.pop2world.com/icons/redAsterisk.gif";
  }
 }
 if(which=='zippostcode') {
  s=document.editform.zippostcode.value
  if ( s!= "" && s.substr(0,1)!=" " && typeof s == "string") {
   document.splat_zippostcode.src = "http://images.pop2world.com/icons/greenCheckMark.gif";
  } else {
   document.splat_zippostcode.src = "http://images.pop2world.com/icons/redAsterisk.gif";
  }
 }
 /*if(which=='telephoneno') {
  s=document.editform.telephoneno.value
  if(s!= ""&&s.substr(0,1)!=" "&&typeof s=="string") {
   document.splat_telephoneno.src = "http://images.pop2world.com/icons/greenCheckMark.gif";
  } else {
   document.splat_telephoneno.src = "http://images.pop2world.com/icons/redAsterisk.gif";
  }
 }*/

 if(which=='emailaddress') {
  s=document.editform.emailaddress.value
  if ( s!= "" && s.substr(0,1)!=" " && typeof s == "string") {
   document.splat_emailaddress.src = "http://images.pop2world.com/icons/greenCheckMark.gif";
  } else {
   document.splat_emailaddress.src = "http://images.pop2world.com/icons/redAsterisk.gif";
  }
 }
 
  if(which=='vatnumber') {
   i=0;
   
   r=document.editform.billing_country.value;
   s=document.editform.vatnumber.value;
   

   for(i=0;i<=vatCountries.length;i++){
    b=vatCountries[i];
    if(b==r){
     t=vatCodes[i];
     break;
    } else {
    }
   }   
    if(s.substr(0,2).toUpperCase()!=t) {
     notAvat=true;
     alert("The VAT Number you have provided is invalid.\n\nIt is required that your "+r+" VAT number start with "+t+".");
    } else {
    notAvat=false;
    }
  }
  
 
 
 if(which=='accomtype') {
  s=document.editform.accomtype.value
  if ( s!= "" && s.substr(0,1)!=" " && s!="--- Select Type ---") {
   document.splat_accomType.src = "http://images.pop2world.com/icons/greenCheckMark.gif";
  } else {
   document.splat_accomType.src = "http://images.pop2world.com/icons/redAsterisk.gif";
  }
 }
 if(which=='accomname') {
  s=document.editform.accomname.value
  if ( s!= "" && s.substr(0,1)!=" " && typeof s == "string") {
   document.splat_accomname.src = "http://images.pop2world.com/icons/greenCheckMark.gif";
  } else {
   document.splat_accomname.src = "http://images.pop2world.com/icons/redAsterisk.gif";
  }
 } 
 if(which=='billing_country') {
  found1=false;
   r=document.editform.billing_country.value;

   for(i=0;i<=vatCountries.length;i++){
    b=vatCountries[i];
    if(b==r){
     t=vatCodes[i];
     found1=true;
     break;
    } 
   }
  if(!found1){
   document.editform.vatnumber.value="";
   document.editform.vatnumber.disabled=true;
  }
  
  s=document.editform.billing_country.value
  if ( s!= "" && s.substr(0,1)!=" " && s!="   ---- Select a Country ----" 
 				    && s!="---------------------------------" 
                                    && s!="EUROPE" 
                                    && s!="NORTH AMERICA" 
                                    && s!="CENTRAL AMERICA"
                                    && s!="AUSTRALIA & PACIFIC"
                                    && s!="AFRICA" && s!="ASIA") 
  {
   document.splat_country.src = "http://images.pop2world.com/icons/greenCheckMark.gif";
  } else {
   document.splat_country.src = "http://images.pop2world.com/icons/redAsterisk.gif";
  }
 } 
/* if(which=='summary') {
  s=document.editform.summary.value
  if ( s!= "" && s.substr(0,1)!=" " && typeof s == "string") {
   document.splat_summary.src = "http://images.pop2world.com/icons/greenCheckMark.gif";
  } else {
   document.splat_summary.src = "http://images.pop2world.com/icons/redAsterisk.gif";
  }
 } 
 */

}






function checkrequired(which) {
  if (document.images) {
    for (i=0;i<which.length;i++) {
      var tempobj=which.elements[i];


 // Contact and Billing Information.
     
	if(tempobj.name=="agreeterms") {
	 if(tempobj.value==false) {
	  alert("You Must Agree to the Terms & Conditions.");
	  return false;
	  break;
	 }
	}
	/*if(tempobj.name=="contactinitials") {
        s=tempobj.value;
        if (tempobj.value==""||s.substr(0,1)==" ") {
          alert("Please enter your First Name.");
          return false;
          break;
        }
      }
       if(tempobj.name=="contactsurname") {
        s=tempobj.value;
        if (tempobj.value==""||s.substr(0,1)==" ") {
          alert("Please enter your Surname.");
          return false;
          break;
        }
      }*/
      if (tempobj.name=="address1") {
        s=tempobj.value;
        if (tempobj.value==""||s.substr(0,1)==" ") {
          alert("Please enter your Address.");
          return false;
          break;
        }
      }
      if (tempobj.name=="state") {
        s=tempobj.value;
        if (tempobj.value==""||s.substr(0,1)==" ") {
          alert("Please enter your State, County or Province.");
          return false;
          break;
        }
      }
      if (tempobj.name=="towncity") {
        s=tempobj.value;
        if (tempobj.value==""||s.substr(0,1)==" ") {
          alert("Please enter your Town or City.");
          return false;
          break;
        }
      }
      if (tempobj.name=="zippostcode") {
        s=tempobj.value;
        if (tempobj.value==""||s.substr(0,1)==" ") {
          alert("Please enter your Postal or Zip Code.");
          return false;
          break;
        }
      }
      if (tempobj.name=="title") {
        s=tempobj.value;
        if (tempobj.value==""||s.substr(0,1)==" ") {
          alert("Please enter a Title for your Event.");
          return false;
          break;
        }
      }
      
      /*if (tempobj.name=="telephoneno") {
        if (tempobj.value==""||s.substr(0,1)==" ") {
          alert("Please enter your Telephone Number.");
          return false;
          break;
        }
      }*/
      if (tempobj.name=="emailaddress") {
            //if (tempobj.value==""||s.substr(0,1)==" ") {
            if ((tempobj.value.indexOf ('@',0) == -1 || tempobj.value.indexOf ('.',0) == -1)) {
              alert("Please enter your valid Email Address.");
              return false;
          break;
        }
      }


// accom Information

      if (tempobj.name=="accomtype") {
        if (tempobj.value==""||s.substr(0,1)=="--- Select Type ---") {
          alert("Please Select your Accommodation Type.");
          return false;
          break;
        }
      }
      if (tempobj.name=="accomname") {
        if (tempobj.value==""||s.substr(0,1)==" ") {
          alert("Please enter your Accommodation Name.");
          return false;
          break;
        }
      }
      if (tempobj.name=="country") {
      if (tempobj.value=="" || s.substr(0,1)==" " 
        		      || tempobj.value=="---- Select a Country ----" 
        		      || tempobj.value=="---------------------------------" 
        		      || tempobj.value=="EUROPE" 
        		      || tempobj.value=="NORTH AMERICA" 
        		      || tempobj.value=="CENTRAL AMERICA" 
        		      || tempobj.value=="SOUTH AMERICA" 
        		      || tempobj.value=="AUSTRALIA & PACIFIC" 
        		      || tempobj.value=="AFRICA" 
        		      || tempobj.value=="ASIA" 
        		      || tempobj.value=="ASIA") 
        {
          alert("Please select your Country.");
          return false;
          break;
        }
      }
      /*if (tempobj.name=="summary") {
        if (tempobj.value==""||s.substr(0,1)==" ") {
          alert("Please enter a brief Summary for your accom");
          return false;
          break;
        }
      }*/


      if (tempobj.name=="summaryImage") {
      	  s=tempobj.value;
      	  a=s.length;
      	  b=s.substr(a-4,a);
      	  //use a tolower function.
          if ((b!=".gif"&&b!=".GIF"&&b!=".jpg"&&b!=".JPG"&&b!=".png"&&b!=".PNG"&&b!="jpeg"&&b!="JPEG") || a<5 || tempobj.value==""||s.substr(0,1)==" ") {
         	if(b!="")
         	 alert("Please select a valid Image for Upload for your Summary.\nFile's of type: '"+b+"' are not web quality images and cannot be used.");
         	else  
         	 alert("Please select a valid Image for Upload for your Summary.");
         	 return false;
         	 break;
        }
      }


   /*   if (tempobj.name=="img0") {//||tempobj.name=="img1"||tempobj.name=="img2"||tempobj.name=="img3"||tempobj.name=="img4"
  	s=a=b="";
  	switch(which){
      	  	case "img0":
      	  	 whichDesc = "Header Description";
      	  	break;
      	  	 
      	  	case "img1": 
     	  	 whichDesc = "First Description";
      	  	break;
      	  	 
      	  	case "img2": 
      	  	 whichDesc = "Second Description";
      	  	break;
      	  	 
      	  	case "img3": 
      	  	 whichDesc = "Third Description";
      	  	break;

      	  	case "img4": 
      	  	 whichDesc = "Fourth Description";
      	  	break;
      	  }
  	  	 
      	  s=tempobj.value;
      	  a=s.length;
      	  b=s.substr(a-4,a);

 	   if (b!=".gif"||b!=".jpg"||b!=".png"||b!="jpeg") {
 		 //if(b!="")
		 // alert("Please select a valid Image for Upload for your "+whichDesc+".\nFile's of type: '"+b+"' are not web quality images and cannot be used.");
		// else  
		  alert("Please select a valid Image for Upload for your "+whichDesc+".");
		 
		 return false;
		 break;
	   }
      }*/
      if (tempobj.name=="agreeterms") {
        if (!tempobj.checked) {
          alert("You must agree to the Term's and Condition's of this site before proceeding.");
          return false;
          break;
        }
      }


    }    
  }  
return true;
}


function VATtest() {
  a = document.editform.billing_country;
  vats = new Array('BE','DE','DK','GR','ES','FI','FR','IE','IT','LU','NL','PT','SE');
  for(i=0;i<=vats.length;i++){
   b=vats[i];
   if(b===a.value){
    document.editform.vatnumber.disabled=false;
   }
  }
}
// -->

