﻿function ShowBookmark(b) 
{ 
	var a = new Array("description", "action", "service"); 
	for (i = 0; i < a.length; i++) 
	{ 
		if (a[i] == b) 
		{ 
			document.getElementById("div_" + a[i]).style.display = "block"; 
			document.getElementById("td_" + a[i]).className = (b == "action") ? "active_alert_div" : "active_div"; 
			document.getElementById("left_" + a[i]).className = "noborder"; document.getElementById("right_" + a[i]).className = "noborder"; 
			document.getElementById("leftimg_" + a[i]).src = "/images/box_left_corner_active.jpg"; 
			document.getElementById("rightimg_" + a[i]).src = "/images/box_right_corner_active.jpg" 
		} 
		else 
		{ 
			document.getElementById("div_" + a[i]).style.display = "none"; 
			document.getElementById("td_" + a[i]).className = (a[i] == "action") ? "passive_alert_div" : "passive_div"; 
			document.getElementById("left_" + a[i]).className = "border"; 
			document.getElementById("right_" + a[i]).className = "border"; 
			document.getElementById("leftimg_" + a[i]).src = "/images/box_left_corner_passive.jpg"; 
			document.getElementById("rightimg_" + a[i]).src = "/images/box_right_corner_passive.jpg" 
		} 
	} 
} 
function showMenu(c, d, a, b) 
{ 
	document.getElementById("leftUp_" + c).className = "leftUpMouse"; 
	document.getElementById("mainMenu_" + c).className = "mainMenuMouse"; 
	document.getElementById("rightUp_" + c).className = "rightUpMouse"; 
	document.getElementById("mainMenuText_" + c).className = "mainMenuTextMouse"; 
	divMenu.show("dd_N_" + c, d, a, b) 
} 
function closeMenu(a) 
{ 
	divMenu.hide("dd_N_" + a); 
	document.getElementById("leftUp_" + a).className = "leftUpNotSelected"; 
	document.getElementById("mainMenu_" + a).className = "mainMenuNotSelected"; 
	document.getElementById("rightUp_" + a).className = "rightUpNotSelected"; 
	document.getElementById("mainMenuText_" + a).className = "mainMenuText" 
} 
function playFlashURL(b, a, d) 
{ 
	var c = "toolbar=0, width=" + a + ", height=" + (d * 1 + 10); 
	window.open("http://" + location.hostname + "/playFlash.asp?url=" + b + "&width=" + a + "&height=" + d, "FlashPlayer", c) 
} 
function checkFieldCardNoForBlocking(c, b, a) 
{ 
	if (document.getElementById(c).value == "") 
	{ 
		document.getElementById(b).disabled = false; 
		document.getElementById(b).style.background = "#ffffff"; 
		document.getElementById(a).disabled = false; 
		document.getElementById(a).style.background = "#ffffff" 
	} 
	else 
	{ 
		document.getElementById(b).disabled = true; 
		document.getElementById(b).value = ""; 
		document.getElementById(b).style.background = "#aaaaaa"; 
		document.getElementById(a).disabled = true; 
		document.getElementById(a).value = ""; 
		document.getElementById(a).style.background = "#aaaaaa" 
	} 
} 
function checkFieldVipBonusForBlocking(c, b, a) 
{ 
	if (document.getElementById(c).value == "" && document.getElementById(b).value == "") 
	{ 
		document.getElementById(a).disabled = false; 
		document.getElementById(a).style.background = "#ffffff" 
	} 
	else 
	{ 
		document.getElementById(a).disabled = true; 
		document.getElementById(a).value = ""; 
		document.getElementById(a).style.background = "#aaaaaa" 
	} 
} 

var indSrc = 0; var arImgMovie = new Array(); 

function initImg() 
{ 
	for (i = 50; i < 101; i++) 
	{ 
		arImgMovie[i - 50] = new Image(); 
		arImgMovie[i - 50].src = "/movie/dog_addBasket/" + i + ".gif" 
	}
} 
function createRequestObject() 
{ 
	if (window.XMLHttpRequest) 
	{ 
		try 
		{ 
			return new XMLHttpRequest() 
		} 
		catch (a) { } 
	} 
	else 
	{ 
		if (window.ActiveXObject) 
		{ 
			try 
			{ 
				return new ActiveXObject("Msxml2.XMLHTTP") 
			} 
			catch (a) { } 
			try 
			{ 
				return new ActiveXObject("Microsoft.XMLHTTP") 
			} 
			catch (a) { } 
		} 
	} 
	return null 
} 

