

function click(e) {
if (document.all) {if (event.button == 2) {alert(message);return false;}}
if (document.layers) {if (e.which == 3)
{alert(message);return false;}}}
if (document.layers) {document.captureEvents(Event.MouseDown);}

//document.onmousedown=click;

//document.onselectstart=function(){return false;};



	
/********* Затенение (Fade) ************/
startColor = "#8297B5";
endColor = "#FFFFFF";

stepIn = 17;
stepOut = 25;
autoFade = false;  
sloppyClass = false; 

hexa = new makearray(16);
for(var i = 0; i < 10; i++)
    hexa[i] = i;
hexa[10]="a"; hexa[11]="b"; hexa[12]="c";
hexa[13]="d"; hexa[14]="e"; hexa[15]="f";

//document.onmouseover = domouseover;
//document.onmouseout = domouseout;

startColor = dehexize(startColor.toLowerCase());
endColor = dehexize(endColor.toLowerCase());

var fadeId = new Array();

function dehexize(Color){
	var colorArr = new makearray(3);
	for (i=1; i<7; i++){
		for (j=0; j<16; j++){
			if (Color.charAt(i) == hexa[j]){
				if (i%2 !=0)
					colorArr[Math.floor((i-1)/2)]=eval(j)*16;
				else
					colorArr[Math.floor((i-1)/2)]+=eval(j);
			}
		}
	}
	return colorArr;
}

function domouseover() {
  if(document.all){
  	var srcElement = event.srcElement;
  	if ((srcElement.tagName == "A" && autoFade) || srcElement.className == "fade" || (sloppyClass && srcElement.className.indexOf("fade") != -1))
        fade(startColor,endColor,srcElement.uniqueID,stepIn);      
   }
}

function domouseout() {
  if (document.all){
  	var srcElement = event.srcElement;
    if ((srcElement.tagName == "A" && autoFade) || srcElement.className == "fade" || (sloppyClass && srcElement.className.indexOf("fade") != -1))
        fade(endColor,startColor,srcElement.uniqueID,stepOut);
    }
}

function makearray(n) {
    this.length = n;
    for(var i = 1; i <= n; i++)
        this[i] = 0;
    return this;
}

function hex(i) {
    if (i < 0)
        return "00";
    else if (i > 255)
        return "ff";
    else
       return "" + hexa[Math.floor(i/16)] + hexa[i%16];}

function setColor(r, g, b, element) {
      var hr = hex(r); var hg = hex(g); var hb = hex(b);
      element.style.color = "#"+hr+hg+hb;
}

function fade(s,e, element,step){
	var sr = s[0]; var sg = s[1]; var sb = s[2];
	var er = e[0]; var eg = e[1]; var eb = e[2];
	
	if (fadeId[0] != null && fade[0] != element){
		setColor(sr,sg,sb,eval(fadeId[0]));
		var i = 1;
		while(i < fadeId.length){
			clearTimeout(fadeId[i]);
			i++;
			}
		}
		
    for(var i = 0; i <= step; i++) {
    	fadeId[i+1] = setTimeout("setColor(Math.floor(" +sr+ " *(( " +step+ " - " +i+ " )/ " +step+ " ) + " +er+ " * (" +i+ "/" +
			step+ ")),Math.floor(" +sg+ " * (( " +step+ " - " +i+ " )/ " +step+ " ) + " +eg+ " * (" +i+ "/" +step+
			")),Math.floor(" +sb+ " * ((" +step+ "-" +i+ ")/" +step+ ") + " +eb+ " * (" +i+ "/" +step+ ")),"+element+");",i*step);
		}
	fadeId[0] = element;
}

nereidFadeObjects = new Object();
nereidFadeTimers = new Object();
function nereidFade(object, destOp, rate, delta){
if (!document.all)
return
	if (object != "[object]"){  //do this so I can take a string too
	        setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);
	        return;}

	    clearTimeout(nereidFadeTimers[object.sourceIndex]);
	    diff = destOp-object.filters.alpha.opacity;
	    direction = 1;
	    if (object.filters.alpha.opacity > destOp){
	    direction = -1;}

	    delta=Math.min(direction*diff,delta);
	    object.filters.alpha.opacity+=direction*delta;
	    if (object.filters.alpha.opacity != destOp){
	    nereidFadeObjects[object.sourceIndex]=object;
	    nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);
		}
}
		
/*************************************************/



/********* из shop1/index.php ************/


