function pop_vid(url, width, height){
        open_x=(screen.width)?(screen.width-width)/2:100;
        open_y= (screen.height)?(screen.height-height)/2:100;
        window.open(url, "video", "height="+height+",width="+width+",left="+open_x+",top="+open_y);
        }

function change_ship(){

	if(document.main.ship_status.checked == true){
		
		document.main.ship_city.value = document.main.bill_city.value;
		document.main.ship_zip.value = document.main.bill_zip.value;
		document.main.ship_address.value = document.main.bill_address.value;
	
		document.main.ship_state.selectedIndex = document.main.bill_state.selectedIndex;
		document.main.ship_country.selectedIndex = document.main.bill_country.selectedIndex;
		}
	else{
		document.main.ship_city.value = "";
		document.main.ship_zip.value = "";
		document.main.ship_address.value = "";
		document.main.ship_state.selectedIndex = 0;
		document.main.ship_country.selectedIndex = 0;
		} 

	}

function check_email(email_address)
{
	err_cnt = 0;
        var email_atsym

        email_atsym = email_address.split('@');

        if (email_atsym[0].length < 1){
		err_cnt ++;
        	}

        if (email_atsym.length != 2){
		err_cnt ++;
		}
        else{
                email_period = email_atsym[1].split('.');

                if (email_period.length < 2){
			err_cnt ++;
			}
                if (email_period[0].length < 1){
			err_cnt ++;
			}
                else{
                        if (email_period.length > 1){

                                if (email_period[1].length < 2)
					err_cnt ++;
				}
                        }
                }
	if(err_cnt > 0){
		return(false);
		}
	else{
		return(true);
		}
	}


function check_reg_form(){
        
        /***** check for valid form vals -- list must have more than one object & there must be a name *****/
        err_str = "This form cannot be processed for the following reasons:\n\n";
	err_str = "";
        err_cnt = 0;

	if(document.main.username.value == ""){
                err_str += "- Username missing\n";
                err_cnt ++;
                }
	
	if(document.main.password1.value == ""){
                err_str += "- Password field missing\n";
                err_cnt ++;

                }
	if(document.main.password2.value == ""){
                err_str += "- Confirm Password Field missing\n";
                err_cnt ++;
                }
	
	if(document.main.password1.value != document.main.password2.value){
		err_str = "Password1 != Password2";
		err_cnt ++;
		}

	if(document.main.password1.value.length < 6){
		err_str = "Password to short";
		err_cnt ++;
		}

        if(document.main.name.value == ""){
                err_str += "- Contact Name missing\n";
                err_cnt ++;
                }
	if(document.main.company_name.value == ""){
                err_str += "- Company Name missing\n";                         
                err_cnt ++;
                }        

	if(document.main.phone.value == ""){
                err_str += "- Phone Number missing\n";
                err_cnt ++;
                }
	if(document.main.email1.value == ""){
                err_str += "- Email Address missing\n";
                err_cnt ++;
                }
	if(document.main.email2.value == ""){                   
                err_str += "- Confirm Email Address missing\n"; 
                err_cnt ++;
                }

	if(document.main.website_url.value == ""){
                err_str += "- Website URL missing\n";
                err_cnt ++;
                }


	if(document.main.username.value.length < 6){
		err_str += "- Username must be at least 6 characters\n";
		err_cnt ++;
		}

	if(document.main.password1.value != document.main.password2.value){
                err_str += "- Passwords do not match\n";
                err_cnt ++;
                }
        else{
                document.main.password.value = document.main.password1.value;
                }

	if(document.main.password1.value.length < 6){  
                err_str += "- Password must be at least 6 characters\n";
                err_cnt++;
                }
        
        if(document.main.email1.value != document.main.email2.value){
                err_str += "- Email Addresses do not match\n";
                err_cnt ++;
                }
        else{
                document.main.email.value = document.main.email1.value;
                }

	if(check_email(document.main.email.value) == false){
                err_str += "- Invalid Email Address\n";
		err_cnt ++;
                }

	if(err_str.length > 0){
                alert(err_str);
                return(false);
                }

	return(true);
	}