var originalSearchStr = ""; var oldSearchStr = ""; var currentSearchId = 0; var XMLHTTPDoc; var HttpRequest; var isLoad = true;
 
function loadSearchDiv(a) 
{ 
	if ((a.length > 2) && (oldSearchStr != a) && (isLoad == true)) 
	{ 
		XMLHTTPDoc = createRequestObject(); 
		XMLHTTPDoc.onreadystatechange = ReadyStateChange; 
		XMLHTTPDoc.open("GET", "http://" + document.location.hostname + "/xml/shablon.aspx?search=" + a, true); 
		XMLHTTPDoc.send(null); 
		oldSearchStr = a 
	} 
	else 
	{ 
		if (a.length < 3) 
		{ 
			document.getElementById("search_help").style.display = "none" 
		} 
	} 
} 
function ReadyStateChange(a) 
{ 
	if (XMLHTTPDoc.readyState == 4) 
	{ 
		document.getElementById("search_help").innerHTML = XMLHTTPDoc.responseText; 
		document.getElementById("search_help").style.display = "block" 
	} 
} 
function getElementName() 
{ 
	var b = document.getElementsByTagName("input"); 
	var a = 0; 
	while (a < b.length) 
	{ 
		if (b.item(a).id.lastIndexOf("SearchModule1_Search") > 0) 
		{ 
			return b.item(a).id 
		} 
		a++ 
	} 
	return null 
} 
function setSearchString(a) 
{ 
	document.getElementById(getElementName()).value = a; 
	document.getElementById("search_help").style.display = "none"; 
	isLoad = true; 
	currentSearchId = 0; 
	originalSearchStr = ""; 
	document.getElementById(getElementName()).focus() 
} 
function setNewClass(b, a) 
{ 
	if ((currentSearchId == 0) && (originalSearchStr == "")) 
	{ 
		originalSearchStr = document.getElementById(getElementName()).value 
	} 
	if (document.getElementById("search_" + currentSearchId)) 
	{ 
		document.getElementById("search_" + currentSearchId).style.backgroundColor = "#FFFFFF" 
	} 
	currentSearchId = b.id.replace("search_", ""); 
	if (document.getElementById("search_" + currentSearchId)) 
	{ 
		document.getElementById("search_" + currentSearchId).style.backgroundColor = "#EFD7BD" 
	} 
} 
function bodyKeyUp(a) 
{ 
	if (document.getElementById("search_help")) 
	{ 
		if (document.getElementById("search_help").style.display == "block") 
		{ 
			if (a.keyCode + "" == "40") 
			{ 
				isLoad = false; 
				if ((currentSearchId == 0) && (originalSearchStr == "")) 
				{ 
					originalSearchStr = document.getElementById(getElementName()).value 
				} 
				if (document.getElementById("search_" + currentSearchId)) 
				{ 
					document.getElementById("search_" + currentSearchId).style.backgroundColor = "#FFFFFF" 
				} currentSearchId++; 
				if (!document.getElementById("search_" + currentSearchId)) 
				{ 
					currentSearchId = 0; 
					document.getElementById(getElementName()).value = originalSearchStr 
				} 
				if (document.getElementById("search_" + currentSearchId)) 
				{ 
					document.getElementById("search_" + currentSearchId).style.backgroundColor = "#EFD7BD"; 
					document.getElementById(getElementName()).value = document.getElementById("search_" + currentSearchId).childNodes[0].childNodes[0].nodeValue 
				} 
				if (!document.all) 
				{ 
					window.scroll((document.all) ? document.body.scrollLeft : window.pageXOffset, (document.all) ? document.body.scrollTop : window.pageYOffset) 
				} 
			} 
			else 
			{ 
				if (a.keyCode + "" == "38") 
				{ 
					isLoad = false; 
					if ((currentSearchId == 0) && (originalSearchStr == "")) 
					{ 
						originalSearchStr = document.getElementById(getElementName()).value 
					} 
					if (document.getElementById("search_" + currentSearchId)) 
					{ 
						document.getElementById("search_" + currentSearchId).style.backgroundColor = "#FFFFFF" 
					} 
					currentSearchId--; 
					if (currentSearchId < 0) 
					{ 
						if (document.getElementById("maxSearchId")) 
						{ 
							currentSearchId = document.getElementById("maxSearchId").value 
						} 
							else 
							{ 
								currentSearchId = 0; 
								document.getElementById(getElementName()).value = originalSearchStr 
							} 
					} 
					if (document.getElementById("search_" + currentSearchId)) 
					{ 
						document.getElementById("search_" + currentSearchId).style.backgroundColor = "#EFD7BD"; 
						document.getElementById(getElementName()).value = document.getElementById("search_" + currentSearchId).childNodes[0].childNodes[0].nodeValue 
					} 
					if (currentSearchId == 0) 
					{ 
						document.getElementById(getElementName()).value = originalSearchStr 
					} 
					if (!document.all) 
					{ 
						window.scroll((document.all) ? document.body.scrollLeft : window.pageXOffset, (document.all) ? document.body.scrollTop : window.pageYOffset) 
					} 
				} 
				else 
				{ 
					if (a.keyCode + "" == "27") 
					{ 
						currentSearchId = 0; 
						document.getElementById(getElementName()).value = originalSearchStr; 
						isLoad = true; 
						document.getElementById("search_help").style.display = "none"; 
						oldSearchStr = "" 
					} 
				} 
			} 
		} 
	} 
} 
function ReadyStateChangeDelivery() 
{ 
	if (XMLHTTPDoc.readyState == 4) 
	{ 
		document.getElementById("deliveryCityHelp").innerHTML = XMLHTTPDoc.responseText; 
		document.getElementById("deliveryCityHelp").style.display = "block" 
	} 
} 
function ReadyStateChangeDelivery1() 
{ 
	if (XMLHTTPDoc.readyState == 4) 
	{ 
		document.getElementById("deliveryCityHelp1").innerHTML = XMLHTTPDoc.responseText; 
		document.getElementById("deliveryCityHelp1").style.display = "block" 
	}
} 