function OpenPic( pic_name, w, h)	{
	h = h + 30;
	w = w + 24;
	pic = window.open(pic_name,'pic',config='height=' +  h + ',width=' +  w + ',toolbar=0,resizable=1,scrollbars=0');
	pic.focus();	}



// Determine browser.

var dom = (document.getElementById? 1:0);

var isMinNS4 = (navigator.appName.indexOf("Netscape") >= 0 &&
                parseFloat(navigator.appVersion) >= 4)? 1 : 0;
var isMinIE4 = (document.all) ? 1 : 0;
var isMinIE5 = (isMinIE4 && navigator.appVersion.indexOf("5.") >= 0) ? 1 : 0;



//-----------------------------------------------------------------------------
// Layer visibility.
//-----------------------------------------------------------------------------

function hideLayer(layer) {

  if(dom)
  {
    layer.style.visibility = "hidden";
  }
  if (isMinNS4)
    layer.visibility = "hide";
  if (isMinIE4)
    layer.style.visibility = "hidden";
}

function showLayer(layer) {

  if(dom)
  {
  	layer.style.visibility = "visible";
	return;
  }
  if (isMinNS4)
    layer.visibility = "show";
  if (isMinIE4)
    layer.style.visibility = "visible";
}

function getLayer(name) {

  if (dom)
  	return document.getElementById(name);
  if (isMinNS4)
    return findLayer(name, document);
  if (isMinIE4)
    return eval('document.all.' + name);
  return null;
}

function findLayer(name, doc) {

  var i, layer;

  for (i = 0; i < doc.layers.length; i++) {
    layer = doc.layers[i];
    if (layer.name == name)
      return layer;
    if (layer.document.layers.length > 0)
      if ((layer = findLayer(name, layer.document)) != null)
        return layer;
  }
  return null;
}

//-----------------------------------------------------------------------------
// Layer positioning.
//-----------------------------------------------------------------------------

function moveLayerBy(layer, dx, dy) {

  if (isMinNS4)
    layer.moveBy(dx, dy);
  if (isMinIE4) {
    layer.style.pixelLeft += dx;
    layer.style.pixelTop  += dy;
  }
}

function moveLayerTo(layer, x, y) {

  if (isMinNS4)
    layer.moveTo(x, y);
  if (isMinIE4) {
    layer.style.left = x;
    layer.style.top  = y;
  }
}

//-----------------------------------------------------------------------------
// Image utilities.
//-----------------------------------------------------------------------------

function getImage(name) {

  if (isMinNS4) {
    return findImage(name, document);
  }
  if (isMinIE4)
    return eval('document.all.' + name);
  return null;
}

function findImage(name, doc) {

  var i, img;

  for (i = 0; i < doc.images.length; i++)
    if (doc.images[i].name == name)
      return doc.images[i];
  for (i = 0; i < doc.layers.length; i++)
    if ((img = findImage(name, doc.layers[i].document)) != null) {
      img.container = doc.layers[i];
      return img;
    }
  return null;
}

function getImagePageLeft(img) {

  var x, obj;

  if (isMinNS4) {
    if (img.container != null)
      return img.container.pageX + img.x;
    else
      return img.x;
  }
  if (isMinIE4) {
    x = 0;
    obj = img;
    while (obj.offsetParent != null) {
      x += obj.offsetLeft;
      obj = obj.offsetParent;
    }
    x += obj.offsetLeft;
    return x;
  }
  return -1;
}

function getImagePageTop(img) {

  var y, obj;

  if (isMinNS4) {
    if (img.container != null)
      return img.container.pageY + img.y;
    else
      return img.y;
  }
  if (isMinIE4) {
    y = 0;
    obj = img;
    while (obj.offsetParent != null) {
      y += obj.offsetTop;
      obj = obj.offsetParent;
    }
    y += obj.offsetTop;
    return y;
  }
  return -1;
}


function getLeft(layer) {

  if (isMinNS4)
    return layer.left;
  if (isMinIE4)
    return layer.style.pixelLeft;
  return -1;
}

function getTop(layer) {

  if (isMinNS4)
    return layer.top;
  if (isMinIE4)
    return layer.style.pixelTop;
  return -1;
}

function getRight(layer) {

  if (isMinNS4)
    return layer.left + getWidth(layer);
  if (isMinIE4)
    return layer.style.pixelLeft + getWidth(layer);
  return -1;
}

