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.lastIndexOf(".") > str.indexOf("@") && 
			str.indexOf("@") > 0 &&
			str.indexOf(" ") <= 0);
}

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

function setImage(path,img_obj) {
	
	document.images[img_obj].src = path;
}

var last_v_img = "img_row_0";

function setImage2(path,img_obj,row_obj) {
	if(window.last_v_img != "") 
		getObj(last_v_img).className = "image_list";
	

	getObj(row_obj).className = "img_selected";
	
	document.images[img_obj].src = path;
	
	last_v_img = row_obj;
}

function setVideo(image_path,video_path) {

	//video
	var so = new SWFObject('swf/player.swf','ply','470','350','9','#');
	so.addParam('allowfullscreen','true');
	so.addParam('allowscriptaccess','always');
	so.addParam('wmode','opaque');
	so.addVariable('image',image_path);
	so.addVariable('file',video_path);
	//so.addVariable('skin','http://developer.longtailvideo.com/svn/skins/beelden/beelden.zip');
	//so.addVariable('frontcolor','ffffff');
	//so.addVariable('lightcolor','cc9900');
	//so.addVariable('screencolor','ffffff');
	so.addVariable('stretching','fill');
	so.addParam("allowFullScreen", "true");
	so.addParam("scale", "exactFit");
	//so.addParam("flashvars", params);
	so.write('mediaspace');

}

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);
}
function showPrivacy() {
	return openURL('privacy.php','','top=0,left=0,width=750,height=550,scrollbars=no,resizable=no');	
}
