function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) 
		for (var i=0; i<changeImages.arguments.length; i+=2) 
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		e_06_over = newImage("images/e_06-over.gif");

		menuOn  = new Array(5);
		menuOff = new Array(5);

		for(i=1;i<=4;i++) {
			menuOn[i]  = new Image();
			menuOff[i] = new Image();

			menuOn[i].src  = "images/"+i+"_on.jpg";
			menuOff[i].src = "images/"+i+"_off.jpg";
		}

		preloadFlag = true;
	}
}



//Функции переключения главного меню

function ShowMenu(ID) {
	document.getElementById(ID).className = "menuactive";
	if ((ID == 3) || (ID == 4)) ShowSubMenu(ID);
}

function HideMenu(ID) {
	if(ID != MenuSelect)	document.getElementById(ID).className = "menunoactive";
	if ((ID == 3) || (ID == 4)) HideSubMenu(ID);
}

/*
function ClickMenu(ID) {
	if (ID == 0)	locate = ""; 
	else locate = "start.php?menu="+ID+"&productID=&sposobID=&typeID=";
	location = (locate);
}
*/

//Функции переключения подменю
/*
function ShowSubMenu(ID) 
{document.getElementById(ID).className = "smActive";} 

function HideSubMenu(ID) 
{document.getElementById(ID).className = "smNoActive";}

function ClickSubMenu(menuID, productID, sposobID, typeID) 
{
  locate = "start.php?menu=" + menuID + "&productID=" + productID + "&sposobID=" + sposobID + "&typeID=" + typeID;
  location = (locate);
}
*/


function ShowSubMenu(ID) {
	document.getElementById("Sub"+ID).style.display = "block";
	setY("Sub"+ID, 0);
}

function setY(ID, n) {
	document.getElementById(ID).style.top = n;
	if (n<15) {
		n=n+1;
		timeoutID = setTimeout("setY('"+ID+"',"+n+")", 3);
	}
}

function HideSubMenu(ID) {document.getElementById("Sub"+ID).style.display = "none";}

//Функции переключения меню каталога

function TypeClick(ID, element) {

	if (selID[ID] == 0) {
		document.getElementById(ID).className = 'Display';
		selID[ID] = 1;
		//element.className = 'active';
		//submenu = 0;
		if (ID == "t10") location = baseURL+"production/seals";
		if (ID == "t11") location = baseURL+"production/sundaes";
	} else {
		document.getElementById(ID).className = 'noDisplay';
		selID[ID] = 0;
		//element.className = 'noactive';
		//submenu = 0;
	}
}

function ProdClick(menuID, productID, sposobID, typeID) {
  locate = "start.php?menu=" + menuID + "&productID=" + productID + "&sposobID=" + sposobID + "&typeID=" + typeID;
  location = (locate);
}

//Функции увеличенных картинок

function sel(obj) {obj.className = "sel"}

function unsel(obj) {obj.className = "unsel"}

function openWin(f, w, h, t) {
	var wh;
	wh = "width="+w+", height="+h+", menubar=no";
	newWin=window.open("", "Window",wh);
	newWin.document.open();
	newWin.document.write("<html><head><title>"+t+"</title>");
	newWin.document.write("</head><body style='margin:0;'>");
	newWin.document.write("<center><h1 style='color:#511faa; font-size: 12pt; padding-top: 10px; margin-bottom: 10px;'>"+t+"</h1>");
	newWin.document.write("<img src=big"+f+">");
	newWin.document.write("</body></html>");
	newWin.document.close();
}


//Функции Опроса

function SubmitOpros(B) {
var A = 0;
   for (i = 0; i < frmOpros.OprosID.length; i++) 
       {
           if (frmOpros.OprosID[i].checked == true) {
		A = 1;
		}
       }

if ((A == 1) || (B == 1)) {
    frmOpros.submit();
    frmOpros.cbEnter.className = 'noDisplay';
    document.getElementById("Result").className = 'Display';
    document.getElementById("Anc").click();
}
}