function getBottom(layer) {

  if (isMinNS4)
    return layer.top + getHeight(layer);
  if (isMinIE4)
    return layer.style.pixelTop + getHeight(layer);
  return -1;
}

function getWidth(layer) {

  if (isMinNS4) {
    if (layer.document.width)
      return layer.document.width;
    else
      return layer.clip.right - layer.clip.left;
  }
  if (isMinIE4) {
    if (layer.style.pixelWidth)
      return layer.style.pixelWidth;
    else
      return layer.clientWidth;
  }
  return -1;
}

function getHeight(layer) {

  if (isMinNS4) {
    if (layer.document.height)
      return layer.document.height;
    else
      return layer.clip.bottom - layer.clip.top;
  }
  if (isMinIE4) {
    if (layer.style.pixelHeight)
      return layer.style.pixelHeight;
    else
      return layer.clientHeight;
  }
  return -1;
}

	
var a = "empty";
var b = "empty";

function change(sl1,vr) {
	var oL1;
	a = vr;
	oL1 = getLayer(sl1);
	showLayer(oL1); 
}

function release(sl1,vr) {
	var oL1;
	b = vr;
    if (b==a){
	}else{
		oL1 = getLayer(sl1);
		hideLayer(oL1); 
		a = "empty";
		b = "empty";
	 }
}
	


function getCookieVal (offset) {
 var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1) {endstr = document.cookie.length;}
  return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg) {
      return getCookieVal (j);
      }
    i = document.cookie.indexOf(" ",i) + 1;
    if (i == 0) break;
    }
  return null;
}

