// JavaScript Document

	nN = navigator.appName;
	
	var XXX = 0;
	var YYY = 0;
  var searchStringRus = " Οξθρκ..." ;
  var searchStringEn  = "Search ...";
  var searchString    = '';
  var str = '';
  var strVPNum = '0';
  var strNum = '0';
  var iPageNum = 0;
  var strdivContactInfo = '1';
  
  var isNetscape = navigator.appName=="Netscape";  
  
	
    function fsearch(str) {
            open('http://yandex.ru/sitesearch?text=' + str + "&site=" + document.fform.site.value);
    }

    function MouseUpHandler(e) {
        if(nN == 'Netscape' || nN == 'Opera') {
            if(document.getSelection()) {
                str = document.getSelection();

                newstr = str.replace(/\n+/g, ' ');
                str = newstr.replace(/\ +/g, ' ');

                if(str.length > 100){
                    var i;
                    i = 0;
                    str = str.slice(0, 100);
                    i = str.lastIndexOf(' ');



                    if(i > 0){
                        str = str.slice(0, i);
                    }
                }

                document.fform.searchstring.value = str;
            }
        } else if(nN == 'Microsoft Internet Explorer') {
            if(document.selection.createRange()) {
                var range = document.selection.createRange();
                var str = range.text;
            }

            if(str) {
                str = str.replace(/\ +/g, " ");
                document.fform.searchstring.value = str;
            }
        }
        return true;
    }

	
	function main_calc() /* ΠΡΠΎΠ΄ Π² ΠΏΠΎΠ»Π΅ ΠΏΠΎΠΈΡΠΊΠ° */
   
	{   
    if ( document.fform.searchstring.value == ' Οξθρκ...' )	{
	   document.fform.searchstring.value = '';
    }
	}
	
	function main_calcc() /* ΠΡΡΠΎΠ΄ ΠΈΠ· ΠΏΠΎΠ»Ρ ΠΏΠΎΠΈΡΠΊΠ° Rus */
	{ 
		  if ( document.fform.searchstring.value == '' ) {
        document.fform.searchstring.value = searchStringRus;
        searchString = '';
     }
	   else {
	     searchString = document.fform.searchstring.value;
     }
	}	

	function main_calccEn() /* ΠΡΡΠΎΠ΄ ΠΈΠ· ΠΏΠΎΠ»Ρ ΠΏΠΎΠΈΡΠΊΠ° En */
	{ 
		  if ( document.fform.searchstring.value == '' ) {
        document.fform.searchstring.value = searchStringEn;
        searchString = '';
      }
	   else {
	     searchString = document.fform.searchstring.value;
     }
	}

function showLayerAtPointer(str) {
	document.getElementById(str).style.visibility = "visible";
	if (isNetscape) {
		document.getElementById(str).style.left = XXX - parseInt(document.getElementById(str).style.width) + 430 + "px";
		document.getElementById(str).style.top  = YYY + 170 + "px";
	}
	else {
		document.getElementById(str).style.marginLeft=event.clientX-(document.documentElement.clientWidth/2)-parseInt(document.getElementById(str).style.width)-40;
		document.getElementById(str).style.marginTop=event.clientY-(document.documentElement.clientHeight/2)-20;		
	}
}

function showLayer(str) {
	document.getElementById(str).style.visibility = "visible";
}

function showLayerService(str1, str2) {
	document.getElementById(str1).style.visibility = "visible";
	document.getElementById(str2).style.backgroundImage='url(../img/cucumServiceButtonActive.png)';
}

function hideLayer(str) {
	document.getElementById(str).style.visibility = "hidden";
}

function hideLayerWithReset(str) {
	document.getElementById(str).style.visibility = "hidden";
	document.RequestForm.reset();
}

function hideLayerService(str1, str2) {
	document.getElementById(str1).style.visibility = "hidden";
	document.getElementById(str2).style.backgroundImage='url(../img/cucumServiceButton.png)';	
}	

function showOrderDocForm(str) {
	
	
	
	box = eval("document.RequestForm." + str);
	box.checked = true;
	
	document.getElementById('divBigSplash').style.visibility = "visible";

}


function getClientWidth()
{
  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
}

function getClientHeight()
{
  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
}

function setClientWidth()
{
/*  window.resizeTo(1024,768);*/
  document.body.style.width=1000;
  window.location.reload();
/*  alert (document.body.style.width);*/
/*  window.refresh;*/
  
}

function setClientHeight()
{
  document.body.clientHeight=585;
}

function checkClientSize()
{
  if ( getClientWidth() < 1000 ) setClientWidth();
}

function validateNumeric(str1, str2)
{
  if ( isNaN(str1) ) return str2;
}
function addHandler(node, evt, func) {    if (node.addEventListener) {        node.addEventListener(evt, func, false);     } else {        node.attachEvent('on' + evt, func);         }}; function isParent(child, parent) {    if (!child || !parent) {        return false;    }    while (true) {        if (child == parent) {            return true;        }        if (child.parentElement) {            child = child.parentElement;        } else if (child.parentNode) {            child = child.parentNode;        } else {            return false;        }    }} addHandler(window, 'load', function() {    var node = document.getElementById('divCatalogueBrands');    addHandler(node, 'mouseout', function(e) {        var target = e.relatedTarget || e.toElement;        if(!isParent(target, node)) {        if(str) hideLayer(str);       }    });});