function loadDeliveryDiv(a, b) 
{
	if ((a.length > 0) && (isLoad == true)) 
	{ 
		XMLHTTPDoc = createRequestObject(); 
		XMLHTTPDoc.onreadystatechange = ReadyStateChangeDelivery;
		//XMLHTTPDoc.open("GET", "http://" + document.location.hostname + "/xml_pages/DHL.aspx?search=" + a + "&act=city&comm=" + b, true);
		XMLHTTPDoc.open("GET", "http://" + document.location.hostname + ":" + document.location.port + "/xml_pages/DHL.aspx?search=" + a + "&act=city&comm=" + b, true);
		//XMLHTTPDoc.open("GET", "http://" + document.location.hostname + ":" + document.location.port + "/xml_pages/dpd.aspx?search=" + a + "&act=city&comm=" + b, true); 

		XMLHTTPDoc.send(null); 
		oldSearchStr = a 
	} 
	else 
	{ 
		if (a.length < 1) 
		{ 
			document.getElementById("deliveryCityHelp").style.display = "none" 
		} 
	}
}
function loadDeliveryDiv1(a, b) 
{
	if ((a.length > 0) && (isLoad == true)) 
	{ 
		XMLHTTPDoc = createRequestObject(); 
		XMLHTTPDoc.onreadystatechange = ReadyStateChangeDelivery1; 
		XMLHTTPDoc.open("GET", "http://" + document.location.hostname + ":" + document.location.port + "/xml_pages/DeliveryInMoscowRegion.aspx?search=" + a + "&act=city&comm=" + b, true); 
		XMLHTTPDoc.send(null); oldSearchStr = a 
	} 
	else 
	{ 
		if (a.length < 1) 
		{ 
			document.getElementById("deliveryCityHelp1").style.display = "none" 
		} 
	} 
}
function setDeliveryString(b, c, a) {
    if ((!a) || (a + "" == "undefined")) {
        a = "tarif"
    }
    document.getElementById("deliveryCity").innerHTML = c;
    XMLHTTPDoc = createRequestObject();
    if (b != 0 && a == "tarifBasket") {
        XMLHTTPDoc.onreadystatechange = ReadyStateChangeDeliveryPrice
    }
    else {
        XMLHTTPDoc.onreadystatechange = ReadyStateChangeDeliveryPriceMoscow
    }
    if (document.getElementById("itemId") != null) {
        XMLHTTPDoc.open("GET", "http://" + document.location.hostname + ":" + document.location.port + "/xml_pages/DHL.aspx?search=" + c + "&zone=" + b + "&id=" + document.getElementById("itemId").value + "&act=" + a + "&Random=" + (Math.random() * 100), true)
        //XMLHTTPDoc.open("GET", "http://" + document.location.hostname + ":" + document.location.port + "/xml_pages/dpd.aspx?search=" + c + "&zone=" + b + "&id=" + document.getElementById("itemId").value + "&act=" + a + "&Random=" + (Math.random() * 100), true)

    }
    else {
        //XMLHTTPDoc.open("GET", "http://" + document.location.hostname + "/xml_pages/dpd.aspx?search=" + c + "&zone=" + b + "&act=tarif" + a + "&Random=" + (Math.random() * 100), true)
		XMLHTTPDoc.open("GET", "http://" + document.location.hostname + "/xml_pages/DHL.aspx?search=" + c + "&zone=" + b + "&act=tarif" + a + "&Random=" + (Math.random() * 100), true)
    }
    XMLHTTPDoc.send(null)
} 
function setDeliveryString1(b, c, a) 
{ 
	if ((!a) || (a + "" == "undefined")) 
	{ 
		a = "tarif" 
	} 
	document.getElementById("deliveryCity1").innerHTML = c; 
	XMLHTTPDoc = createRequestObject(); 
	XMLHTTPDoc.onreadystatechange = ReadyStateChangeDeliveryPrice1; 
	if (document.getElementById("itemId") != null) 
	{ 
		XMLHTTPDoc.open("GET", "http://" + document.location.hostname + ":" + document.location.port + "/xml_pages/DeliveryInMoscowRegion.aspx?search=" + c + "&zone=" + b + "&id=" + document.getElementById("itemId").value + "&act=" + a, true) 
	} 
	else 
	{ 
		XMLHTTPDoc.open("GET", "http://" + document.location.hostname + ":" + document.location.port + "/xml_pages/DeliveryInMoscowRegion.aspx?search=" + c + "&zone=" + b + "&act=tarif" + a, true) 
	} 
	XMLHTTPDoc.send(null) 
} 
function ReadyStateChangeDeliveryPrice() 
{ 
	if (XMLHTTPDoc.readyState == 4) 
	{ 
		document.getElementById("deliveryPrice").innerHTML = XMLHTTPDoc.responseText; 
		document.getElementById("deliveryCityHelp").style.display = "none"; 
		XMLHTTPDoc = null 
	}
}

