﻿function showImage(id,desc) {
	e=document.getElementById('bigimage');
	e.src="/images/products/"+id+"/medium/"+desc+".jpg";
	e=document.getElementById('bigimagelink');
	e.href="/images/products/"+id+"/large/"+desc+".jpg";
	//e.onClick=function(){ alert("/images/products/"+id+"/large/"+desc+".jpg"); return false; }
		//window.open("/images/products/"+id+"/large/"+desc+".jpg", 'Details', 'height=800,width=600').focus(); return false;};
}

function showImage2(pid,iid,descr) {
	e=document.getElementById('bigimage');
	e.src="images-products-"+pid+"-"+iid+"-medium-"+descr+".jpg";
	e=document.getElementById('bigimagelink');
	e.href="images-products-"+pid+"-"+iid+"-large-"+descr+".jpg";
}

function launchCartFormCmd(action) {
	if (action == "checkout") {
		//document.cart_form.action = document.cart_form.ssl_url.value;
		document.paypal_form.submit();
	} else {
	document.cart_form.cmd.value=action;
	document.cart_form.submit();
}
}

	function verifyFields(form_name) {
		try {
			frm = document.getElementById(form_name);
			lists = frm.getElementsByTagName("input");
			ok = true;
			for (var i = 0; i < lists.length; i++) {
 	   		if (lists[i].name.length > 7) {
	 	   		idx = lists[i].name.lastIndexOf('_');
	 	   		if (lists[i].name.substr(idx+1) != "verify")
	 	   			continue;
 	   			ofield = lists[i].name.substring(0, idx);
 	   			ocontent = document.getElementById(ofield);
 	   			//alert("Testing ["+ofield+"] and value ["+lists[i].value+"] VS ["+ocontent.value+"]");
 	   			if (!ocontent)
 	   				throw "ocontent is null for field "+ofield;
 	   			bgc="#ffffff";
 	   			if (lists[i].value != ocontent.value) {
	 	   		//alert('Some verification fields are not correct !');
 	   				ok = false;
 	   				bgc="#ff0000";
 	   			}
   				lists[i].style.backgroundColor=bgc;
   				ocontent.style.backgroundColor=bgc;
 	   		}
			}
		} catch (err) {
			alert("Err "+err.description+"\n"+err);
		}
   	if (!ok) {
   		alert('Error, some fields are not verified !');
  	} else {
  		frm.submit();
  	}
	}

		loop=true;
		function mv(v) {
			obj=document.getElementById("in");
			iv = obj.style.left.substring(0,obj.style.left.length - 2).valueOf()
			//alert((parseInt(iv) + parseInt(v)) + "px");
			obj.style.left = (parseInt(iv) + parseInt(v)) + "px";
			if (loop)
				setTimeout("mv("+v+")",100);
		}
		function startMv(v) {
			loop=true
			setTimeout("mv("+v+")",100);
		}
		function stopMv() {
			loop=false;
		}
