function cPop(url, windowname, www, hhh) {window.open(url,windowname,'width=' + www + ',height=' + hhh + ',left=30,top=30,screenX=70,screenY=70,status=1');
}

imagebg=new Image(16,14)
imagebg.src="wedge2.gif"

var phone = "()- 0123456789";
		var zip = "- 0123456789";
		var numb = "0123456789";
		//var alpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ";
		var alpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ '-";
		var alphanumeric = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ -'";		
		var email = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ -_@.'";		
		var filter1 = "~|#=+<>[]{}_%&";
		
		//function to accept only characters that are in the range
		function res(t,v){
			var w = "";
			for (i=0; i < t.value.length; i++) {
				x = t.value.charAt(i);
				if (v.indexOf(x,0) != -1)
					w += x;
			}
			t.value = w;
		}
		
		//function to not accept characters that are in the range
		function filter(t,v) {
			var w = "";
			for (i = 0; i < t.value.length; i++) {  // Search through string and append to unfiltered values to returnString.
				x = t.value.charAt(i);
				if (v.indexOf(x,0) == -1)
					w += x;			
			}
			t.value = w;
		}	

    function replace(string,text,by) {
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}

function CheckRequiredFields(arRequired){
	//this function checks to see if all the required fields are populated
	var strMsg = 'Please complete the following fields:\n';
	var iCount = 0;
	
	for (var i = 0; i < arRequired.length; i++) {
		var x = document.forms[0].elements[arRequired[i]].value;
		if (x == '' || x == null) {
			strMsg += ((0 < iCount) ? ', ' : '') + arRequired[i].substring(3,arRequired[i].length);
			iCount += 1;
		}
	}
	//if no errors were found, pass back an empty string
	if (iCount == 0)
		strMsg = ''
		
	//return the error message 
	return strMsg

}

function ValidateData ( strAction) {
		//this function will make sure the necessary data is entered and save the changes
		var strErrors //error message
		var arRequired //array storing names of required fields
		
		// add , 'txtDeliveryCountryCode'
		arRequired = new Array('txtFirstName','txtLastName','txtEmail','lstCountryCode')
		strErrors = CheckRequiredFields(arRequired)

		//if there is an error message, display it and exit sub
		if (strErrors.length != 0) {
			alert(strErrors);
			return;
		}

		document.forms["frmContact"].submit();
	}//validate data