function ReadyStateChangeDeliveryPriceMoscow() {
    if (XMLHTTPDoc.readyState == 4) {
        if (document.getElementById("deliveryPrice")) {
            document.getElementById("deliveryPrice").innerHTML = XMLHTTPDoc.responseText;
            document.getElementById("deliveryCityHelp").style.display = "none"
        }
        //if (document.getElementById("deliveryPriceMoscow").value == '') //&& document.getElementById("deliveryPrice").value != document.getElementById("deliveryPriceMoscow").value) {
        //    document.getElementById("deliveryPriceMoscow").innerHTML = XMLHTTPDoc.responseText; 
        //    document.getElementById("deliveryPriceMoscow2").innerHTML = XMLHTTPDoc.responseText
        //}
        if (document.getElementById("deliveryPriceMoscow").innerHTML == "500 руб.") {
            document.getElementById("deliveryPriceMoscow").innerHTML = XMLHTTPDoc.responseText;
            document.getElementById("deliveryPriceMoscow2").innerHTML = XMLHTTPDoc.responseText;
        }
    }
}

function ReadyStateChangeDeliveryPrice1() 
{ 
	if (XMLHTTPDoc.readyState == 4) 
	{ 
		document.getElementById("deliveryPrice1").innerHTML = XMLHTTPDoc.responseText; 
		document.getElementById("deliveryCityHelp1").style.display = "none" 
	} 
};
