function getObj(obj) {
	
	if (document.all && !document.getElementById) {
		//alert("Internet Explorer 4");
		// Internet Explorer 4
		return document.all(obj);
	}
	if (document.all && document.getElementById) {
		//alert("Internet Explorer 5");
		// Internet Explorer 5
		return document.getElementById(obj);
	}
	if (document.layers) {
		//alert("Netscape 4");
		// Netscape 4
		return document.layers(obj);
	}
	if (!document.all && document.getElementById) {
		//alert("Netscape 6");
		// Netscape 6
		return document.getElementById(obj);
	}
	

}

function sendForm() {
	document.forms[0].submit();
}

function redirect(url,target) {
	if(target == null || target=="")
		window.location = url;
	else
		eval(target).window.location = url;
}

function isEmail(str) {
   return (	str.length > 0 &&
		   	str.indexOf(".") > 2 && 
			str.lastIndexOf(".") > str.indexOf("@") && 
			str.indexOf("@") > 0);
}

function doPrint() {
	window.print();
}

var last_v_img = "v_img_1";

function setImage(path,img_obj,n) {
	//setto il numero da visualizzare in alto nell'immagine grande
	//getObj('img_number').innerHTML = '<span style="margin-right:7px;">'+n+'</span>';
	if(window.last_v_img) 
		window.document[last_v_img].SetVariable("curr_selected", 0);
	
	if(document.last_v_img)
		document.last_v_img.SetVariable("curr_selected", 0);
	
	/*
	if(last_v_img != null)
		getObj(last_v_img).SetVariable("curr_selected", 0);
	*/
	document.images[img_obj].src = path;
	
	last_v_img = 'v_img_'+n;
}

function askDelete(link_redirect) {
	if(confirm("Eliminare definitivamente?"))
		redirect(link_redirect);
}

function highlightItem(id,img) {

	if(document.getElementById(id))
		document.getElementById(id).src = 'images/'+img;
}

function openDetail(id,classe) {
	return openURL('product_detail.php?id='+id+'&class='+classe,'','width=627,height=664,scrollbars=yes,resizable=no');	
}

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