//Функции Адреса

function ChangeAdr() {
window.open(frmAdr.adr.value,  "_self", "width= 350 , height= 250 , status=no, toolbar=no, resizable=yes, scrollbars=yes, menubar=no");
}


function manager()
{
frmMan.adressSEO.value = location;
frmMan.submit();
}


function SubmitUpload() {
    newWin=open("", "Upload", "width= 350, height= 300, location=no, status=no, toolbar=no, resizable=yes, scrollbars=no, menubar=no");
    frmUpload.submit();
}



function getXmlHttp(){
  var xmlhttp;
  try {
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (e) {
    try {
      xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (E) {
      xmlhttp = false;
    }
  }
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
  }
  return xmlhttp;
}



function online_click2() {
var params
params  = "online="+Math.random()+"&";
params += "MAX_FILE_SIZE="+frmOnLine.MAX_FILE_SIZE.value+"&";
params += "Client="+ encodeURIComponent(frmOnLine.Client.value) +"&";
params += "Tel="+ encodeURIComponent(frmOnLine.Tel.value) +"&";
params += "Email="+ encodeURIComponent(frmOnLine.Email.value) +"&";
params += "Product="+ encodeURIComponent(frmOnLine.Product.value) +"&";
params += "Kol="+ encodeURIComponent(frmOnLine.Kol.value) +"&";
params += "DopInfo="+ encodeURIComponent(frmOnLine.DopInfo.value);
//params += "file_online="+frmOnLine.file_online.value;

//params  = "?online="+Math.random()+"&";
//params += "Client="+ encodeURIComponent(frmOnLine.Client.value);

//alert(params);
var xmlhttp = getXmlHttp()
xmlhttp.open("POST", "../on-line-res.php", true);
xmlhttp.onreadystatechange = function() {
  if (xmlhttp.readyState == 4) {
	//alert(xmlhttp.readyState);
	alert(xmlhttp.statusText);
     if(xmlhttp.status == 200) {

	document.getElementById("resp").innerHTML=xmlhttp.responseText;

       //alert(xmlhttp.responseText);
         }
  }
};

//xmlhttp.setRequestHeader("Content-Type", "multipart/form-data");
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

xmlhttp.send(params);
//xmlhttp.send(null);

}


function online_click() {
	frmOnLine.submit();
}

function online_click1() {
var params

var xmlhttp = getXmlHttp()
xmlhttp.open("POST", "../on-line-res.php", true);
xmlhttp.onreadystatechange = function() {
  if (xmlhttp.readyState == 4) {
	//alert(xmlhttp.readyState);
	alert(xmlhttp.statusText);
     if(xmlhttp.status == 200) {

	document.getElementById("resp").innerHTML=xmlhttp.responseText;

       //alert(xmlhttp.responseText);
         }
  }
};

xmlhttp.setRequestHeader("Content-Type", "multipart/form-data; boundary=1BEF0A57BE110FD467A");


params  = "--1BEF0A57BE110FD467A\r\n";
params += "Content-Disposition: form-data; name='online'\r\n";
params += "\r\n";

params += Math.random()+"\r\n";

params += "--1BEF0A57BE110FD467A\r\n";
params += "Content-Disposition: form-data; name='MAX_FILE_SIZE'\r\n";
params += "\r\n";

params += frmOnLine.MAX_FILE_SIZE.value+"\r\n";

params += "--1BEF0A57BE110FD467A\r\n";
params += "Content-Disposition: form-data; name='file_online'; filename="+frmOnLine.file_online.value+"\r\n";
//params += "Content-Type: text/plain\r\n";
params += "Content-Type: application/octet-stream\r\n";
params += "Content-Transfer-Encoding: binary\r\n";
params += "\r\n";

params += "Данные этого файла\r\n";
params += "--1BEF0A57BE110FD467A--\r\n";
/**/

alert(params);

xmlhttp.send(params);

}



