function ValidateForm () {
	var incomplete = 'false';
	var no_thanks = 'false';
	var select_tags = document.testform.getElementsByTagName('select');
	for (x = 0; x < select_tags.length; x++) {
		if ((select_tags[x].value == '') || (select_tags[x].value == 'Please Select'))
			incomplete = 'true';

		if ((select_tags[x].value == 'N: No Thanks') || (select_tags[x].value == 'No Thanks'))
			no_thanks = 'true';
	}
	
	if ((incomplete == 'true') && (no_thanks == 'false')) {
		alert ('Please choose all selectable options');
//		document.testform.reset();
//		document.testform.elements["vwquantity0"].value = '1';
		return false;
	} else {
//		DeleteEmptyElements();
		return true;
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function openSSLPopup() {
w1 = window.open('','w1','width=400,height=250');
w1.document.write("<b><font size=\"+2\">Is Bags-Purses-Totes.com secure?</font></b><p>");
w1.document.write("All order form pages of Bags-Purses-Totes.com are served through a secure https connection using 256-bit SSL v3 encryption. We encrypt your credit card and personal information as you enter it in the web browser, when it is sent to our server, and finally when it is sent from our server to our order processing center. We have you protected at all stages of the transaction.");
w1.document.write("<center><a href=\"javascript:;\" onclick=\"window.close();\">close window</a></center>");
}

function verifyselection(form) 
	{
		// result function
		var blnResult = true;
		// temp name form control
		var nameControl = "";
		// array of name of radio form controls
		var arrNameControl = new Array();
		// array of value checked of radio form controls
		var arrValueControl = new Array();
		// flag existence form control in array
		var isExistOnArray = false;

		// loop on all elements of form
		for(i=0; i<form.elements.length; i++) {
			// check type form control
			if(form.elements[i].type=="radio") {
				// save name form control
				nameControl = form.elements[i].name;
				// reset flag existence form control in array
				isExistOnArray = false;
				// loop on all found radio form control
				for(j=0; j<arrNameControl.length; j++){
					// if giving form control is exist in array
					if(arrNameControl[j] == nameControl) {
						// set flag
						isExistOnArray = true;
						// break loop
						break;
					}
				}
				// if giving form control is not exist in array
				if(isExistOnArray == false){
					// set index of array
					j = arrNameControl.length;
					// add new element to arrays
					arrNameControl[j] = nameControl;
					arrValueControl[j] = 0;
				}
				// if giving radio form control is checked
				if(form.elements[i].checked == "1"){
					arrValueControl[j] = 1;
				}
			}
                        if ((form.elements[i].selectedIndex > -1)) {
                                if (form.elements[i].selectedIndex == 0) {
                                        var opttext = form.elements[i].value.toLowerCase();
                                        if (opttext.indexOf('optional') < 0) {        
                                                blnResult = false;
                                                alert('Please select ' + form.elements[i].name.toLowerCase());
                                                break;
                                        }
                                }
                        }
		}
		// loop on all found radio form control
		if(blnResult==true) {
                        for(j=0; j<arrNameControl.length; j++){
			        // if radio group form control is checked
			        if(arrValueControl[j] != 1) {
				       // set result function
				       blnResult = false;
				       // show error message
				       alert("Please select " + arrNameControl[j].toLowerCase());
				       break;
		       	       }
		       }
                }
		// return result function
		return blnResult;
	}

function CaricaFoto(img, name, wid, hi){
  foto1= new Image();
  foto1.src=(img);
  viewFotos(img, name, wid, hi);
}

function viewFotos(img, name, wid, hi){

 features = 
    "toolbar=no,location=no,directories=no,status=no,menubar=no," +
    "scrollbars=yes,resizable=yes,width=" + wid + ",height=" + hi;
 dlg = window.open ("","Details",features);
 dlg.document.write("<html><head><title>" + name + " Zoom</title></head>");
 dlg.document.write("<body bgcolor=white><center>");
 dlg.document.write("<table width=100% height=100%>");
 dlg.document.write("<tr><td align=center valign=middle>");
 dlg.document.write("<b><font size=1 face=verdana>" +  name + "</font></b><br><br>");
 dlg.document.write("<img src=" + img + ">");
 dlg.document.write("</td></tr>");
 dlg.document.write("<tr><td align=center valign=middle>");
 dlg.document.write("<a href=# onClick=window.close();>");
 dlg.document.write("<font size=1 face=verdana>click to close</font></a>");
 dlg.document.write("</td></tr>");
 dlg.document.write("</table></body></html>");
}

function popup(filename){
window.open(filename, "","height=450,width=575,top=10,left=10,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=yes,toolbar=no,directories=no");
}
