function getCookie(name) {
  var prefix = name + "=";
  var cookieStartIndex = document.cookie.indexOf(prefix);
  if (cookieStartIndex == -1) return null;
  var cookieEndIndex = document.cookie.indexOf(";",cookieStartIndex + prefix.length);
  if (cookieEndIndex == -1) cookieEndIndex = document.cookie.length;
  return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}


function setCookie(name,value,save) {
  var expdate="";
  if(save) {
    expdate=new Date();
    expdate.setTime(expdate.getTime()+86400*10);
    expdate="; expires="+expdate.toGMTString();
  }
  document.cookie=name+"="+value+"; path=/;"+expdate;
}


function HideHint() {
  setCookie('hint',1);
  InitHint();
}

function ShowHint() {
  setCookie('hint',0);
  InitHint();
}

function InitHint() {
  var h0='';
  var h1='none';
  if(getCookie('hint')==1) {
    h0='none';
    h1='';
  }
  document.all('hint0').style.display=h0;
  document.all('hint1').style.display=h1;
}

function CheckOrderForm() {
  var er='';
  var E=["Ваше имя","Ваш телефон"];
  for(i=0;i<E.length;i++) {
    if(!document.all('eo_'+(i+1)).value) {er+='- '+E[i]+'\n'}
  }
  if(er) {
    alert("Ошибка: не заполнены следующие поля:\n"+er);
    return false;
  }
  return true;
}





//---Flash

var isFlash=false;
var flashV=7;

var ie = (navigator.userAgent && (navigator.userAgent.indexOf("MSIE") >= 0) && (navigator.appVersion.indexOf("Win") != -1)) ? 1 : 0;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;

if (plugin){
//	var pluginVersion = parseInt(plugin.description.substring(plugin.description.indexOf(".") - 1));
	var pluginVersion = parseInt(plugin.description.split('Shockwave Flash ')[1]);
	var isFlash = (pluginVersion >= flashV);
} else if (ie){
	document.write('<sc'+'ript type="text/vbscript"> \n');
	document.write('on error resume next \n');
	document.write('isFlash = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+flashV+'")) \n');
	document.write('</sc'+'ript> \n');
}

function viewFlash(fName, Width, Height, Params, imgName, href){
	if (!(fName || Width || Height || imgName)) return;
	if (!isFlash){
		var out='<img src="/xb/' + imgName + '.jpg" width="' + Width + '" height="' + Height + '" alt="" border="0" /><BR>';
		if(href) {out='<a href='+href+'>'+out+'</a>';}
		document.write(out);
		return;
	}

	var Objstr = "";

	Objstr += '\n<object style="display:block" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+Width+'" height="'+Height+'">';
	Objstr += '\n<param name="allowScriptAccess" value="sameDomain"/>';
	Objstr += '\n<param name="movie" value="'+fName+'"/>';
	Objstr += '\n<param name="quality" value="high"/>';

	if (Params){
		for (param in Params) Objstr += '\n<param name="'+param+'" value="'+Params[param]+'"/>';
	}

	Objstr += '\n<embed src="'+fName+'" quality="high" allowScriptAccess="sameDomain" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"';
	Objstr += ' type="application/x-shockwave-flash" width="'+Width+'" height="'+Height+'"';

	if (Params){
		for (param in Params) Objstr += ' '+param+'="'+Params[param]+'"';
	}

	Objstr += '></embed>';
	Objstr += '\n</object>';

	document.write(Objstr);
}