function DeleteCookie (name) {
  if (GetCookie(name)) {
    document.cookie = name + "=" +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}


function SetCookie (name, value) {
  document.cookie = name + "=" + value + "; expires=Thu, 01-Jan-2088 00:00:01 GMT"
}


function SelectModelB(value){
  var c = GetCookie('SelectedModelB');
  if (c) {
   if (c.indexOf('('+value+')') == -1){
    c = c + '('+value+')';
    DeleteCookie('SelectedModelB');
    SetCookie('SelectedModelB', c);
    id = 'check' + value;
    document.all[id].src = '/img/galka_01.gif';
    document.all[id].alt = 'Удалить из выборки.';
   }
   else {UnSelectModelB(value)}
  }
  else {
    SetCookie('SelectedModelB', '('+value+')');
    id = 'check' + value;
    document.all[id].src = '/img/galka_01.gif';
    document.all[id].alt = 'Удалить из выборки.';
  }


  
}

function UnSelectModelB(value){
  var c = GetCookie('SelectedModelB');
  v = '('+value+')';
  if (c.indexOf(v) > -1) {
  c = c.substring(0, c.indexOf(v)) + c.substring(c.indexOf(v) + v.length);
    DeleteCookie('SelectedModelB');
    SetCookie('SelectedModelB', c);
  }
    id = 'check' + value; 
    document.all[id].src = '/img/galka.gif';
    document.all[id].alt = 'Добавить в выбраные.';
}


function SelectModel(value){
  var c = GetCookie('SelectedModel');
  if (c) {
   if (c.indexOf('('+value+')') == -1){
    c = c + '('+value+')';
    DeleteCookie('SelectedModel');
    SetCookie('SelectedModel', c);
    id = 'check' + value;
    document.all[id].src = '/img/galka_01.gif';
    document.all[id].alt = 'Удалить из выборки.';
   }
   else {UnSelectModel(value)}
  }
  else {
    SetCookie('SelectedModel', '('+value+')');
    id = 'check' + value;
    document.all[id].src = '/img/galka_01.gif';
    document.all[id].alt = 'Удалить из выборки.';
  }


  
}

function UnSelectModel(value){
  var c = GetCookie('SelectedModel');
  v = '('+value+')';
  if (c.indexOf(v) > -1) {
  c = c.substring(0, c.indexOf(v)) + c.substring(c.indexOf(v) + v.length);
    DeleteCookie('SelectedModel');
    SetCookie('SelectedModel', c);
  }
    id = 'check' + value; 
    document.all[id].src = '/img/galka.gif';
    document.all[id].alt = 'Добавить в выбраные.';
}
	
function sub_show(who)	{
	if (document.getElementById(who).style.display == 'none')
		document.getElementById(who).style.display = 'block';	}
function sub_hide(who)	{
	if (document.getElementById(who).style.display == 'block')
		document.getElementById(who).style.display = 'none';	}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function open_pic( pic_name )
	{
	pic = window.open('' + pic_name,'pic',config='height=450,width=300,toolbar=0,resizable=1,scrollbars=0');
	pic.focus();
	}
function open_pics( pic_name, num )
	{
	if (num == 1)
		pic = window.open('' + pic_name,'pic',config='height=315,width=450,toolbar=0,resizable=1,scrollbars=0');
	if (num == 2)
		pic = window.open('' + pic_name,'pic',config='height=450,width=300,toolbar=0,resizable=1,scrollbars=0');
	if (num == 3)
		pic = window.open('' + pic_name,'pic',config='height=450,width=450,toolbar=0,resizable=1,scrollbars=0');
	pic.focus();
	}


function exists()	{
	document.existsform.who_flag.value="4";
	document.existsform.submit();
}
function action(name)
{
		document.existsform.actions_name.value=name;
	document.existsform.submit();
}


function save_form(logn)
{	var c="";
	for (i=1;i<19; i++)
	{
		if (document.getElementById("inf"+i)) 
			c=c+"[/////]"+document.getElementById("inf"+i).value;
		
	}
	DeleteCookie('formZakaz'+logn);
    SetCookie('formZakaz'+logn, c);
	
}

function extract_zn(logn)
{	var c = GetCookie('formZakaz'+logn);
	if (c) {
	cAll=c.split('[/////]'); 
	for (i=0; i <= cAll.length; i++) 
	{ 	if (document.getElementById("inf"+i)) { if (cAll[i]!='') document.getElementById('inf'+i).value=cAll[i]; }
	} }
} 
/************* Открытие картинки в новом окне *****************/
function viewImage(imageURL)
 { 

  var windowTop = 0; 
  var windowLeft = 0; 
  var defaultWidth = 500; 
  var defaultHeight = 500; 
  var onLoseFocusExit = true; 
  var Poster; 

var str = '';
n = imageURL.length;
for(i = 0;	i < n; i++)
{
	ch = imageURL.substr(i,5)
	if(ch == "prev_"){ i+=4; continue;}
	str = str + imageURL.charAt(i);
}
imageURL=str;

  var Options = "width=" + defaultWidth + ",height=" + defaultHeight + ",top=" + windowTop + ",left=" + windowLeft + "" 

  var myScript = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n" + 
    "<html>\n" + 
    "<head>\n" + 
    "<title>Фабрика мебели 8 марта</title>\n" + 
    "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\n" + 
    "<meta http-equiv=\"Content-Language\" content=\"en-gb\">\n" + 
    "<meta http-equiv=\"imagetoolbar\" content=\"no\">\n" + 
    "<script language=\"JavaScript\" type=\"text/javascript\">\n" + 
	"var message='Уважаемый посетитель! Использовать правый клик на этом сайте нельзя!';"+
	"function click(e) {if (document.all)"+
	"{if (event.button == 2)"+
	"{ alert(message);return false;}}"+
	"if (document.layers) {if (e.which == 3)"+
	"{ alert(message);return false;}}}"+
	"if (document.layers)"+
	"{document.captureEvents(Event.MouseDown);}"+
"document.onmousedown=click;"+
    "function resizewindow () {\n" + 
    "  var width = document.myimage.width+0;\n" + 
    "  var height = document.myimage.height+0;\n" +
	"  ";
  if (navigator.appName.indexOf("Netscape") != -1) { 
    myScript = myScript +  "  window.innerHeight = height;\n  window.innerWidth = width;\n" 
  } 

  else if (navigator.appName.indexOf("Opera") != -1) { 
    myScript = myScript +  "  window.resizeTo (width+12, height+31);\n" 
  } 

  else if (navigator.appName.indexOf("Microsoft") != -1) { 
    myScript = myScript + "  window.resizeTo (width+12, height+31);\n" 
  } 

  else { 
    myScript = myScript + "  window.resizeTo (width+14, height+34);\n" 
  } 

  myScript = myScript + "}\n" + "\n" + 
    "</" + "script>\n</head>\n" + "<body style='margin:0; padding: 0;' onload='resizewindow();' "; 

  

  myScript = myScript + "bgcolor=\"#000\">\n" + 
    "<img src=\"" + imageURL + "\" id=\"myimage\"  name=\"myimage\">\n" + 
    "</body>\n" +  "</html>\n"; 

  var imageWindow = window.open ("","imageWin",Options); 
  imageWindow.document.write (myScript) 
  imageWindow.document.close (); 
  
}

/***************************************************************/