<!--

var RV=true;;
var SelectSize=0;
var msg;

        function RefreshImage(valImageId) {                     <!-- Get new Captcha Image    -->
	var objImage = document.images[valImageId];
	if (objImage == undefined) return;
	var now = new Date();
	objImage.src = objImage.src.split('?')[0] + '?x=' + now.toUTCString();    
        }


function Catalog_Check(){
	var subStr = "";
	var errFlag   = true;
        var K=AjaxRequest('Captcha/Captcha.asp?Opt=Verify') ;
        if (RV==false) return false;
	if (document.Form2.Cat1.checked) subStr="ok"
	if (document.Form2.Cat2.checked) subStr="ok"
	if (document.Form2.Cat3.checked) subStr="ok"

	if ( subStr == "") { 
		alert("No Catalog Selected!")
		return false;
	}

	subStr = "";

	if (document.Form2.First_Name.value == ""){
		subStr = subStr + " - Name\n";
		errFlag = false;
	}
	if (document.Form2.email.value == ""){
		subStr = subStr + " - Email\n";
		errFlag = false;
	}
	if (document.Form2.Phone.value == ""){
		subStr = subStr + " - Phone\n";
		errFlag = false;
	}
	if (document.Form2.Address.value == ""){
		subStr = subStr + " - Address\n";
		errFlag = false;
	}

	if (document.Form2.City.value == ""){
		subStr = subStr + " - City \n";
		errFlag = false;
	}

	if (document.Form2.State.selectedIndex == 0){
		subStr = subStr + " - State\n";
		errFlag = false;
	}

	if (document.Form2.Zip_Code.value == ""){
		subStr = subStr + " - Zip Code\n";
		errFlag = false;
	}

	if (document.Form2.Country.value == ""){
		subStr = subStr + " - Country\n";
		errFlag = false;
	}

	// ERROR OUT
	if (!errFlag) {
		alert("The following fields are required:\n"  + subStr + "\nPlease enter the requested information.");
		return false;
	}
	
	if (document.Form2.Country.value != "US") {
		if(document.Form2.Card_Type.selectedIndex == 0)
		{
			alert("Must Select Card Type");
			return false;
		}
		if (document.Form2.CardNumber.value == ""){
			alert("Credit Card No. Required");
			return false;
		}
		if(document.Form2.CardMonth.selectedIndex == 0)
		{
			alert("Must Select Card Expiry Month");
			return false;
		}
		if(document.Form2.CardYear.selectedIndex == 0)
		{
			alert("Must Select Card Expiry Year");
			return false;
		}
	}

	return true; 
}
                


function badEmail(theEmail)  {
	var sEmail = "" + theEmail;
	if (sEmail.indexOf('@') == -1) return true;
	if (sEmail.indexOf('.') == -1) return true; 
}


function CheckCountry(code) {
	if (code == "US" || code == "") {
		document.getElementById('countrySpan').style.visibility = "hidden";
		document.getElementById('countrySpan').style.position   = "absolute";
	}
	else {
		document.getElementById('countrySpan').style.visibility = "visible";
		document.getElementById('countrySpan').style.position   = "static";
	}
}

//Ajax  Script for Comparing Captcha Code

 var http_request = false;
 
    function AjaxRequest(url) { 
       window.status="Getting data from Server";
       http_request = false;

        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!http_request) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
        
        //http_request.onreadystatechange = alertContents;
        http_request.open('GET', url, false);                 <!-- Synchronous (use false)  ASynchronous  (use true)    -->
        http_request.send(null);

            if (http_request.readyState == 4) {
            if (http_request.status == 200) {
            var R=http_request.responseText;
            
            var e = document.getElementById("captchacode");
            var captcha=e.value; 
            if (R==captcha) RV=true;                <!-- Security Code OK   -->
            else
                       
            {
            alert("Security Code Mis-Match!\n Please try again");
            RefreshImage('imgCaptcha');
            RV=false;                             <!-- Security Code Mis-Match    -->
            e.value="";
            }
               } else {
                alert('There was a problem with the request.' );
            }
        }
window.status="";
    }
// -->
