// OFR Consumer
// Last modified 2008/09/10, JFA

itp = {	
	
	processVars : function(p) {			
			var ROOT = new Array();
			ROOT["Appareils"] = new Array("/consumer/", "/cameras/");
			ROOT["Systèmes Audio"] = new Array("/voice/", "/consumer/voicerecorders.htm");
			ROOT["Jumelles"] = new Array("/binoculars/", "/consumer/binoculars.htm");			
			var PRODUCT_VIEW_ELEMENT = '"productsub"';
													
			if (p.getHierarchy().length == 1) {
				p.getHierarchy().push(p.getDocumentname());
				p.setDocumentname(p.getDocumentname() + " Home");
			}					
	
			var arr_rootpath = new Array();
			for (var el in ROOT) arr_rootpath = arr_rootpath.concat(ROOT[el]);			
				
			var rootpath = "("+	arr_rootpath.join("|") + ")";
			var re = new RegExp(rootpath.replace("/","\/") + "((index[a-z0-9_]*|binoculars|voicerecorders).html?)?$", "i");
			p.setDocumentgroup((p.getHierarchy().length == 0) ? ((re.exec(unescape(document.URL.indexOf("?")>-1?document.URL.slice(0,document.URL.indexOf("?")):document.URL)) != null) ? "Home" : "Specials/Other") : p.getHierarchy()[1]);
						
			if (p.getHierarchy().length == 0) {	
				for (var el in ROOT)
					for (var path in ROOT[el])						
						if(unescape(document.URL).match(ROOT[el][path]) != null)													
							var HOMENAME = el;				
				p.getHierarchy().push(HOMENAME);				
				p.getHierarchy().push(p.getDocumentgroup());
			}        
			
			var re = new RegExp(PRODUCT_VIEW_ELEMENT,"i");
			if (re.exec(document.body.innerHTML) != null) {
				p.setActionId("PRODUCT_VIEW");   
				p.setSKU(getArticleId());
				var el = getElementsByClass("link5", null, "td");
				for (var i=0; i < el.length; i++)
					if (el[i].style.background.indexOf("nav_detailsbg_ac") >= 0 || el[i].style.background.indexOf("nav_detailsbg_ov_black") >= 0) 
						p.setDocumentname( p.getHierarchy()[p.getHierarchy().length-1] + " [" + el[i].childNodes[0].innerHTML + "]" );				
			}				    					
	}
	
}
